From owner-svn-src-head@freebsd.org Sun Jul 31 00:20:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11D08BA24F4; Sun, 31 Jul 2016 00:20:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id D0A781498; Sun, 31 Jul 2016 00:20:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id E2E783C4868; Sun, 31 Jul 2016 10:20:45 +1000 (AEST) Date: Sun, 31 Jul 2016 10:20:44 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Bjoern A. Zeeb" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303560 - head/usr.sbin/uathload In-Reply-To: <201607302039.u6UKddbt096834@repo.freebsd.org> Message-ID: <20160731092544.K976@besplex.bde.org> References: <201607302039.u6UKddbt096834@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=L6TY2ldzgA1nSrPHxQAA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 00:20:57 -0000 On Sat, 30 Jul 2016, Bjoern A. Zeeb wrote: > Log: > Rename devname to udevname after including stdlib.h in r303445 > as gcc trips over the devname(3) and reports 'shadows a global declaration'. You mean "as gcc actually works, so it detects and reports that devname in the program 'shadows a global declaration'". > This should unbreak gcc based world builds. We asked for this warning using -Wshadow. -Wshadow sometimes works for clang too. But -Wsystem-headers is very broken for clang. It is the default for gcc, at least for controlling -Wshadow, and we put it in CFLAGS at WARNS >= 1, but clang silently ignores it, at least for controlling -Wshadow. I don't like changing names, especially to work around namespace pollution, but pollution in "standard" headers is especially dangerous and hard to fix since you can't control it. So renaming to avoid seems least bad. The bug turns off -Wshadow for headers where it is most needed, since of of course your headers are better written and you know what is in them. Even -Wno-system-headers shouldn't turn off -Wshadow, since the -Wshadow warning is not about internals of system headers but about leakage of the internals. You would also want it if you or a system header misused a reserved or unreserved name like _exit or off64_t. Looking for such errors, I found the interesting names quot and rem in (these are bad standard struct member names, so applications must not #define them), and lots of new bugs in starting with off64_t polluting even the C90 case. also uses read, write, seek and close as bad nonstandard struct member names, giving the same restrictions as for quot and rem, but this is only in the _BSD_VISIBLE case. Bruce From owner-svn-src-head@freebsd.org Sun Jul 31 00:44:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31E04BA2D02; Sun, 31 Jul 2016 00:44:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com [209.85.214.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B54B311DD; Sun, 31 Jul 2016 00:44:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f41.google.com with SMTP id j124so140526951ith.1; Sat, 30 Jul 2016 17:44:23 -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=o9ZtoEORx5T9OoKGbOWsUMnPo9l+Kmv6RsnZ65/rfrw=; b=fyTzh8iD/LD/5DGkg8wIFT6I5rz7C/QFM4UhDiYVM189wISF/W8RwJ83ypNPUKhTCW 1tnQlGEY7bsV3mQWLvVkgcyys2cPlkwjQcS+zKm5sFFgjnN85n7AfdAEw1QarPjeeRAz qYhw3TBHigzswQItEIh+T+h58uPlCXZgZAN08ZJLLOrA2SWY+dtkTVfE37oghycRlddG cRH0Kgli9J9bEmBAHmO4hOdL7lugdbwjw4Z4Npi3XA+p5mEzL8sc8b4QjltpReWtcabc 9jDsRrpPa2EHrbmSnHodrV/31np6KLfm7xFxLOuHqf13ax4lx7Cfno9+eBnVpMLmlX+R sdMw== X-Gm-Message-State: AEkoout5R4JS9lFvVmYISYUhZ865gRG83rZaUuhcRfdKuS2/Q7KeJdoEFWZTji7wpKPDIQ== X-Received: by 10.36.66.2 with SMTP id i2mr7094669itb.53.1469925857623; Sat, 30 Jul 2016 17:44:17 -0700 (PDT) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com. [209.85.214.47]) by smtp.gmail.com with ESMTPSA id u75sm4521979ita.16.2016.07.30.17.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Jul 2016 17:44:17 -0700 (PDT) Received: by mail-it0-f47.google.com with SMTP id j124so140526863ith.1; Sat, 30 Jul 2016 17:44:17 -0700 (PDT) X-Received: by 10.36.192.9 with SMTP id u9mr51322880itf.86.1469925857131; Sat, 30 Jul 2016 17:44:17 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Sat, 30 Jul 2016 17:44:16 -0700 (PDT) In-Reply-To: <201607302223.u6UMNWD7037665@repo.freebsd.org> References: <201607302223.u6UMNWD7037665@repo.freebsd.org> From: Conrad Meyer Date: Sat, 30 Jul 2016 17:44:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303563 - head/sys/kern 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-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 00:44:24 -0000 On Sat, Jul 30, 2016 at 3:23 PM, Mateusz Guzik wrote: > Author: mjg > Date: Sat Jul 30 22:23:31 2016 > New Revision: 303563 > URL: https://svnweb.freebsd.org/changeset/base/303563 > > Log: > sx: increment spin_cnt before cpu_spinwait in xlock Looks like it's after cpu_spinwait instead. > > The change is a no-op only done for consistency with the rest of the file. > > Modified: > head/sys/kern/kern_sx.c > > Modified: head/sys/kern/kern_sx.c > ============================================================================== > --- head/sys/kern/kern_sx.c Sat Jul 30 22:21:48 2016 (r303562) > +++ head/sys/kern/kern_sx.c Sat Jul 30 22:23:31 2016 (r303563) > @@ -889,10 +889,10 @@ _sx_slock_hard(struct sx *sx, int opts, > GIANT_SAVE(); > while (SX_OWNER(sx->sx_lock) == x && > TD_IS_RUNNING(owner)) { > + cpu_spinwait(); > #ifdef KDTRACE_HOOKS > spin_cnt++; > #endif > - cpu_spinwait(); > } > KTR_STATE0(KTR_SCHED, "thread", > sched_tdname(curthread), "running"); > From owner-svn-src-head@freebsd.org Sun Jul 31 00:46:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BD2BBA2D77; Sun, 31 Jul 2016 00:46:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 941261356; Sun, 31 Jul 2016 00:46:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x22f.google.com with SMTP id i5so197613861wmg.0; Sat, 30 Jul 2016 17:46:14 -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=sOrtbxNvx/08av28Hu8dds6ecvEzx4GBtA9Z0viP2LQ=; b=DEKrAeUEaO86did0tYa7SypJ7CG9wsttshyTXkh0SeMV8mk31M5g1ydY0zPK3/hEva eS2Pa6+hWKCTPiR3Hn+8ryHwzvx5+y5iaqlNm09vfiAs42xNzji7+p/mAs/IrBza7uVT 4ukSptcOL5ilAZUqh9vTI9g5EOGSBVQpPZt32XpA4FigIddg+rSIEX4p+RIBxQxMYxcS H6gu7bRhmNjn9CEdAlqrQsDUcPtVpHscUmclWRhxPNlUaMHf2RNzvfIYnfpLQyMXujv0 Rd+aYpxRblBbIrEtqKb/IGcBBaO/wf4a4FQCkcNQCpuzjfRqjNiMKDnjag6UX5SP2/0x AHLw== 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=sOrtbxNvx/08av28Hu8dds6ecvEzx4GBtA9Z0viP2LQ=; b=WS42dr5vVvivX0ZkB1FMBgIwPgKPyIg+H7dmv/Cogb9Xos7QrRD+l8sWG5AN5dMi3D vgEtKHXNEv8xtb+eJtmFEf2rdvmg1ZdFLFCTpfQMQS3kyflavNeJ3MQl6rQWFE+97gEC iWz1GgxVHj5PVs7qWS1pntRvMDLI6yF9ooXroUpIH6/EaFurXDKQZJOXbMvg7O2F3LqD OFxGceeFbamQQh6IXbH9IoNvHc1RaY0bzlwAGG3VZ8rtql8M8R+ggey8ed2cCYl90wax GRyJ/ttnx2VUcpKu1cpMo219P2/ItiAFXgikhK9aNPJ0HxH/hr4XxmtHgZCQLfSwSpzm ZlOQ== X-Gm-Message-State: AEkooutd3Dn60DUdIRgMyyRqbDOjJGpEkh0CBoH1HvFRyd4Hg5SGYKpKAKMTFEPsAGm9tQ== X-Received: by 10.28.14.68 with SMTP id 65mr48710469wmo.68.1469925972357; Sat, 30 Jul 2016 17:46:12 -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 p23sm9892465wme.8.2016.07.30.17.46.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sat, 30 Jul 2016 17:46:11 -0700 (PDT) Date: Sun, 31 Jul 2016 02:46:09 +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: r303563 - head/sys/kern Message-ID: <20160731004609.GA9408@dft-labs.eu> References: <201607302223.u6UMNWD7037665@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-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 00:46:15 -0000 On Sat, Jul 30, 2016 at 05:44:16PM -0700, Conrad Meyer wrote: > On Sat, Jul 30, 2016 at 3:23 PM, Mateusz Guzik wrote: > > Author: mjg > > Date: Sat Jul 30 22:23:31 2016 > > New Revision: 303563 > > URL: https://svnweb.freebsd.org/changeset/base/303563 > > > > Log: > > sx: increment spin_cnt before cpu_spinwait in xlock > > Looks like it's after cpu_spinwait instead. > Brainfarted the commit message. The actual order as seen is the patch is what's seen in the file. > > > > The change is a no-op only done for consistency with the rest of the file. > > > > Modified: > > head/sys/kern/kern_sx.c > > > > Modified: head/sys/kern/kern_sx.c > > ============================================================================== > > --- head/sys/kern/kern_sx.c Sat Jul 30 22:21:48 2016 (r303562) > > +++ head/sys/kern/kern_sx.c Sat Jul 30 22:23:31 2016 (r303563) > > @@ -889,10 +889,10 @@ _sx_slock_hard(struct sx *sx, int opts, > > GIANT_SAVE(); > > while (SX_OWNER(sx->sx_lock) == x && > > TD_IS_RUNNING(owner)) { > > + cpu_spinwait(); > > #ifdef KDTRACE_HOOKS > > spin_cnt++; > > #endif > > - cpu_spinwait(); > > } > > KTR_STATE0(KTR_SCHED, "thread", > > sched_tdname(curthread), "running"); > > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sun Jul 31 01:14:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE6D5BA97DB; Sun, 31 Jul 2016 01:14:07 +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 A407C1232; Sun, 31 Jul 2016 01:14:07 +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 u6V1E6DR000604; Sun, 31 Jul 2016 01:14:06 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V1E6la000602; Sun, 31 Jul 2016 01:14:06 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607310114.u6V1E6la000602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 31 Jul 2016 01:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303564 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 01:14:08 -0000 Author: ache Date: Sun Jul 31 01:14:06 2016 New Revision: 303564 URL: https://svnweb.freebsd.org/changeset/base/303564 Log: Both C99 and POSIX directly prohibits any standard function to set errno to 0. Breaking this rule in 2001 NetBSD hack was imported which attempts to workaround very limited glob() return codes amount. Use POSIX-compatible workaround now with E2BIG which can't comes from other functions used instead of prohibited 0. Modified: head/lib/libc/gen/glob.3 head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.3 ============================================================================== --- head/lib/libc/gen/glob.3 Sat Jul 30 22:23:31 2016 (r303563) +++ head/lib/libc/gen/glob.3 Sun Jul 31 01:14:06 2016 (r303564) @@ -363,7 +363,7 @@ file .It Dv GLOB_NOSPACE An attempt to allocate memory failed, or if .Fa errno -was 0 +was E2BIG, .Dv GLOB_LIMIT was specified in the flags and .Fa pglob\->gl_matchc Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sat Jul 30 22:23:31 2016 (r303563) +++ head/lib/libc/gen/glob.c Sun Jul 31 01:14:06 2016 (r303564) @@ -270,7 +270,7 @@ globexp0(const Char *pattern, glob_t *pg if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) { if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } return (glob0(pattern, pglob, limit, origpat)); @@ -297,7 +297,7 @@ globexp1(const Char *pattern, glob_t *pg if ((ptr = g_strchr(pattern, LBRACE)) != NULL) { if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } return (globexp2(ptr, pattern, pglob, limit)); @@ -538,7 +538,7 @@ glob0(const Char *pattern, glob_t *pglob qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob); if (qpatnext == NULL) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } oldpathc = pglob->gl_pathc; @@ -672,7 +672,7 @@ glob2(Char *pathbuf, Char *pathend, Char if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } if ((pglob->gl_flags & GLOB_MARK) && @@ -682,7 +682,7 @@ glob2(Char *pathbuf, Char *pathend, Char g_stat(pathbuf, &sb, pglob) == 0 && S_ISDIR(sb.st_mode)))) { if (pathend + 1 > pathend_last) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } *pathend++ = SEP; @@ -699,7 +699,7 @@ glob2(Char *pathbuf, Char *pathend, Char if (ismeta(*p)) anymeta = 1; if (q + 1 > pathend_last) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } *q++ = *p++; @@ -710,7 +710,7 @@ glob2(Char *pathbuf, Char *pathend, Char pattern = p; while (UNPROT(*pattern) == SEP) { if (pathend + 1 > pathend_last) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } *pathend++ = *pattern++; @@ -729,30 +729,36 @@ glob3(Char *pathbuf, Char *pathend, Char { struct dirent *dp; DIR *dirp; - int err, too_long, saverrno; + int err, too_long, saverrno, saverrno2; char buf[MAXPATHLEN + MB_LEN_MAX - 1]; struct dirent *(*readdirfunc)(DIR *); if (pathend > pathend_last) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } *pathend = EOS; if (pglob->gl_errfunc != NULL && g_Ctoc(pathbuf, buf, sizeof(buf))) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } + saverrno = errno; errno = 0; if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { if (errno == ENOENT || errno == ENOTDIR) return (0); if ((pglob->gl_errfunc != NULL && pglob->gl_errfunc(buf, errno)) || - (pglob->gl_flags & GLOB_ERR)) + (pglob->gl_flags & GLOB_ERR)) { + if (errno == 0) + errno = saverrno; return (GLOB_ABORTED); + } + if (errno == 0) + errno = saverrno; return (0); } @@ -775,7 +781,7 @@ glob3(Char *pathbuf, Char *pathend, Char if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) { - errno = 0; + errno = E2BIG; err = GLOB_NOSPACE; break; } @@ -822,12 +828,12 @@ glob3(Char *pathbuf, Char *pathend, Char errno = 0; } - saverrno = errno; + saverrno2 = errno; if (pglob->gl_flags & GLOB_ALTDIRFUNC) (*pglob->gl_closedir)(dirp); else closedir(dirp); - errno = saverrno; + errno = saverrno2; if (err) return (err); @@ -836,6 +842,8 @@ glob3(Char *pathbuf, Char *pathend, Char pglob->gl_errfunc(buf, errno)) || (pglob->gl_flags & GLOB_ERR))) return (GLOB_ABORTED); + if (errno == 0) + errno = saverrno; return (0); } @@ -865,7 +873,7 @@ globextend(const Char *path, glob_t *pgl if ((pglob->gl_flags & GLOB_LIMIT) && pglob->gl_matchc > limit->l_path_lim) { - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } @@ -892,7 +900,7 @@ globextend(const Char *path, glob_t *pgl if ((copy = malloc(len)) != NULL) { if (g_Ctoc(path, copy, len)) { free(copy); - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } } @@ -902,7 +910,7 @@ globextend(const Char *path, glob_t *pgl if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_string_cnt >= GLOB_LIMIT_STRING) { free(copy); - errno = 0; + errno = E2BIG; return (GLOB_NOSPACE); } pathv[pglob->gl_offs + pglob->gl_pathc++] = copy; From owner-svn-src-head@freebsd.org Sun Jul 31 02:28:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 265F6BA2EAD; Sun, 31 Jul 2016 02:28:52 +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 DCBCE11A3; Sun, 31 Jul 2016 02:28:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V2Spal026520; Sun, 31 Jul 2016 02:28:51 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V2Sp6e026519; Sun, 31 Jul 2016 02:28:51 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607310228.u6V2Sp6e026519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 31 Jul 2016 02:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303565 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 02:28:52 -0000 Author: ache Date: Sun Jul 31 02:28:50 2016 New Revision: 303565 URL: https://svnweb.freebsd.org/changeset/base/303565 Log: In addition to prev. commit. Since potentially glob2() can return error without setting errno, restore errno before its call. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sun Jul 31 01:14:06 2016 (r303564) +++ head/lib/libc/gen/glob.c Sun Jul 31 02:28:50 2016 (r303565) @@ -821,6 +821,8 @@ glob3(Char *pathbuf, Char *pathend, Char errno = 0; continue; } + if (errno == 0) + errno = saverrno; err = glob2(pathbuf, --dc, pathend_last, restpattern, pglob, limit); if (err) From owner-svn-src-head@freebsd.org Sun Jul 31 02:43:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B669BA72D6; Sun, 31 Jul 2016 02:43:46 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B78419E6; Sun, 31 Jul 2016 02:43:46 +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 u6V2hjux033588; Sun, 31 Jul 2016 02:43:45 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V2hjvg033587; Sun, 31 Jul 2016 02:43:45 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607310243.u6V2hjvg033587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 31 Jul 2016 02:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303566 - head/usr.bin/calendar/calendars/ru_RU.UTF-8 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 02:43:46 -0000 Author: ache Date: Sun Jul 31 02:43:45 2016 New Revision: 303566 URL: https://svnweb.freebsd.org/changeset/base/303566 Log: Remove vestige of scripted conversion Modified: head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common Modified: head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common Sun Jul 31 02:28:50 2016 (r303565) +++ head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common Sun Jul 31 02:43:45 2016 (r303566) @@ -84,7 +84,7 @@ LANG=ru_RU.UTF-8 25 окт. День таможенника 30 окт. День памяти жертв политических репрессий 10/SunLast День работников автомобильного транспорта - 7 нояб. День окт.ябрьской революции 1917 года + 7 нояб. День октябрьской революции 1917 года 9 нояб. Всемирный день качества 10 нояб. День милиции 16 нояб. День морской пехоты From owner-svn-src-head@freebsd.org Sun Jul 31 02:54:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAF28BA74E7; Sun, 31 Jul 2016 02:54:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B7431ECB; Sun, 31 Jul 2016 02:54:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V2sRip037587; Sun, 31 Jul 2016 02:54:27 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V2sR9L037586; Sun, 31 Jul 2016 02:54:27 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607310254.u6V2sR9L037586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 02:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303567 - head/sbin/resolvconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 02:54:28 -0000 Author: pfg Date: Sun Jul 31 02:54:27 2016 New Revision: 303567 URL: https://svnweb.freebsd.org/changeset/base/303567 Log: resolvconf(8) now needs an additional @RESTARTCMD@ replacement when installing. After r303062, which brought openresolv 3.8.1, we need to replace an additional @RESTARTCMD@ in resolvconf. Reported by: Guy Yur X-MFC with: r303062 Modified: head/sbin/resolvconf/Makefile Modified: head/sbin/resolvconf/Makefile ============================================================================== --- head/sbin/resolvconf/Makefile Sun Jul 31 02:43:45 2016 (r303566) +++ head/sbin/resolvconf/Makefile Sun Jul 31 02:54:27 2016 (r303567) @@ -30,6 +30,7 @@ ${f}: ${f}.in -e 's:@LIBEXECDIR@:${FILESDIR}:g' \ -e 's:@VARDIR@:${VARDIR}:g' \ -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g' \ + -e 's:@RESTARTCMD@:${RESTARTCMD_}:g' \ -e 's:@RCDIR@:${RCDIR}:g' \ -e 's: vpn : ng[0-9]*&:g' \ ${DIST}/$@.in > $@ From owner-svn-src-head@freebsd.org Sun Jul 31 03:11:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6C98BA7AD0; Sun, 31 Jul 2016 03:11:11 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80B471CDC; Sun, 31 Jul 2016 03:11:11 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V3BARC044290; Sun, 31 Jul 2016 03:11:10 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V3BAGi044289; Sun, 31 Jul 2016 03:11:10 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607310311.u6V3BAGi044289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 31 Jul 2016 03:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303568 - head/usr.bin/calendar/calendars/ru_RU.UTF-8 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 03:11:11 -0000 Author: ache Date: Sun Jul 31 03:11:10 2016 New Revision: 303568 URL: https://svnweb.freebsd.org/changeset/base/303568 Log: Remove another vestige of scripted conversion Modified: head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan Modified: head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan Sun Jul 31 02:54:27 2016 (r303567) +++ head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan Sun Jul 31 03:11:10 2016 (r303568) @@ -35,7 +35,7 @@ Paskha=Пасха 14 сент. День Волха Змеевича 22 сент.* Поворот к зиме (осеннее равноденствие) 10 нояб. День Макоши -21 нояб. День Сварога и Семартагла +21 нояб. День Сварога и Семаргла 9 дек. День Дажьбога и Марены #endif /* !_ru_RU_UTF_8_pagan_ */ From owner-svn-src-head@freebsd.org Sun Jul 31 03:26:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E710ABA7D42; Sun, 31 Jul 2016 03:26:54 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC41114C3; Sun, 31 Jul 2016 03:26:54 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V3QrAO049311; Sun, 31 Jul 2016 03:26:53 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V3QrIQ049306; Sun, 31 Jul 2016 03:26:53 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607310326.u6V3QrIQ049306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 31 Jul 2016 03:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303569 - head/usr.bin/calendar/calendars/ru_RU.KOI8-R X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 03:26:55 -0000 Author: ache Date: Sun Jul 31 03:26:53 2016 New Revision: 303569 URL: https://svnweb.freebsd.org/changeset/base/303569 Log: Reflect CLDR timedef changes Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday (contents, props changed) head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common Sun Jul 31 03:11:10 2016 (r303568) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common Sun Jul 31 03:26:53 2016 (r303569) @@ -9,97 +9,97 @@ LANG=ru_RU.KOI8-R -12 -13 -14 -21 -25 . - 8 -10 - 1 +12 . +13 . +14 . +21 . +25 . . + 8 . +10 . + 1 03/SunSecond -11 -18 +11 +18 03/SunThird , - -27 -27 - 1 - 2 +27 +27 + 1 . + 2 . 04/SunFirst -12 +12 . 04/SunSecond -26 -30 - 7 -17 -18 -24 -26 -27 -28 -30 -31 +26 . +30 . + 7 +17 +18 +24 +26 +27 +28 +30 +31 05/SunLast - 1 - 5 - 6 - 8 + 1 + 5 + 6 + 8 06/SunSecond 06/SunThird -22 ( , 1941 ) -27 -29 +22 ( , 1941 ) +27 +29 06/SatLast 07/SunFirst 07/SunSecond 07/SunSecond 07/SunThird 07/SunLast - -28 - 6 +28 + 6 . 08/SunFirst -12 - +12 . - 08/SunSecond 08/SunThird -22 -27 +22 . +27 . 08/SunLast - 1 - 2 - 3 - 4 + 1 . + 2 . + 3 . + 4 . 09/SunFirst 09/SunSecond 09/SunThird -28 +28 . 09/SunLast - 1 - 1 - 4 - 5 -14 + 1 . + 1 . + 4 . + 5 . +14 . 10/SunSecond 10/SunThird -24 -25 -30 +24 . +25 . +30 . 10/SunLast - 7 1917 - 9 -10 -16 -17 -19 -21 -26 + 7 . 1917 + 9 . +10 . +16 . +17 . +19 . +21 . +26 . 11/SunLast - 1 - 3 - 9 -12 -17 -20 -22 -27 + 1 . + 3 . + 9 . +12 . +17 . +20 . +22 . +27 . #endif /* !_ru_RU_KOI8_R_common_ */ Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday Sun Jul 31 03:11:10 2016 (r303568) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday Sun Jul 31 03:26:53 2016 (r303569) @@ -9,17 +9,17 @@ LANG=ru_RU.KOI8-R - 1 - 2 - 3 - 4 - 5 - 7 -23 - 8 - 1 - 9 -12 - 4 + 1 . + 2 . + 3 . + 4 . + 5 . + 7 . +23 . + 8 + 1 + 9 +12 + 4 . #endif /* !_ru_RU_KOI8_R_holiday_ */ Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 03:11:10 2016 (r303568) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 03:26:53 2016 (r303569) @@ -9,20 +9,20 @@ LANG=ru_RU.KOI8-R -27 (1944 ) - 2 - (1943 ) -23 (1918 ) -18 ( , 1242 ) -10 (1709 ) - 9 (1714 ) -23 - (1943 ) - 2 (1945 ) - 8 .. (1812 ) -11 .. (1790 ) -21 - (1380 ) - 7 (1612 ) - 1 .. (1853 ) - 5 - (1941 ) -24 .. (1790 ) +27 . (1944 ) + 2 . - (1943 ) +23 . (1918 ) +18 . ( , 1242 ) +10 (1709 ) + 9 . (1714 ) +23 . - (1943 ) + 2 . (1945 ) + 8 . .. (1812 ) +11 . .. (1790 ) +21 . - (1380 ) + 7 . (1612 ) + 1 . .. (1853 ) + 5 . - (1941 ) +24 . .. (1790 ) #endif /* !_ru_RU_KOI8_R_military_ */ Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox Sun Jul 31 03:11:10 2016 (r303568) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox Sun Jul 31 03:26:53 2016 (r303569) @@ -10,14 +10,14 @@ LANG=ru_RU.KOI8-R Paskha= -21 -27 -14 - 4 - 7 -14 -19 -15 +21 . +27 . +14 . + 4 . + 7 . +14 . +19 . +15 . -48 -7 . -3 @@ -25,12 +25,12 @@ Paskha= +39 +49 . - 7 - 7 -12 -19 -28 -11 + 7 . + 7 +12 +19 . +28 . +11 . #endif /* !_ru_RU_KOI8_R_orthodox_ */ Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan Sun Jul 31 03:11:10 2016 (r303568) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan Sun Jul 31 03:26:53 2016 (r303569) @@ -10,33 +10,33 @@ LANG=ru_RU.KOI8-R Paskha= -21 * -25 ( ) - 6 -24 -29 - 1 -14 , +21 .* +25 . ( ) + 6 . +24 . +29 . + 1 +14 , -55 +7 +16 -20 * - 7 ( ) - 6 , -22 -15 -21 * - 1 - 7 ( ) -27 , - 2 -21 -28 -14 -22 * ( ) -10 -21 - 9 +20 * + 7 . ( ) + 6 , +22 +15 +21 * + 1 + 7 ( ) +27 , + 2 . +21 . +28 . +14 . +22 .* ( ) +10 . +21 . + 9 . #endif /* !_ru_RU_KOI8_R_pagan_ */ From owner-svn-src-head@freebsd.org Sun Jul 31 04:14:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 251CFBA87C4; Sun, 31 Jul 2016 04:14:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DACDC15C4; Sun, 31 Jul 2016 04:14:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V4ELGX067072; Sun, 31 Jul 2016 04:14:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V4ELpO067071; Sun, 31 Jul 2016 04:14:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607310414.u6V4ELpO067071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 04:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303570 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 04:14:22 -0000 Author: pfg Date: Sun Jul 31 04:14:20 2016 New Revision: 303570 URL: https://svnweb.freebsd.org/changeset/base/303570 Log: indent(1): Consistently indent declarations. This fixes a very visible issue that may be hidden by some indent.pro settings as in the example from FreeBSD's /usr/share. From Piotr's log: ____ To prevent losing tabs from indentation in declarations, FreeBSD indent's r125624 added code for the most common case when it's an identifier that is indented, but didn't do anything with the original code that did the same for any other cases. The other cases are: lparens (function pointer declaration), asterisks (pointer declaration), stray semicolons, and commas leading identifiers instead of trailing them. Use the code added in r125624 (and improved in later commits) to write a new function indent_declaration() and use it in all places that meant to indent declarations. In order to indent only once per line, reuse existing ps.dumped_decl_indent variable that was only used when formatting for troff (-troff) until now. ____ Reference: https://github.com/pstef/freebsd_indent/commit/ddd263db2a59978f43468989eff65299cf3ce7e1 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Sun Jul 31 03:26:53 2016 (r303569) +++ head/usr.bin/indent/indent.c Sun Jul 31 04:14:20 2016 (r303570) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include "indent.h" static void bakcopy(void); +static void indent_declaration(int, int); const char *in_name = "Standard Input"; /* will always point to name of input * file */ @@ -512,26 +513,25 @@ check_type: (ps.last_token != ident || proc_calls_space || (ps.its_a_keyword && (!ps.sizeof_keyword || Bill_Shannon)))) *e_code++ = ' '; - if (ps.in_decl && !ps.block_init) - if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) { - ps.dumped_decl_indent = 1; + ps.want_blank = false; + if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && + !is_procname) { + /* function pointer declarations */ + if (troff) { sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); e_code += strlen(e_code); } else { - while ((e_code - s_code) < dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } - *e_code++ = token[0]; + indent_declaration(dec_ind, tabs_to_var); } - else + ps.dumped_decl_indent = true; + } + if (!troff) *e_code++ = token[0]; ps.paren_indents[ps.p_l_follow - 1] = e_code - s_code; if (sp_sw && ps.p_l_follow == 1 && extra_expression_indent && ps.paren_indents[0] < 2 * ps.ind_size) ps.paren_indents[0] = 2 * ps.ind_size; - ps.want_blank = false; if (ps.in_or_st && *token == '(' && ps.tos <= 2) { /* * this is a kluge to make sure that declarations will be @@ -582,27 +582,30 @@ check_type: break; case unary_op: /* this could be any unary operation */ - if (ps.want_blank) - *e_code++ = ' '; - - if (troff && !ps.dumped_decl_indent && ps.in_decl && !is_procname) { - sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); - ps.dumped_decl_indent = 1; - e_code += strlen(e_code); + if (!ps.dumped_decl_indent && ps.in_decl && !is_procname && + !ps.block_init) { + /* pointer declarations */ + if (troff) { + if (ps.want_blank) + *e_code++ = ' '; + sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, + token); + e_code += strlen(e_code); + } + else { + /* if this is a unary op in a declaration, we should + * indent this token */ + for (i = 0; token[i]; ++i) + /* find length of token */; + indent_declaration(dec_ind - i, tabs_to_var); + } + ps.dumped_decl_indent = true; } - else { + else if (ps.want_blank) + *e_code++ = ' '; + { const char *res = token; - if (ps.in_decl && !ps.block_init) { /* if this is a unary op - * in a declaration, we - * should indent this - * token */ - for (i = 0; token[i]; ++i); /* find length of token */ - while ((e_code - s_code) < (dec_ind - i)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; /* pad it */ - } - } if (troff && token[0] == '-' && token[1] == '>') res = "\\(->"; for (t_ptr = res; *t_ptr; ++t_ptr) { @@ -714,11 +717,12 @@ check_type: ps.block_init_level = 0; ps.just_saw_decl--; - if (ps.in_decl && s_code == e_code && !ps.block_init) - while ((e_code - s_code) < (dec_ind - 1)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } + if (ps.in_decl && s_code == e_code && !ps.block_init && + !ps.dumped_decl_indent) { + /* indent stray semicolons in declarations */ + indent_declaration(dec_ind - 1, tabs_to_var); + ps.dumped_decl_indent = true; + } ps.in_decl = (ps.dec_nest > 0); /* if we were in a first level * structure declaration, we @@ -932,51 +936,16 @@ check_type: if (ps.in_decl) { /* if we are in a declaration, we must indent * identifier */ if (is_procname == 0 || !procnames_start_line) { - if (!ps.block_init) { - if (troff && !ps.dumped_decl_indent) { + if (!ps.block_init && !ps.dumped_decl_indent) { + if (troff) { if (ps.want_blank) *e_code++ = ' '; - ps.want_blank = false; sprintf(e_code, "\n.De %dp+\200p\n", dec_ind * 7); - ps.dumped_decl_indent = 1; e_code += strlen(e_code); - } else { - int cur_dec_ind; - int pos, startpos; - - /* - * in order to get the tab math right for - * indentations that are not multiples of 8 we - * need to modify both startpos and dec_ind - * (cur_dec_ind) here by eight minus the - * remainder of the current starting column - * divided by eight. This seems to be a - * properly working fix - */ - startpos = e_code - s_code; - cur_dec_ind = dec_ind; - pos = startpos; - if ((ps.ind_level * ps.ind_size) % 8 != 0) { - pos += (ps.ind_level * ps.ind_size) % 8; - cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; - } - - if (tabs_to_var) { - while ((pos & ~7) + 8 <= cur_dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = '\t'; - pos = (pos & ~7) + 8; - } - } - while (pos < cur_dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - pos++; - } - if (ps.want_blank && e_code - s_code == startpos) - *e_code++ = ' '; - ps.want_blank = false; - } + } else + indent_declaration(dec_ind, tabs_to_var); + ps.dumped_decl_indent = true; + ps.want_blank = false; } } else { if (ps.want_blank) @@ -1026,12 +995,12 @@ check_type: ps.want_blank = (s_code != e_code); /* only put blank after comma * if comma does not start the * line */ - if (ps.in_decl && is_procname == 0 && !ps.block_init) - while ((e_code - s_code) < (dec_ind - 1)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } - + if (ps.in_decl && is_procname == 0 && !ps.block_init && + !ps.dumped_decl_indent) { + /* indent leading commas and not the actual identifiers */ + indent_declaration(dec_ind - 1, tabs_to_var); + ps.dumped_decl_indent = true; + } *e_code++ = ','; if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) @@ -1237,3 +1206,33 @@ bakcopy(void) err(1, "%s", in_name); } } + +static void +indent_declaration(int cur_dec_ind, int tabs_to_var) +{ + int pos = e_code - s_code; + char *startpos = e_code; + + /* + * get the tab math right for indentations that are not multiples of 8 + */ + if ((ps.ind_level * ps.ind_size) % 8 != 0) { + pos += (ps.ind_level * ps.ind_size) % 8; + cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; + } + if (tabs_to_var) + while ((pos & ~7) + 8 <= cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = '\t'; + pos = (pos & ~7) + 8; + } + while (pos < cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = ' '; + pos++; + } + if (e_code == startpos && ps.want_blank) { + *e_code++ = ' '; + ps.want_blank = false; + } +} From owner-svn-src-head@freebsd.org Sun Jul 31 04:58:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7618BA8DB4; Sun, 31 Jul 2016 04:58:07 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97869134A; Sun, 31 Jul 2016 04:58:07 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V4w6TS081988; Sun, 31 Jul 2016 04:58:06 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V4w6og081986; Sun, 31 Jul 2016 04:58:06 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607310458.u6V4w6og081986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 04:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303571 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 04:58:07 -0000 Author: pfg Date: Sun Jul 31 04:58:06 2016 New Revision: 303571 URL: https://svnweb.freebsd.org/changeset/base/303571 Log: indent(1): Bail out if there's no more space on the parser stack. Also increase the stack size still keeping a conservative value of 256. This is based on a similar changes done for PostgreSQL which instead uses a stack size of 1000. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak (with changes) Modified: head/usr.bin/indent/indent_globs.h head/usr.bin/indent/parse.c Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Sun Jul 31 04:14:20 2016 (r303570) +++ head/usr.bin/indent/indent_globs.h Sun Jul 31 04:58:06 2016 (r303571) @@ -226,7 +226,7 @@ struct fstate bodyf; /* major body font */ -#define STACKSIZE 150 +#define STACKSIZE 256 struct parser_state { int last_token; Modified: head/usr.bin/indent/parse.c ============================================================================== --- head/usr.bin/indent/parse.c Sun Jul 31 04:14:20 2016 (r303570) +++ head/usr.bin/indent/parse.c Sun Jul 31 04:58:06 2016 (r303571) @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)parse.c 8.1 #include __FBSDID("$FreeBSD$"); +#include #include #include "indent_globs.h" #include "indent_codes.h" @@ -200,6 +201,9 @@ parse(int tk) /* tk: the code for the co } /* end of switch */ + if (ps.tos >= STACKSIZE) + errx(1, "Parser stack overflow"); + reduce(); /* see if any reduction can be done */ #ifdef debug From owner-svn-src-head@freebsd.org Sun Jul 31 05:31:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9821BA9279; Sun, 31 Jul 2016 05:31:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B3A81D71; Sun, 31 Jul 2016 05:31:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V5V9pU093026; Sun, 31 Jul 2016 05:31:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V5V9U0093025; Sun, 31 Jul 2016 05:31:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607310531.u6V5V9U0093025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 31 Jul 2016 05:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303572 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 05:31:10 -0000 Author: ngie Date: Sun Jul 31 05:31:09 2016 New Revision: 303572 URL: https://svnweb.freebsd.org/changeset/base/303572 Log: Fix regression with /i caused by r303047 '\n' was specifically added to -e arguments prior to r303047. Restore historical behavior which in turn fixes usr.sbin/etcupdate/preworld_test:main . The fix is being committed to address the issue in the short term and may be iterated upon as noted in bug 211399 Discussed with: mi, pfg Differential Revision: https://reviews.freebsd.org/D7368 PR: 195929, 211399 [*] MFC after: 18 days X-MFC with: r303047 Reported by: Jenkins Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/sed/main.c Modified: head/usr.bin/sed/main.c ============================================================================== --- head/usr.bin/sed/main.c Sun Jul 31 04:58:06 2016 (r303571) +++ head/usr.bin/sed/main.c Sun Jul 31 05:31:09 2016 (r303572) @@ -123,6 +123,7 @@ static void usage(void); int main(int argc, char *argv[]) { + char *temp_arg; int c, fflag; (void) setlocale(LC_ALL, ""); @@ -145,7 +146,10 @@ main(int argc, char *argv[]) break; case 'e': eflag = 1; - add_compunit(CU_STRING, optarg); + asprintf(&temp_arg, "%s\n", optarg); + if (temp_arg == NULL) + errx(1, "Couldn't allocate temporary buffer"); + add_compunit(CU_STRING, temp_arg); break; case 'f': fflag = 1; From owner-svn-src-head@freebsd.org Sun Jul 31 06:03:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 942CABA9A14; Sun, 31 Jul 2016 06:03:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61A371D59; Sun, 31 Jul 2016 06:03:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V63Rt4007402; Sun, 31 Jul 2016 06:03:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V63RCH007401; Sun, 31 Jul 2016 06:03:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607310603.u6V63RCH007401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 31 Jul 2016 06:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303573 - head/cddl/contrib/opensolaris/lib/libzpool/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:03:28 -0000 Author: ngie Date: Sun Jul 31 06:03:27 2016 New Revision: 303573 URL: https://svnweb.freebsd.org/changeset/base/303573 Log: Cast result from third parameter to int instead of promoting it to size_t This resolves a -Wformat issue when the value is used as a format width precision specifier, i.e. %*s MFC after: 1 month Reported by: clang Sponsored by: EMC / Isilon Storage Division Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/util.c Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/util.c Sun Jul 31 05:31:09 2016 (r303572) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/util.c Sun Jul 31 06:03:27 2016 (r303573) @@ -108,7 +108,7 @@ show_vdev_stats(const char *desc, const (void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n", indent, "", prefix, - indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12), + (int)(indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12)), desc, vs->vs_space ? 6 : 0, vs->vs_space ? used : "", vs->vs_space ? 6 : 0, vs->vs_space ? avail : "", From owner-svn-src-head@freebsd.org Sun Jul 31 06:24:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3528BA9142; Sun, 31 Jul 2016 06:24:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9361717C5; Sun, 31 Jul 2016 06:24:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V6OQdu014797; Sun, 31 Jul 2016 06:24:26 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V6OQB4014796; Sun, 31 Jul 2016 06:24:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607310624.u6V6OQB4014796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 31 Jul 2016 06:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303574 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:24:27 -0000 Author: adrian Date: Sun Jul 31 06:24:26 2016 New Revision: 303574 URL: https://svnweb.freebsd.org/changeset/base/303574 Log: [gpioled] add support for inverting the LED polarity. No, this isn't a star trek science joke - sometimes LEDs are wired up to be active low, so this is needed. Submitted by: Dan Nelson Modified: head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Sun Jul 31 06:03:27 2016 (r303573) +++ head/sys/dev/gpio/gpioled.c Sun Jul 31 06:24:26 2016 (r303574) @@ -66,6 +66,7 @@ struct gpioled_softc device_t sc_busdev; struct mtx sc_mtx; struct cdev *sc_leddev; + int sc_invert; }; static void gpioled_control(void *, int); @@ -82,6 +83,8 @@ gpioled_control(void *priv, int onoff) GPIOLED_LOCK(sc); if (GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, GPIO_PIN_OUTPUT) == 0) { + if (sc->sc_invert) + onoff = !onoff; GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); } @@ -199,6 +202,8 @@ gpioled_attach(device_t dev) if (resource_string_value(device_get_name(dev), device_get_unit(dev), "name", &name)) name = NULL; + resource_int_value(device_get_name(dev), + device_get_unit(dev), "invert", &sc->sc_invert); #endif sc->sc_leddev = led_create_state(gpioled_control, sc, name ? name : From owner-svn-src-head@freebsd.org Sun Jul 31 06:28:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A29DFBA9259; Sun, 31 Jul 2016 06:28:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58DCC1A5C; Sun, 31 Jul 2016 06:28:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V6Se1e014972; Sun, 31 Jul 2016 06:28:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V6SeZj014969; Sun, 31 Jul 2016 06:28:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607310628.u6V6SeZj014969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 31 Jul 2016 06:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303575 - in head/tools/regression/zfs/zpool: add create X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:28:41 -0000 Author: ngie Date: Sun Jul 31 06:28:40 2016 New Revision: 303575 URL: https://svnweb.freebsd.org/changeset/base/303575 Log: Remove calls to `die` added for associated bugs Panics are no longer hit with ^/head@r303573 on amd64 PR: 194586, 194587, 194589 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t head/tools/regression/zfs/zpool/create/files.t Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t ============================================================================== --- head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Sun Jul 31 06:24:26 2016 (r303574) +++ head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Sun Jul 31 06:28:40 2016 (r303575) @@ -4,8 +4,6 @@ dir=`dirname $0` . ${dir}/../../misc.sh -[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194586" - echo "1..100" disks_create 7 Modified: head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t ============================================================================== --- head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Sun Jul 31 06:24:26 2016 (r303574) +++ head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Sun Jul 31 06:28:40 2016 (r303575) @@ -4,8 +4,6 @@ dir=`dirname $0` . ${dir}/../../misc.sh -[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194587" - echo "1..100" disks_create 7 Modified: head/tools/regression/zfs/zpool/create/files.t ============================================================================== --- head/tools/regression/zfs/zpool/create/files.t Sun Jul 31 06:24:26 2016 (r303574) +++ head/tools/regression/zfs/zpool/create/files.t Sun Jul 31 06:28:40 2016 (r303575) @@ -4,8 +4,6 @@ dir=`dirname $0` . ${dir}/../../misc.sh -[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194589" - echo "1..59" files_create 5 From owner-svn-src-head@freebsd.org Sun Jul 31 06:34:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFBAFBA968A; Sun, 31 Jul 2016 06:34:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7E8C1207; Sun, 31 Jul 2016 06:34:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V6YntW018482; Sun, 31 Jul 2016 06:34:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V6YnNn018480; Sun, 31 Jul 2016 06:34:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607310634.u6V6YnNn018480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 31 Jul 2016 06:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303576 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:34:51 -0000 Author: ngie Date: Sun Jul 31 06:34:49 2016 New Revision: 303576 URL: https://svnweb.freebsd.org/changeset/base/303576 Log: Conditionalize code which defines sysctls per _KERNEL #ifdef guard This resolves several issues when compiling libzpool (userspace library), i.e. -Wimplicit-function-declaration and -Wmissing-declarations issues. MFC after: 2 weeks Reported by: clang Tested with: clang 3.8.1, gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jul 31 06:28:40 2016 (r303575) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jul 31 06:34:49 2016 (r303576) @@ -58,9 +58,11 @@ typedef struct mirror_map { static int vdev_mirror_shift = 21; +#ifdef _KERNEL SYSCTL_DECL(_vfs_zfs_vdev); static SYSCTL_NODE(_vfs_zfs_vdev, OID_AUTO, mirror, CTLFLAG_RD, 0, "ZFS VDEV Mirror"); +#endif /* * The load configuration settings below are tuned by default for @@ -74,28 +76,38 @@ static SYSCTL_NODE(_vfs_zfs_vdev, OID_AU /* Rotating media load calculation configuration. */ static int rotating_inc = 0; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_inc, CTLFLAG_RWTUN, &rotating_inc, 0, "Rotating media load increment for non-seeking I/O's"); +#endif static int rotating_seek_inc = 5; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_inc, CTLFLAG_RWTUN, &rotating_seek_inc, 0, "Rotating media load increment for seeking I/O's"); +#endif static int rotating_seek_offset = 1 * 1024 * 1024; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_offset, CTLFLAG_RWTUN, &rotating_seek_offset, 0, "Offset in bytes from the last I/O which " "triggers a reduced rotating media seek increment"); +#endif /* Non-rotating media load calculation configuration. */ static int non_rotating_inc = 0; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_inc, CTLFLAG_RWTUN, &non_rotating_inc, 0, "Non-rotating media load increment for non-seeking I/O's"); +#endif static int non_rotating_seek_inc = 1; +#ifdef _KERNEL SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_seek_inc, CTLFLAG_RWTUN, &non_rotating_seek_inc, 0, "Non-rotating media load increment for seeking I/O's"); +#endif static inline size_t Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sun Jul 31 06:28:40 2016 (r303575) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sun Jul 31 06:34:49 2016 (r303576) @@ -176,6 +176,7 @@ int zfs_vdev_read_gap_limit = 32 << 10; int zfs_vdev_write_gap_limit = 4 << 10; #ifdef __FreeBSD__ +#ifdef _KERNEL SYSCTL_DECL(_vfs_zfs_vdev); static int sysctl_zfs_async_write_active_min_dirty_percent(SYSCTL_HANDLER_ARGS); @@ -271,6 +272,7 @@ sysctl_zfs_async_write_active_max_dirty_ return (0); } #endif +#endif int vdev_queue_offset_compare(const void *x1, const void *x2) From owner-svn-src-head@freebsd.org Sun Jul 31 06:37:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D34D4BA9707; Sun, 31 Jul 2016 06:37:39 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A8B91393; Sun, 31 Jul 2016 06:37:39 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-io0-x231.google.com with SMTP id m101so162076088ioi.2; Sat, 30 Jul 2016 23:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=m4TdEwFiJx8P+6gFz4xnUg/QfQYG91INKx6pGLK8d40=; b=ZA6ezNDfWLiOXish0gsYulc1k6RfiVjaLA7si6n7pvO2vvBd1/lO0Xnk/g9aes8BIm LHpmhsyD4Lc0CgvjkatgiMMwgV/Q1QEihz+NjFteIm0YztYk8JHTN4Kp/KYrEu94AM19 kwQRQTkQHxp0BWw/vGF8j6bejLnvPvQxYpMDiRE7fMIVCF8FJXigi7zddNU04GLTtqtU bAUO2LRn6Mjx14PBJ4fXaAgG6/g5nceGLHCuXkmBcvdEnq66p9NgVtdxtYmnSiHxaNt8 kXhoQX0c3pbc91bh1gdwOyVyVpTLW8WbE0+mCRQ9yPKi8J6GziF+ILg7iYLJrZ/T933j Nqzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=m4TdEwFiJx8P+6gFz4xnUg/QfQYG91INKx6pGLK8d40=; b=m/nDVrGRINOs/nQEPufNHe6Dsaqb0AufhYi2ZIkWsCM9reb1IUwQGQ8a3rScSS9OzP Zj5HqXHf8aR3Z4U4/cYNTrk2+kQJC3T3oRutjMqVp3T2LdXYrfHUs8Hn2Y+F8+X3HtZ1 46cjfwI11R7Y15Wlf2XkXRjPsASrfWuqCrkmUohMMvZfdSPgIikdHlCdXpkdhZzrLF73 xM/WIUEFBYpsg0LOus48cHP7XYr5Rj1PgWUCVQUdPSZGO2J8+8FLQx/QR+SVlCe8ulkm xiudTSeMr8f8AbD3qvqlYVfw3Ih0bheqtCRiZSsExIRe246uCUjEqd7e0MiIELWxQIhI HO/w== X-Gm-Message-State: AEkoouuC5J21zaft06n8j5TqAST06eqWrQQxi9d2UY87Yy+RXch6Lrbld2kxokQnbpubgFvOMlKcWQDkFFxGAw== X-Received: by 10.107.39.65 with SMTP id n62mr38381621ion.94.1469947059056; Sat, 30 Jul 2016 23:37:39 -0700 (PDT) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 10.107.55.68 with HTTP; Sat, 30 Jul 2016 23:37:38 -0700 (PDT) In-Reply-To: References: <201607262011.u6QKBTDp043256@repo.freebsd.org> <5f0367b2-6916-b300-bba5-c3d3f3699a91@FreeBSD.org> From: Antoine Brodin Date: Sun, 31 Jul 2016 08:37:38 +0200 X-Google-Sender-Auth: t6al0RBApy3wY7HAxzldCv9dThw Message-ID: Subject: Re: svn commit: r303342 - in head: include lib/libc/stdlib To: Ed Schouten Cc: Pedro Giffuni , Benjamin Kaduk , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:37:39 -0000 On Tue, Jul 26, 2016 at 11:41 PM, Ed Schouten wrote: > Hi Pedro, Benjamin, > > 2016-07-26 22:35 GMT+02:00 Pedro Giffuni : >> On 07/26/16 15:14, Benjamin Kaduk wrote: >>> Is a __FreeBSD_version bump planned? (Third-party software might want >>> to be warning-clean.) >> >> Third party software should already follow standards ;). > > Not only that. This change only changes arguments from one integer > type to the other. As far as I know, such a change would not cause a > compiler to generate (substantially) different diagnostics. > > If it turns out I'm mistaken I'll reconsider, but for now this should do. :-) Hi, This change broke a few games in the ports tree: http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/falconseye-1.9.3_11.log http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack34-3.4.3_9.log http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack36-3.6.0.log Cheers, Antoine From owner-svn-src-head@freebsd.org Sun Jul 31 06:37:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51DE2BA9735; Sun, 31 Jul 2016 06:37:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (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 16B311568; Sun, 31 Jul 2016 06:37:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-io0-x244.google.com with SMTP id y34so12408560ioi.3; Sat, 30 Jul 2016 23:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=5wQ4Fto+LT/TBIc5aJv0N79L2bH5riJXm2RfEmkVKc8=; b=vs4n7sD65zr4ZHD/xJOheiCosRfNB3oJuXfW8y48+CCWmuCkmsjskbxugKk0ZyGeM2 EUMeRT3B/r3yB3a9RhIzvNrZdYLre0NEfXKOPjQ99PEaFKymuaI085XcQyusGupCk/81 ciFCfpfau+SJ3Cg8ZfGSz8ppnGNOhfPBCXDy7jgBKt+SfeEufsz85WpH4A09U6Qf+24w CTrQkM//+GHszD2gfoO7971Ix0lp8kucczCz6GWyQEzu0nF6081/+3SYZhqJRJFwbpDl yWF/ayVjMzEbs2Yv4qq7dSbrd9R7Qj/pyGjc+5rpGicBtAbWj2mlE9lL3eGYFwuOv+oe G8rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=5wQ4Fto+LT/TBIc5aJv0N79L2bH5riJXm2RfEmkVKc8=; b=S4r4PaX7g+Aza5+UPDNUQpOC+4lSTV/FmO61w6Q9U7aO4FQE7yMxNs+pJR+J/7Wwxm aagk3JaKNONejvFeLgRJpS+ewtme7Z0xGxzcU/T+1sQHhLECqaehnb2rXH504eeEHFG8 A9OODU1T/E5LqygUJNGczfGBOof78Gf5+zbbv6DrHzoaelKzFFDxL3ULGzmr0LBJXzSb Oz5eZHvQk6V5HmzjfI0X9LELpdpo0uMy3al3l0UfLw5hr+2Sz4yIG3XxhCdQKvuh0ZLW zR0zX3ttd9aTi0SFiOXhzNXe18ZI23w2aLlek8ir6gycNu8WzC/88LSgOIc0sbcpN7rK nx2Q== X-Gm-Message-State: AEkooutukeTdLu251PbsdAA74/8ZEG61uBGNG5lIKST/Rj+fzbU1XUjkG2rlqqB+2hr1iw== X-Received: by 10.107.35.148 with SMTP id j142mr3161945ioj.143.1469947071249; Sat, 30 Jul 2016 23:37:51 -0700 (PDT) Received: from [192.168.20.9] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id l19sm10987798iod.10.2016.07.30.23.37.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Jul 2016 23:37:50 -0700 (PDT) Subject: Re: svn commit: r303575 - in head/tools/regression/zfs/zpool: add create Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_98B0ABF2-2514-4E2C-BA92-4FE008AEA6DE"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201607310628.u6V6SeZj014969@repo.freebsd.org> Date: Sat, 30 Jul 2016 23:37:48 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <42D8FA29-3860-468F-95AF-208244695A52@gmail.com> References: <201607310628.u6V6SeZj014969@repo.freebsd.org> To: Garrett Cooper X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:37:52 -0000 --Apple-Mail=_98B0ABF2-2514-4E2C-BA92-4FE008AEA6DE Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Jul 30, 2016, at 23:28, Garrett Cooper wrote: > > Author: ngie > Date: Sun Jul 31 06:28:40 2016 > New Revision: 303575 > URL: https://svnweb.freebsd.org/changeset/base/303575 > > Log: > Remove calls to `die` added for associated bugs > > Panics are no longer hit with ^/head@r303573 on amd64 > > PR: 194586, 194587, 194589 > Sponsored by: EMC / Isilon Storage Division MFC after: 1 week --Apple-Mail=_98B0ABF2-2514-4E2C-BA92-4FE008AEA6DE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXnZy8AAoJEPWDqSZpMIYV0gQQAJV3NqP2GjGjl5Oai+g616Y9 Gthu0bitnEUQZs9syGqooUdTCiQVJmnp8MehxMZfiRRY417I54Q06zbb2uFKMzAF tDMFjismGdx2xqXqDV8T5zx0zSQ/T2qR9qRmpJz8bNHzr1L3sM3aCnMr0TJjAOnU 57DR4XaLUWzkJtFv/ljG57obtWDlxfRh51TsKsyzss0SHiaII0pYooBSHwj/mVYt 3hiS0BWp1SQe+MmPs7e4pX1PeXDUv/4sH+Xjfk/4YcZPvTHJNsXlCs46nKxFgmPr fApZKOjJ+lobktY1Wp40MjpG7PdHd6Z8XUptb4yV32N72V9SXxkUA1N0fzcJGydT Vk65UTTs+tgO+5I/fiNsIE7/ugLzhHAGFEE+ydzTzMjCVwaf+X/Su4/Wo7yd7xgm 0Jz1FgUtHg8fN9ih8aw0IXIavFYKxvcu3kuScSKeEgGmQdE8vD+wpe+NDxv+za2v m1xF1c/iOSObIh6Ee/RIX2n+o55dKa2eeXCtdwpVwmjpG6f/Qf6cU76f82nOoK03 yYdkml+WbOnl9F6Ol0IocD9d2fqhXlNkydXHeQYUgYQCSTu7hfmTFrgDEQEvm8Jz SfUsU7fyiHz8JOghLOyM0QkazHG/vLlzgRcc4o6fS4kXN2ttXiZogUVs+7gY61CA urhU+HX9X3qEiDkhj4nl =whS5 -----END PGP SIGNATURE----- --Apple-Mail=_98B0ABF2-2514-4E2C-BA92-4FE008AEA6DE-- From owner-svn-src-head@freebsd.org Sun Jul 31 06:40:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39AFEBA987C for ; Sun, 31 Jul 2016 06:40:10 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x22a.google.com (mail-yw0-x22a.google.com [IPv6:2607:f8b0:4002:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA17117F7 for ; Sun, 31 Jul 2016 06:40:09 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x22a.google.com with SMTP id r9so148461806ywg.0 for ; Sat, 30 Jul 2016 23:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HJ+h+C0stkVuYXUP/pB9TKUnYh1ESSf5To7+dlaXcVo=; b=R3P8a3XU94JQ7F31v3++CkNEuAVkSm0tclO1aY7sTZS77TYORJI3aTkP8fNH0DkXWx /VV9NjYe6OMQsLYLjIQwNxrv6/omod4/ptOx+3JBEiWgTU0ReDx7f9KkE0aeQXFm1iqo EDr3+wMcSAkXRtpnINyvEXh80afmeyuvs5igoPeOah2tup9ikFvtpgyTruhzfrjAojdB QgMhVAwyUDFJo3vO8u8A6JMns2fDb7L9Qyde7643L4l5duxbN/ads7iBuLe84bUZkRGC +btHdoBMGSCQ1AfLEz26wGPrJ3CeeX88K7x4Jn5R4nDm3RqVuSPy5WM2UNz8HwZUVVH0 WxVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HJ+h+C0stkVuYXUP/pB9TKUnYh1ESSf5To7+dlaXcVo=; b=D5u71OBXeouZBCrXypvKzQ7IXT4IzhsUxgmt7PuGLFMJ16gUr52XULjnixzO5xAUpD 9K6sSj/l2fZiYgEMsin91lYUH5p39oMsXuaZstnuLf3o/cxgTJzcTOoPZjiwrrTE0ugn aZT3MycN4M/8XV3xUTLwmN4xKoIRClV18zHAcSpPL+js3URkYX6Z9bPwyPk00I2ytegW rK3G1hDH9tJgEofUvoEfoj8181x4VwvBoxAhgz65/CoGsAZikSdxuRERu/XXZ7++itxl ME5G3M3rH8IA1Klq7jH17PWuzUGdfhSeuQgMh8klZGLYqC0JlJbMP6YLQM08B4sQnijW CCew== X-Gm-Message-State: AEkoouu0KaaGOHcn9MfFfzEGXNbqbKbOPjqO0mPEN1hULfn13Mu+XixxQLNr+drDdsXPNebIrm+7CHU4zYXlXg== X-Received: by 10.13.229.1 with SMTP id o1mr42937075ywe.95.1469947209238; Sat, 30 Jul 2016 23:40:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.201.71 with HTTP; Sat, 30 Jul 2016 23:40:08 -0700 (PDT) In-Reply-To: References: <201607262011.u6QKBTDp043256@repo.freebsd.org> <5f0367b2-6916-b300-bba5-c3d3f3699a91@FreeBSD.org> From: Ed Schouten Date: Sun, 31 Jul 2016 08:40:08 +0200 Message-ID: Subject: Re: svn commit: r303342 - in head: include lib/libc/stdlib To: Antoine Brodin Cc: Pedro Giffuni , Benjamin Kaduk , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:40:10 -0000 Hi Antoine, 2016-07-31 8:37 GMT+02:00 Antoine Brodin : > This change broke a few games in the ports tree: > > http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/falconseye-1.9.3_11.log > http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack34-3.4.3_9.log > http://beefy4.nyi.freebsd.org/data/head-amd64-default/p419204_s303419/logs/errors/nethack36-3.6.0.log Will take care of those. Thanks for letting me know! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Sun Jul 31 06:51:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B32CABA9A6A; Sun, 31 Jul 2016 06:51:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EAEF1DB7; Sun, 31 Jul 2016 06:51:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V6pYOY025166; Sun, 31 Jul 2016 06:51:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V6pYx2025165; Sun, 31 Jul 2016 06:51:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607310651.u6V6pYx2025165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 31 Jul 2016 06:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303577 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:51:35 -0000 Author: adrian Date: Sun Jul 31 06:51:34 2016 New Revision: 303577 URL: https://svnweb.freebsd.org/changeset/base/303577 Log: [ar71xx_gpio] handle AR934x and QCA953x GPIO OE polarity. For reasons I won't comment on, the AR934x and QCA953x GPIO_OE register value is inverted - bit set == input, bit clear == output. So, fix this in the output setting, in reading the initial state from the boot loader, and also setting any gpiofunc pins that are necessary. Modified: head/sys/mips/atheros/ar71xx_gpio.c Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Sun Jul 31 06:34:49 2016 (r303576) +++ head/sys/mips/atheros/ar71xx_gpio.c Sun Jul 31 06:51:34 2016 (r303577) @@ -138,13 +138,56 @@ ar71xx_gpio_function_disable(struct ar71 GPIO_CLEAR_BITS(sc, AR71XX_GPIO_FUNCTION, mask); } +/* + * On most platforms, GPIO_OE is a bitmap where the bit set + * means "enable output." + * + * On AR934x and QCA953x, it's the opposite - the bit set means + * "input enable". + */ +static int +ar71xx_gpio_oe_is_high(void) +{ + switch (ar71xx_soc) { + case AR71XX_SOC_AR9344: + case AR71XX_SOC_QCA9533: + case AR71XX_SOC_QCA9533_V2: + return 0; + default: + return 1; + } +} + static void -ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin, - unsigned int flags) +ar71xx_gpio_oe_set_output(struct ar71xx_gpio_softc *sc, int b) +{ + uint32_t mask; + + mask = 1 << b; + + if (ar71xx_gpio_oe_is_high()) + GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); + else + GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); +} + +static void +ar71xx_gpio_oe_set_input(struct ar71xx_gpio_softc *sc, int b) { uint32_t mask; - mask = 1 << pin->gp_pin; + mask = 1 << b; + + if (ar71xx_gpio_oe_is_high()) + GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); + else + GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); +} + +static void +ar71xx_gpio_pin_configure(struct ar71xx_gpio_softc *sc, struct gpio_pin *pin, + unsigned int flags) +{ /* * Manage input/output @@ -153,11 +196,10 @@ ar71xx_gpio_pin_configure(struct ar71xx_ pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { pin->gp_flags |= GPIO_PIN_OUTPUT; - GPIO_SET_BITS(sc, AR71XX_GPIO_OE, mask); - } - else { + ar71xx_gpio_oe_set_output(sc, pin->gp_pin); + } else { pin->gp_flags |= GPIO_PIN_INPUT; - GPIO_CLEAR_BITS(sc, AR71XX_GPIO_OE, mask); + ar71xx_gpio_oe_set_input(sc, pin->gp_pin); } } } @@ -455,6 +497,14 @@ ar71xx_gpio_attach(device_t dev) } /* Iniatilize the GPIO pins, keep the loader settings. */ oe = GPIO_READ(sc, AR71XX_GPIO_OE); + /* + * For AR934x and QCA953x, the meaning of oe is inverted; + * so flip it the right way around so we can parse the GPIO + * state. + */ + if (!ar71xx_gpio_oe_is_high()) + oe = ~oe; + sc->gpio_pins = malloc(sizeof(*sc->gpio_pins) * sc->gpio_npins, M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0, j = 0; j <= maxpin; j++) { @@ -515,16 +565,14 @@ ar71xx_gpio_attach(device_t dev) gpiofunc, gpiomode); - /* Set output (bit == 0) */ - oe = GPIO_READ(sc, AR71XX_GPIO_OE); - oe &= ~ (1 << i); - GPIO_WRITE(sc, AR71XX_GPIO_OE, oe); - /* Set pin value = 0, so it stays low by default */ oe = GPIO_READ(sc, AR71XX_GPIO_OUT); oe &= ~ (1 << i); GPIO_WRITE(sc, AR71XX_GPIO_OUT, oe); + /* Set output */ + ar71xx_gpio_oe_set_output(sc, i); + /* Finally: Set the output config */ ar71xx_gpio_ouput_configure(i, gpiofunc); } From owner-svn-src-head@freebsd.org Sun Jul 31 06:52:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E65BA9CEC; Sun, 31 Jul 2016 06:52:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21E89121A; Sun, 31 Jul 2016 06:52:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V6qJfa025814; Sun, 31 Jul 2016 06:52:19 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V6qJp2025813; Sun, 31 Jul 2016 06:52:19 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607310652.u6V6qJp2025813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 31 Jul 2016 06:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303578 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:52:20 -0000 Author: adrian Date: Sun Jul 31 06:52:19 2016 New Revision: 303578 URL: https://svnweb.freebsd.org/changeset/base/303578 Log: [wdr4300] invert the GPIO LED polarity. This makes them behave correctly. Submitted by: Dan Nelson Modified: head/sys/mips/conf/TL-WDR4300.hints Modified: head/sys/mips/conf/TL-WDR4300.hints ============================================================================== --- head/sys/mips/conf/TL-WDR4300.hints Sun Jul 31 06:51:34 2016 (r303577) +++ head/sys/mips/conf/TL-WDR4300.hints Sun Jul 31 06:52:19 2016 (r303578) @@ -206,21 +206,26 @@ hint.gpio.0.func.19.gpiomode=1 # output, hint.gpioled.0.at="gpiobus0" hint.gpioled.0.name="USB1" hint.gpioled.0.pins=0x0800 +hint.gpioled.0.invert=1 hint.gpioled.1.at="gpiobus0" hint.gpioled.1.name="USB2" hint.gpioled.1.pins=0x1000 +hint.gpioled.1.invert=1 hint.gpioled.2.at="gpiobus0" hint.gpioled.2.name="WLAN2G" hint.gpioled.2.pins=0x2000 +hint.gpioled.2.invert=1 hint.gpioled.3.at="gpiobus0" hint.gpioled.3.name="SYSTEM" hint.gpioled.3.pins=0x4000 +hint.gpioled.3.invert=1 hint.gpioled.4.at="gpiobus0" hint.gpioled.4.name="QSS" hint.gpioled.4.pins=0x8000 +hint.gpioled.4.invert=1 # XXX TODO: WPS/RFKILL switch From owner-svn-src-head@freebsd.org Sun Jul 31 06:53:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED0E2BA9E2B; Sun, 31 Jul 2016 06:53:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD43A13D4; Sun, 31 Jul 2016 06:53:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V6rocY025908; Sun, 31 Jul 2016 06:53:50 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V6rowT025907; Sun, 31 Jul 2016 06:53:50 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607310653.u6V6rowT025907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 31 Jul 2016 06:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303579 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 06:53:52 -0000 Author: adrian Date: Sun Jul 31 06:53:50 2016 New Revision: 303579 URL: https://svnweb.freebsd.org/changeset/base/303579 Log: [gpioled] update manpage. Submitted by: Dan Nelson Modified: head/share/man/man4/gpioled.4 Modified: head/share/man/man4/gpioled.4 ============================================================================== --- head/share/man/man4/gpioled.4 Sun Jul 31 06:52:19 2016 (r303578) +++ head/share/man/man4/gpioled.4 Sun Jul 31 06:53:50 2016 (r303579) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 2014 +.Dd July 30, 2016 .Dt GPIOLED 4 .Os .Sh NAME @@ -71,6 +71,8 @@ to create for Which pin on the GPIO interface to map to this instance. Please note that this mask should only ever have one bit set (any other bits - i.e., pins - will be ignored). +.It Va hint.gpioled.%d.invert +If set to 1, the pin will be set to 0 to light the LED, and 1 to clear it. .El .Pp On a From owner-svn-src-head@freebsd.org Sun Jul 31 08:05:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5F40BAACA2; Sun, 31 Jul 2016 08:05:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77B6011C3; Sun, 31 Jul 2016 08:05:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V85Fac052203; Sun, 31 Jul 2016 08:05:15 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V85FtQ052198; Sun, 31 Jul 2016 08:05:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201607310805.u6V85FtQ052198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sun, 31 Jul 2016 08:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303580 - in head: include lib/libc/gen usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 08:05:16 -0000 Author: ed Date: Sun Jul 31 08:05:15 2016 New Revision: 303580 URL: https://svnweb.freebsd.org/changeset/base/303580 Log: Fix up setgrent(3) to have a POSIX-compliant prototype. Just like with freelocale(3), I haven't been able to find any piece of code that actually makes use of this function's return value, both in base and in ports. The reason for this is that FreeBSD seems to be the only operating system to have such a prototype. This is why I'm deciding to not use symbol versioning for this. It does seem that the pw(8) utility depends on the function's typing and already had a switch in place to toggle between the FreeBSD and POSIX variant of this function. Clean this up by always expecting the POSIX variant. There is also a single port that has a couple of local declarations of setgrent(3) that need to be patched up. This is in the process of being fixed. PR: 211394 (exp-run) Modified: head/include/grp.h head/lib/libc/gen/getgrent.3 head/lib/libc/gen/getgrent.c head/usr.sbin/pw/pw_vpw.c head/usr.sbin/pw/pwupd.h Modified: head/include/grp.h ============================================================================== --- head/include/grp.h Sun Jul 31 06:53:50 2016 (r303579) +++ head/include/grp.h Sun Jul 31 08:05:15 2016 (r303580) @@ -75,8 +75,7 @@ int pwcache_groupdb(int (*)(int), void struct group * (*)(gid_t)); #endif #if __XSI_VISIBLE -/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ -int setgrent(void); +void setgrent(void); #endif #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE int getgrgid_r(gid_t, struct group *, char *, size_t, Modified: head/lib/libc/gen/getgrent.3 ============================================================================== --- head/lib/libc/gen/getgrent.3 Sun Jul 31 06:53:50 2016 (r303579) +++ head/lib/libc/gen/getgrent.3 Sun Jul 31 08:05:15 2016 (r303580) @@ -28,7 +28,7 @@ .\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 16, 2003 +.Dd July 31, 2016 .Dt GETGRENT 3 .Os .Sh NAME @@ -60,7 +60,7 @@ .Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" .Ft int .Fn setgroupent "int stayopen" -.Ft int +.Ft void .Fn setgrent void .Ft void .Fn endgrent void @@ -188,14 +188,13 @@ is set to .Dv NULL and the return value is 0, no matching entry exists.) .Pp -The functions +The function .Fn setgroupent -and -.Fn setgrent -return the value 1 if successful, otherwise the value +returns the value 1 if successful, otherwise the value 0 is returned. The functions -.Fn endgrent +.Fn endgrent , +.Fn setgrent and .Fn setgrfile have no return value. Modified: head/lib/libc/gen/getgrent.c ============================================================================== --- head/lib/libc/gen/getgrent.c Sun Jul 31 06:53:50 2016 (r303579) +++ head/lib/libc/gen/getgrent.c Sun Jul 31 08:05:15 2016 (r303580) @@ -533,12 +533,10 @@ out: return (rv); } -/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ -int +void setgrent(void) { (void)_nsdispatch(NULL, setgrent_dtab, NSDB_GROUP, "setgrent", defaultsrc, 0); - return (1); } Modified: head/usr.sbin/pw/pw_vpw.c ============================================================================== --- head/usr.sbin/pw/pw_vpw.c Sun Jul 31 06:53:50 2016 (r303579) +++ head/usr.sbin/pw/pw_vpw.c Sun Jul 31 08:05:15 2016 (r303580) @@ -130,13 +130,10 @@ vendgrent(void) } } -RET_SETGRENT +void vsetgrent(void) { vendgrent(); -#if defined(__FreeBSD__) - return 0; -#endif } static struct group * Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sun Jul 31 06:53:50 2016 (r303579) +++ head/usr.sbin/pw/pwupd.h Sun Jul 31 08:05:15 2016 (r303580) @@ -38,12 +38,6 @@ #include #include -#if defined(__FreeBSD__) -#define RET_SETGRENT int -#else -#define RET_SETGRENT void -#endif - struct pwf { int _altdir; void (*_setpwent)(void); @@ -51,7 +45,7 @@ struct pwf { struct passwd * (*_getpwent)(void); struct passwd * (*_getpwuid)(uid_t uid); struct passwd * (*_getpwnam)(const char * nam); - RET_SETGRENT (*_setgrent)(void); + void (*_setgrent)(void); void (*_endgrent)(void); struct group * (*_getgrent)(void); struct group * (*_getgrgid)(gid_t gid); @@ -141,7 +135,7 @@ struct passwd * vgetpwnam(const char * n struct group * vgetgrent(void); struct group * vgetgrgid(gid_t gid); struct group * vgetgrnam(const char * nam); -RET_SETGRENT vsetgrent(void); +void vsetgrent(void); void vendgrent(void); void copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid, From owner-svn-src-head@freebsd.org Sun Jul 31 10:15:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A7EBBA9B7C; Sun, 31 Jul 2016 10:15:06 +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 1684D1DA3; Sun, 31 Jul 2016 10:15:06 +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 u6VAF52u000667; Sun, 31 Jul 2016 10:15:05 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VAF5G2000665; Sun, 31 Jul 2016 10:15:05 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607311015.u6VAF5G2000665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 31 Jul 2016 10:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303581 - in head/usr.bin/calendar/calendars: ru_RU.KOI8-R ru_RU.UTF-8 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 10:15:06 -0000 Author: ache Date: Sun Jul 31 10:15:04 2016 New Revision: 303581 URL: https://svnweb.freebsd.org/changeset/base/303581 Log: Fix date Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Modified: head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 08:05:15 2016 (r303580) +++ head/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military Sun Jul 31 10:15:04 2016 (r303581) @@ -20,7 +20,7 @@ LANG=ru_RU.KOI8-R 8 . .. (1812 ) 11 . .. (1790 ) 21 . - (1380 ) - 7 . (1612 ) + 4 . (1612 ) 1 . .. (1853 ) 5 . - (1941 ) 24 . .. (1790 ) Modified: head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military ============================================================================== --- head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Sun Jul 31 08:05:15 2016 (r303580) +++ head/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military Sun Jul 31 10:15:04 2016 (r303581) @@ -20,7 +20,7 @@ LANG=ru_RU.UTF-8 8 сент. День Бородинского сражения русской армии под командованием М.И. Кутузова с французской армией (1812 год) 11 сент. День победы русской эскадры под командованием Ф.Ф. Ушакова над турецкой эскадрой у мыса Тендра (1790 год) 21 сент. День победы русских полков во главе с великим князем Дмитрием Донским над монголо-татарскими войсками в Куликовской битве (1380 год) - 7 нояб. День освобождения Москвы силами народного ополчения под руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов (1612 год) + 4 нояб. День освобождения Москвы силами народного ополчения под руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов (1612 год) 1 дек. День победы русской эскадры под командованием П.С. Нахимова над турецкой эскадрой у мыса Синоп (1853 год) 5 дек. День начала контрнаступления советских войск против немецко-фашистских войск в битве под Москвой (1941 год) 24 дек. День взятия турецкой крепости Измаил русскими войсками под командованием А.В. Суворова (1790 год) From owner-svn-src-head@freebsd.org Sun Jul 31 11:34:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9370BA153A; Sun, 31 Jul 2016 11:34:09 +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 8C0FE1AF0; Sun, 31 Jul 2016 11:34:09 +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 u6VBY8RW031060; Sun, 31 Jul 2016 11:34:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VBY81j031059; Sun, 31 Jul 2016 11:34:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201607311134.u6VBY81j031059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 31 Jul 2016 11:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303583 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 11:34:09 -0000 Author: mjg Date: Sun Jul 31 11:34:08 2016 New Revision: 303583 URL: https://svnweb.freebsd.org/changeset/base/303583 Log: amd64: implement pagezero using rep stos The current implementation uses non-temporal writes. This turns out to be detrimental to performance if the page is used shortly after, which is the typical case with page faults. Switch to rep stos. Reviewed by: kib MFC after: 1 week Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Sun Jul 31 10:37:09 2016 (r303582) +++ head/sys/amd64/amd64/support.S Sun Jul 31 11:34:08 2016 (r303583) @@ -64,17 +64,10 @@ END(bzero) /* Address: %rdi */ ENTRY(pagezero) PUSH_FRAME_POINTER - movq $-PAGE_SIZE,%rdx - subq %rdx,%rdi + movq $PAGE_SIZE/8,%rcx xorl %eax,%eax -1: - movnti %rax,(%rdi,%rdx) - movnti %rax,8(%rdi,%rdx) - movnti %rax,16(%rdi,%rdx) - movnti %rax,24(%rdi,%rdx) - addq $32,%rdx - jne 1b - sfence + rep + stosq POP_FRAME_POINTER ret END(pagezero) From owner-svn-src-head@freebsd.org Sun Jul 31 12:11:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D771FBA2685; Sun, 31 Jul 2016 12:11:56 +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 9128C1E4D; Sun, 31 Jul 2016 12:11:56 +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 u6VCBt2S043455; Sun, 31 Jul 2016 12:11:55 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VCBtR8043452; Sun, 31 Jul 2016 12:11:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201607311211.u6VCBtR8043452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 31 Jul 2016 12:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303584 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 12:11:56 -0000 Author: mjg Date: Sun Jul 31 12:11:55 2016 New Revision: 303584 URL: https://svnweb.freebsd.org/changeset/base/303584 Log: locks: change sleep_cnt and spin_cnt types to u_int Both variables are uint64_t, but they only count spins or sleeps. All reasonable values which we can get here comfortably hit in 32-bit range. Suggested by: kib MFC after: 1 week Modified: head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sun Jul 31 11:34:08 2016 (r303583) +++ head/sys/kern/kern_mutex.c Sun Jul 31 12:11:55 2016 (r303584) @@ -409,8 +409,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, uint64_t waittime = 0; #endif #ifdef KDTRACE_HOOKS - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Sun Jul 31 11:34:08 2016 (r303583) +++ head/sys/kern/kern_rwlock.c Sun Jul 31 12:11:55 2016 (r303584) @@ -357,8 +357,8 @@ __rw_rlock(volatile uintptr_t *c, const uintptr_t v; #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif @@ -742,8 +742,8 @@ __rw_wlock_hard(volatile uintptr_t *c, u #endif #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Sun Jul 31 11:34:08 2016 (r303583) +++ head/sys/kern/kern_sx.c Sun Jul 31 12:11:55 2016 (r303584) @@ -515,8 +515,8 @@ _sx_xlock_hard(struct sx *sx, uintptr_t int error = 0; #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif @@ -820,8 +820,8 @@ _sx_slock_hard(struct sx *sx, int opts, int error = 0; #ifdef KDTRACE_HOOKS uintptr_t state; - uint64_t spin_cnt = 0; - uint64_t sleep_cnt = 0; + u_int spin_cnt = 0; + u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; #endif From owner-svn-src-head@freebsd.org Sun Jul 31 12:59:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25043BA9558; Sun, 31 Jul 2016 12:59:12 +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 E87FB1E1B; Sun, 31 Jul 2016 12:59:11 +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 u6VCxBjg061959; Sun, 31 Jul 2016 12:59:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VCxBOK061958; Sun, 31 Jul 2016 12:59:11 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607311259.u6VCxBOK061958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 31 Jul 2016 12:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303585 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 12:59:12 -0000 Author: andrew Date: Sun Jul 31 12:59:10 2016 New Revision: 303585 URL: https://svnweb.freebsd.org/changeset/base/303585 Log: Relax the barriers around a TLB invalidation to only wait on inner-shareable memory accesses. There is no need for full system barriers. 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 Jul 31 12:11:55 2016 (r303584) +++ head/sys/arm64/arm64/pmap.c Sun Jul 31 12:59:10 2016 (r303585) @@ -865,9 +865,9 @@ pmap_invalidate_page(pmap_t pmap, vm_off sched_pin(); __asm __volatile( - "dsb sy \n" + "dsb ishst \n" "tlbi vaae1is, %0 \n" - "dsb sy \n" + "dsb ish \n" "isb \n" : : "r"(va >> PAGE_SHIFT)); sched_unpin(); @@ -879,13 +879,13 @@ pmap_invalidate_range(pmap_t pmap, vm_of vm_offset_t addr; sched_pin(); - __asm __volatile("dsb sy"); + dsb(ishst); for (addr = sva; addr < eva; addr += PAGE_SIZE) { __asm __volatile( "tlbi vaae1is, %0" : : "r"(addr >> PAGE_SHIFT)); } __asm __volatile( - "dsb sy \n" + "dsb ish \n" "isb \n"); sched_unpin(); } @@ -896,9 +896,9 @@ pmap_invalidate_all(pmap_t pmap) sched_pin(); __asm __volatile( - "dsb sy \n" + "dsb ishst \n" "tlbi vmalle1is \n" - "dsb sy \n" + "dsb ish \n" "isb \n"); sched_unpin(); } From owner-svn-src-head@freebsd.org Sun Jul 31 13:11:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F86EBA971A; Sun, 31 Jul 2016 13:11:35 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B511158B; Sun, 31 Jul 2016 13:11:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VDBYK8066639; Sun, 31 Jul 2016 13:11:34 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VDBYr8066638; Sun, 31 Jul 2016 13:11:34 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201607311311.u6VDBYr8066638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 31 Jul 2016 13:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303586 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 13:11:35 -0000 Author: jilles Date: Sun Jul 31 13:11:34 2016 New Revision: 303586 URL: https://svnweb.freebsd.org/changeset/base/303586 Log: sh: Fix a clang warning. Submitted by: bdrewery Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in if (--in.nleft < 0) { if (in.fd < 0) break; - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) + ; TRACE(("expbackq: read returns %d\n", i)); if (i <= 0) break; From owner-svn-src-head@freebsd.org Sun Jul 31 13:11:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83B9BBA9741; Sun, 31 Jul 2016 13:11:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 3DA4415B0; Sun, 31 Jul 2016 13:11:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 8E1401045948; Sun, 31 Jul 2016 23:11:25 +1000 (AEST) Date: Sun, 31 Jul 2016 23:11:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 In-Reply-To: <201607311134.u6VBY81j031059@repo.freebsd.org> Message-ID: <20160731220407.Q3033@besplex.bde.org> References: <201607311134.u6VBY81j031059@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=SEoYvGUSa3RuIkPbtVwA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 13:11:39 -0000 On Sun, 31 Jul 2016, Mateusz Guzik wrote: > Log: > amd64: implement pagezero using rep stos > > The current implementation uses non-temporal writes. This turns out to > be detrimental to performance if the page is used shortly after, which > is the typical case with page faults. > > Switch to rep stos. > > Reviewed by: kib > MFC after: 1 week This is very MD. Non-temporal writes are much faster on my old Turion2 amd64 system, especially when their pipelining is fixed. "rep stosb" is the best method on Haswell, but it is only slightly better so the default should remain nontemporal writes. I use sysctls to select the best function and don't have automatic speed detection. My old speed detection tests for selection of using the npx method turned out to be fragile. > Modified: head/sys/amd64/amd64/support.S > ============================================================================== > --- head/sys/amd64/amd64/support.S Sun Jul 31 10:37:09 2016 (r303582) > +++ head/sys/amd64/amd64/support.S Sun Jul 31 11:34:08 2016 (r303583) > @@ -64,17 +64,10 @@ END(bzero) > /* Address: %rdi */ > ENTRY(pagezero) > PUSH_FRAME_POINTER > - movq $-PAGE_SIZE,%rdx > - subq %rdx,%rdi > + movq $PAGE_SIZE/8,%rcx > xorl %eax,%eax > -1: > - movnti %rax,(%rdi,%rdx) > - movnti %rax,8(%rdi,%rdx) > - movnti %rax,16(%rdi,%rdx) > - movnti %rax,24(%rdi,%rdx) > - addq $32,%rdx > - jne 1b > - sfence > + rep > + stosq > POP_FRAME_POINTER > ret > END(pagezero) This shouldn't be a special function. Just use bzero(). The compiler might inline bzero() but shouldn't since this is very MD. On Haswell, "rep stos" takes about 25 cycles to start up, and the function call overhead is in the noise. 25 cycles is a lot. Haswell can move 32 bytes/cycle from L2 to L2, so it misses moving 800 bytes or 1/5 of a page in its startup overhead. Oops, that is for "rep movs". "rep stos" is similar. Here are my patches. X diff -c2 ./amd64/amd64/pmap.c~ ./amd64/amd64/pmap.c X *** ./amd64/amd64/pmap.c~ Sat Jun 25 09:07:20 2016 X --- ./amd64/amd64/pmap.c Sat Jun 25 09:07:09 2016 X *************** X *** 353,356 **** X --- 353,364 ---- X &pg_ps_enabled, 0, "Are large page mappings enabled?"); X X + static int pagecopy_memcpy; X + SYSCTL_INT(_vm_pmap, OID_AUTO, pagecopy_memcpy, CTLFLAG_RW, X + &pagecopy_memcpy, 0, "Use memcpy for pagecopy?"); X + X + static int pagezero_bzero; X + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_bzero, CTLFLAG_RW, X + &pagezero_bzero, 0, "Use bzero for pagezero?"); X + X #define PAT_INDEX_SIZE 8 X static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ I don't enable pagecopy_memcpy because the nontemporal method is best for Haswell. X *************** X *** 5154,5159 **** X X /* X ! * pmap_zero_page zeros the specified hardware page by mapping X ! * the page into KVM and using bzero to clear its contents. X */ X void X --- 5162,5166 ---- X X /* X ! * Zero the specified hardware page. X */ X void Style fix. The comment is banal. It gave too many implementation details about another implementation. Not one applies here. The comment should be removed, but I made it just banal to minimise diffs. X *************** X *** 5162,5173 **** X vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); X X ! pagezero((void *)va); X } X X /* X ! * pmap_zero_page_area zeros the specified hardware page by mapping X ! * the page into KVM and using bzero to clear its contents. X ! * X ! * off and size may not cover an area beyond a single hardware page. X */ X void X --- 5169,5181 ---- X vm_offset_t va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); X X ! if (pagezero_bzero) X ! bzero((void *)va, PAGE_SIZE); X ! else X ! pagezero((void *)va); X } X X /* X ! * Zero an an area within a single hardware page. off and size must not X ! * cover an area beyond a single hardware page. X */ X void X *************** X *** 5208,5212 **** X vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); X X ! pagecopy((void *)src, (void *)dst); X } X X --- 5216,5223 ---- X vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst)); X X ! if (pagecopy_memcpy) X ! memcpy((void *)dst, (void *)src, PAGE_SIZE); X ! else X ! pagecopy((void *)src, (void *)dst); X } X All the comments were wrong. X diff -c2 ./amd64/amd64/support.S~ ./amd64/amd64/support.S X *** ./amd64/amd64/support.S~ Wed Feb 24 22:35:30 2016 X --- ./amd64/amd64/support.S Mon Mar 28 10:43:37 2016 X *************** X *** 68,71 **** X --- 68,73 ---- X subq %rdx,%rdi X xorl %eax,%eax X + jmp 1f X + .p2align 5,0x90 X 1: X movnti %rax,(%rdi,%rdx) The loop was misaligned. See the i386 version for a comment in the code and more details. X diff -c2 ./i386/i386/pmap.c~ ./i386/i386/pmap.c X *** ./i386/i386/pmap.c~ Tue Apr 19 05:23:58 2016 X --- ./i386/i386/pmap.c Tue Apr 19 05:24:17 2016 X *************** X *** 226,229 **** X --- 226,233 ---- X &pg_ps_enabled, 0, "Are large page mappings enabled?"); X X + static int pagezero_bzero; X + SYSCTL_INT(_vm_pmap, OID_AUTO, pagezero_bzero, CTLFLAG_RW, X + &pagezero_bzero, 0, "Use bzero for pagezero?"); X + X #define PAT_INDEX_SIZE 8 X static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ I don't bother implementing pagecopy_memcpy on i386. It has to use "rep movsl", and that is not so good on older systems with not so good store buffers and no "fast string functions". On Haswell, "rep stos[bwl[q]] are equally fast, but no faster than the nontemporal method. In other trees, I implement pagecopy_sse for i386. This gives differences that are too small to measure (it uses movntps instead of movnti so that it works on SSE1 and gives 16-byte accesses). X *************** X *** 4178,4181 **** X --- 4182,4189 ---- X pagezero(void *page) X { X + if (pagezero_bzero) { X + bzero(page, PAGE_SIZE); X + return; X + } X #if defined(I686_CPU) X if (cpu_class == CPUCLASS_686) { X diff -c2 ./i386/i386/support.s~ ./i386/i386/support.s X *** ./i386/i386/support.s~ Sat Jan 23 05:14:15 2016 X --- ./i386/i386/support.s Mon Mar 28 10:39:57 2016 X *************** X *** 70,76 **** X addl $4096,%eax X xor %ebx,%ebx X 1: X movnti %ebx,(%ecx) X ! addl $4,%ecx X cmpl %ecx,%eax X jne 1b X --- 70,83 ---- X addl $4096,%eax X xor %ebx,%ebx X + jmp 1f X + /* X + * The loop takes 14 bytes. Ensure that it doesn't cross a 16-byte X + * cache line. X + */ X + .p2align 4,0x90 X 1: X movnti %ebx,(%ecx) X ! movnti %ebx,4(%ecx) X ! addl $8,%ecx X cmpl %ecx,%eax X jne 1b Misalignment of this loop made it almost twice as slow on old Turion2 with slow DDR2 memory. It made no difference on Haswell. I added an extra movnti, but that makes little or no differences. 2 more movnti's wouldn't fit in a 16-byte cache line so are slower unless even more care is taken with alignment (or with less care, 4 with misalignment are not less than twice as slow as 1 with alignment). I thought that alignment and unrolling didn't matter here, because movnti has to wait for memory and almost any loop runs fast enough to keep up. The timing on my old system is something like: CPUs at 2 GHz; main memory at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem only affects i386, at least with slow memory). So sustaining 4 GB/sec requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. Alignment makes it take about 2, and the extra movnti is for safety and to work with faster memory. On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about the main memory speed so nothing better is possible but just 1 extra movnti gives more with faster memory. This is just worse than bzero() except when bzero() goes to main memory it is about the same speed. bzero() is perhaps 20% faster on average for my makeworld benchmark. The difference is too small to really matter: makeworld of an old world takes 115-150 seconds (depending on tuning) on i4790K Haswell overclocked slightly. It pagezero()s about 128 GB and at main memory bandwidth that takes 8 seconds, but the average is slightly faster so the buildworld time is reduced by 1-2 seconds by using bzero() for pagezero(). On Turion2, pagezero() of 128 GB always takes about 32 seconds. In the misaligned version, it took 48 (?) seconds for 3 cycles/iteration instead of 2. The makeworld time is 804-892 seconds and 16 extra seconds is very noticeable. It hit a plateau at 823-840 seconds many years ago but came down to 804-816 mainly with the with alignment optimization and delicate/accidental scheduling. Bruce From owner-svn-src-head@freebsd.org Sun Jul 31 13:43:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4DF0BA9036; Sun, 31 Jul 2016 13:43:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id CB19A184D; Sun, 31 Jul 2016 13:43:16 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id C9A211E5C; Sun, 31 Jul 2016 13:43:16 +0000 (UTC) Date: Sun, 31 Jul 2016 13:43:16 +0000 From: Alexey Dokuchaev To: Jilles Tjoelker Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303586 - head/bin/sh Message-ID: <20160731134316.GB85936@FreeBSD.org> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607311311.u6VDBYr8066638@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 13:43:16 -0000 On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: > New Revision: 303586 > URL: https://svnweb.freebsd.org/changeset/base/303586 > > Log: > sh: Fix a clang warning. > > Submitted by: bdrewery > > Modified: > head/bin/sh/expand.c > > Modified: head/bin/sh/expand.c > ============================================================================== > --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) > +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in > if (--in.nleft < 0) { > if (in.fd < 0) > break; > - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); > + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) > + ; `continue;' would be even better; some tools might barf at stray semicolon. ./danfe From owner-svn-src-head@freebsd.org Sun Jul 31 13:51:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D2B8BA92C1; Sun, 31 Jul 2016 13:51:38 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 526371CE5; Sun, 31 Jul 2016 13:51:38 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bTr9N-000FUI-A0; Sun, 31 Jul 2016 16:51:29 +0300 Date: Sun, 31 Jul 2016 16:51:29 +0300 From: Slawa Olhovchenkov To: Bruce Evans Cc: Mateusz Guzik , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 Message-ID: <20160731135129.GA22212@zxy.spb.ru> References: <201607311134.u6VBY81j031059@repo.freebsd.org> <20160731220407.Q3033@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160731220407.Q3033@besplex.bde.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 13:51:38 -0000 On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > Misalignment of this loop made it almost twice as slow on old Turion2 with > slow DDR2 memory. It made no difference on Haswell. I added an extra > movnti, but that makes little or no differences. 2 more movnti's wouldn't > fit in a 16-byte cache line so are slower unless even more care is taken > with alignment (or with less care, 4 with misalignment are not less than > twice as slow as 1 with alignment). > > I thought that alignment and unrolling didn't matter here, because movnti > has to wait for memory and almost any loop runs fast enough to keep up. > The timing on my old system is something like: CPUs at 2 GHz; main memory > at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem > only affects i386, at least with slow memory). So sustaining 4 GB/sec > requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration > to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. > Alignment makes it take about 2, and the extra movnti is for safety and > to work with faster memory. > > On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on > i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about > the main memory speed so nothing better is possible but just 1 extra > movnti gives more with faster memory. This is just worse than bzero() What about modern system with 120 GB/sec main memory speed? From owner-svn-src-head@freebsd.org Sun Jul 31 14:30:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D32BBA9B2E; Sun, 31 Jul 2016 14:30:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id F1ED316BB; Sun, 31 Jul 2016 14:30:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id E9405423882; Mon, 1 Aug 2016 00:30:14 +1000 (AEST) Date: Mon, 1 Aug 2016 00:30:14 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Slawa Olhovchenkov cc: Bruce Evans , Mateusz Guzik , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 In-Reply-To: <20160731135129.GA22212@zxy.spb.ru> Message-ID: <20160801000046.X3364@besplex.bde.org> References: <201607311134.u6VBY81j031059@repo.freebsd.org> <20160731220407.Q3033@besplex.bde.org> <20160731135129.GA22212@zxy.spb.ru> 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=NXl1eo41jXg0PfEGVNIA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 14:30:21 -0000 On Sun, 31 Jul 2016, Slawa Olhovchenkov wrote: > On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > >> Misalignment of this loop made it almost twice as slow on old Turion2 with >> slow DDR2 memory. It made no difference on Haswell. I added an extra >> movnti, but that makes little or no differences. 2 more movnti's wouldn't >> fit in a 16-byte cache line so are slower unless even more care is taken >> with alignment (or with less care, 4 with misalignment are not less than >> twice as slow as 1 with alignment). >> >> I thought that alignment and unrolling didn't matter here, because movnti >> has to wait for memory and almost any loop runs fast enough to keep up. >> The timing on my old system is something like: CPUs at 2 GHz; main memory >> at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem >> only affects i386, at least with slow memory). So sustaining 4 GB/sec >> requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration >> to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. >> Alignment makes it take about 2, and the extra movnti is for safety and >> to work with faster memory. >> >> On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on >> i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about >> the main memory speed so nothing better is possible but just 1 extra >> movnti gives more with faster memory. This is just worse than bzero() > > What about modern system with 120 GB/sec main memory speed? Is there such a system? It would have main memory almost twice as fast as Haswell L2 and almost half as fast as Haswell L1. My fastest memory actually does 20001 MB/s according to old memtest and that is about right according to other tests. Bruce From owner-svn-src-head@freebsd.org Sun Jul 31 14:59:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79698BA9407; Sun, 31 Jul 2016 14:59:45 +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 49BAE16C1; Sun, 31 Jul 2016 14:59:45 +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 u6VExiR9008482; Sun, 31 Jul 2016 14:59:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VExi4k008481; Sun, 31 Jul 2016 14:59:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607311459.u6VExi4k008481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 31 Jul 2016 14:59:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303587 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 14:59:45 -0000 Author: andrew Date: Sun Jul 31 14:59:44 2016 New Revision: 303587 URL: https://svnweb.freebsd.org/changeset/base/303587 Log: Fix the comment above pmap_invalidate_page. tlbi will invalidate the tlb on all CPUs. 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 Jul 31 13:11:34 2016 (r303586) +++ head/sys/arm64/arm64/pmap.c Sun Jul 31 14:59:44 2016 (r303587) @@ -856,8 +856,7 @@ pmap_init(void) } /* - * Normal, non-SMP, invalidation functions. - * We inline these within pmap.c for speed. + * Invalidate a single TLB entry. */ PMAP_INLINE void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) From owner-svn-src-head@freebsd.org Sun Jul 31 15:02:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67136BA955C; Sun, 31 Jul 2016 15:02:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4273F1ACA; Sun, 31 Jul 2016 15:02:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VF2r0L011878; Sun, 31 Jul 2016 15:02:53 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VF2rol011877; Sun, 31 Jul 2016 15:02:53 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607311502.u6VF2rol011877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 15:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303588 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 15:02:54 -0000 Author: pfg Date: Sun Jul 31 15:02:53 2016 New Revision: 303588 URL: https://svnweb.freebsd.org/changeset/base/303588 Log: indent(1): Remove dead code relating to unix-style comments. The original indent(1) described unix-style comments as similar to box comments, except the first non-blank character on each line is lined up with the '*' of the "/*" which appears on a line by itself. The code has been turned off for ages and -sc/-nsc make it even less relevant. Reference: https://github.com/pstef/freebsd_indent/commit/89c5fe2c56742d96975bb3ea6b99f28baf9d82f6 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Jul 31 14:59:44 2016 (r303587) +++ head/usr.bin/indent/pr_comment.c Sun Jul 31 15:02:53 2016 (r303588) @@ -87,10 +87,6 @@ pr_comment(void) char *last_bl; /* points to the last blank in the output * buffer */ char *t_ptr; /* used for moving string */ - int unix_comment; /* tri-state variable used to decide if it is - * a unix-style comment. 0 means only blanks - * since /+*, 1 means regular style comment, 2 - * means unix style comment */ int break_delim = comment_delimiter_on_blankline; int l_just_saw_decl = ps.just_saw_decl; /* @@ -105,9 +101,6 @@ pr_comment(void) * a boxed comment or some other * comment that should not be touched */ ++ps.out_coms; /* keep track of number of comments */ - unix_comment = 1; /* set flag to let us figure out if there is a - * unix-style comment ** DISABLED: use 0 to - * reenable this hack! */ /* Figure where to align and how to treat the comment */ @@ -247,34 +240,6 @@ pr_comment(void) } else { ps.last_nl = 1; - if (unix_comment != 1) { /* we not are in unix_style - * comment */ - if (unix_comment == 0 && s_code == e_code) { - /* - * if it is a UNIX-style comment, ignore the - * requirement that previous line be blank for - * unindention - */ - ps.com_col = (ps.ind_level - ps.unindent_displace) * ps.ind_size + 1; - if (ps.com_col <= 1) - ps.com_col = 2; - } - unix_comment = 2; /* permanently remember that we are in - * this type of comment */ - dump_line(); - ++line_no; - now_col = ps.com_col; - *e_com++ = ' '; - /* - * fix so that the star at the start of the line will line - * up - */ - do /* flush leading white space */ - if (++buf_ptr >= buf_end) - fill_buffer(); - while (*buf_ptr == ' ' || *buf_ptr == '\t'); - break; - } if (*(e_com - 1) == ' ' || *(e_com - 1) == '\t') last_bl = e_com - 1; /* @@ -312,10 +277,6 @@ pr_comment(void) if (++buf_ptr >= buf_end) /* get to next char after * */ fill_buffer(); - if (unix_comment == 0) /* set flag to show we are not in - * unix-style comment */ - unix_comment = 1; - if (*buf_ptr == '/') { /* it is the end!!! */ end_of_comment: if (++buf_ptr >= buf_end) @@ -357,9 +318,6 @@ pr_comment(void) } break; default: /* we have a random char */ - if (unix_comment == 0 && *buf_ptr != ' ' && *buf_ptr != '\t') - unix_comment = 1; /* we are not in unix-style comment */ - *e_com = *buf_ptr++; if (buf_ptr >= buf_end) fill_buffer(); @@ -376,7 +334,7 @@ pr_comment(void) /* remember we saw a blank */ ++e_com; - if (now_col > adj_max_col && !ps.box_com && unix_comment == 1 && e_com[-1] > ' ') { + if (now_col > adj_max_col && !ps.box_com && e_com[-1] > ' ') { /* * the comment is too long, it must be broken up */ From owner-svn-src-head@freebsd.org Sun Jul 31 15:26:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62F4ABA9BB7; Sun, 31 Jul 2016 15:26:33 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 236CC1CA4; Sun, 31 Jul 2016 15:26:33 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bTsdJ-000Hr5-Lw; Sun, 31 Jul 2016 18:26:29 +0300 Date: Sun, 31 Jul 2016 18:26:29 +0300 From: Slawa Olhovchenkov To: Bruce Evans Cc: Mateusz Guzik , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 Message-ID: <20160731152629.GA8192@zxy.spb.ru> References: <201607311134.u6VBY81j031059@repo.freebsd.org> <20160731220407.Q3033@besplex.bde.org> <20160731135129.GA22212@zxy.spb.ru> <20160801000046.X3364@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160801000046.X3364@besplex.bde.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 15:26:33 -0000 On Mon, Aug 01, 2016 at 12:30:14AM +1000, Bruce Evans wrote: > On Sun, 31 Jul 2016, Slawa Olhovchenkov wrote: > > > On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > > > >> Misalignment of this loop made it almost twice as slow on old Turion2 with > >> slow DDR2 memory. It made no difference on Haswell. I added an extra > >> movnti, but that makes little or no differences. 2 more movnti's wouldn't > >> fit in a 16-byte cache line so are slower unless even more care is taken > >> with alignment (or with less care, 4 with misalignment are not less than > >> twice as slow as 1 with alignment). > >> > >> I thought that alignment and unrolling didn't matter here, because movnti > >> has to wait for memory and almost any loop runs fast enough to keep up. > >> The timing on my old system is something like: CPUs at 2 GHz; main memory > >> at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem > >> only affects i386, at least with slow memory). So sustaining 4 GB/sec > >> requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration > >> to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. > >> Alignment makes it take about 2, and the extra movnti is for safety and > >> to work with faster memory. > >> > >> On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on > >> i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about > >> the main memory speed so nothing better is possible but just 1 extra > >> movnti gives more with faster memory. This is just worse than bzero() > > > > What about modern system with 120 GB/sec main memory speed? > > Is there such a system? It would have main memory almost twice as fast > as Haswell L2 and almost half as fast as Haswell L1. http://ark.intel.com/products/family/93797/Intel-Xeon-Processor-E7-v4-Family#@Server 102 GB/s (sorry, 120 is misprint) > My fastest memory actually does 20001 MB/s according to old memtest > and that is about right according to other tests. Some short time I am have free 1650v4 http://ark.intel.com/products/92994/Intel-Xeon-Processor-E5-1650-v4-15M-Cache-3_60-GHz with up to 76.8 GB/s (by datasheet, at DDR4-2400). With installed DDR4-2133 -- up to 68.2 GB/s (teoretical) After short time system put into production. I am unable to boot UEFI Memtest86 7.0, old version (4.3.7) show 15 GB/s. # ramspeed -b 18 -p 4 RAMspeed/SMP (FreeBSD) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09 8Gb per pass mode, 4 processes SSE (nt) Copy: 54176.91 MB/s [NTA prefetch] SSE (nt) Scale: 54241.98 MB/s [NTA prefetch] SSE (nt) Add: 48945.60 MB/s [T0 prefetch] SSE (nt) Triad: 50102.80 MB/s [T0 prefetch] --- SSE (nt) AVERAGE: 51866.82 MB/s # ramspeed -b 16 -p 4 RAMspeed/SMP (FreeBSD) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09 8Gb per pass mode, 4 processes SSE & WRITING (nt) 1 Kb block: 55913.18 MB/s SSE & WRITING (nt) 2 Kb block: 60819.02 MB/s SSE & WRITING (nt) 4 Kb block: 58662.37 MB/s SSE & WRITING (nt) 8 Kb block: 57165.14 MB/s SSE & WRITING (nt) 16 Kb block: 56310.22 MB/s SSE & WRITING (nt) 32 Kb block: 56407.22 MB/s SSE & WRITING (nt) 64 Kb block: 58200.44 MB/s SSE & WRITING (nt) 128 Kb block: 59213.49 MB/s SSE & WRITING (nt) 256 Kb block: 59047.57 MB/s SSE & WRITING (nt) 512 Kb block: 59158.01 MB/s SSE & WRITING (nt) 1024 Kb block: 59140.03 MB/s SSE & WRITING (nt) 2048 Kb block: 59165.49 MB/s SSE & WRITING (nt) 4096 Kb block: 59714.68 MB/s SSE & WRITING (nt) 8192 Kb block: 59926.68 MB/s SSE & WRITING (nt) 16384 Kb block: 59100.03 MB/s SSE & WRITING (nt) 32768 Kb block: 58268.52 MB/s # ramspeed -b 16 -p 2 RAMspeed/SMP (FreeBSD) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09 8Gb per pass mode, 2 processes SSE & WRITING (nt) 1 Kb block: 32131.03 MB/s SSE & WRITING (nt) 2 Kb block: 41851.23 MB/s SSE & WRITING (nt) 4 Kb block: 41848.02 MB/s SSE & WRITING (nt) 8 Kb block: 41640.80 MB/s SSE & WRITING (nt) 16 Kb block: 41640.60 MB/s SSE & WRITING (nt) 32 Kb block: 41639.89 MB/s SSE & WRITING (nt) 64 Kb block: 41849.65 MB/s SSE & WRITING (nt) 128 Kb block: 41848.74 MB/s SSE & WRITING (nt) 256 Kb block: 41847.87 MB/s SSE & WRITING (nt) 512 Kb block: 41846.14 MB/s SSE & WRITING (nt) 1024 Kb block: 41835.69 MB/s SSE & WRITING (nt) 2048 Kb block: 41815.94 MB/s SSE & WRITING (nt) 4096 Kb block: 41717.39 MB/s SSE & WRITING (nt) 8192 Kb block: 41575.85 MB/s SSE & WRITING (nt) 16384 Kb block: 41295.03 MB/s SSE & WRITING (nt) 32768 Kb block: 40735.83 MB/s From owner-svn-src-head@freebsd.org Sun Jul 31 15:48:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7FD4BAA1D2; Sun, 31 Jul 2016 15:48:26 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4FBB174B; Sun, 31 Jul 2016 15:48:26 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bTsyW-000IPO-Dp; Sun, 31 Jul 2016 18:48:24 +0300 Date: Sun, 31 Jul 2016 18:48:24 +0300 From: Slawa Olhovchenkov To: Bruce Evans Cc: Mateusz Guzik , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 Message-ID: <20160731154824.GB8192@zxy.spb.ru> References: <201607311134.u6VBY81j031059@repo.freebsd.org> <20160731220407.Q3033@besplex.bde.org> <20160731135129.GA22212@zxy.spb.ru> <20160801000046.X3364@besplex.bde.org> <20160731152629.GA8192@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160731152629.GA8192@zxy.spb.ru> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 15:48:27 -0000 On Sun, Jul 31, 2016 at 06:26:29PM +0300, Slawa Olhovchenkov wrote: > On Mon, Aug 01, 2016 at 12:30:14AM +1000, Bruce Evans wrote: > > > On Sun, 31 Jul 2016, Slawa Olhovchenkov wrote: > > > > > On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > > > > > >> Misalignment of this loop made it almost twice as slow on old Turion2 with > > >> slow DDR2 memory. It made no difference on Haswell. I added an extra > > >> movnti, but that makes little or no differences. 2 more movnti's wouldn't > > >> fit in a 16-byte cache line so are slower unless even more care is taken > > >> with alignment (or with less care, 4 with misalignment are not less than > > >> twice as slow as 1 with alignment). > > >> > > >> I thought that alignment and unrolling didn't matter here, because movnti > > >> has to wait for memory and almost any loop runs fast enough to keep up. > > >> The timing on my old system is something like: CPUs at 2 GHz; main memory > > >> at 4 GB/sec; movnti is only 4 bytes wide on i386 (so this problem > > >> only affects i386, at least with slow memory). So sustaining 4 GB/sec > > >> requires 1 G movnti's/sec, so the loop needs to run at 2 cycles/iteration > > >> to keep up. But when it is misaligned, it runs at 3-4 cycles/iteration. > > >> Alignment makes it take about 2, and the extra movnti is for safety and > > >> to work with faster memory. > > >> > > >> On Haswell with CPUs at 4 GHz, 2 cycles/iteration gives 8 GB/sec on > > >> i386 and 16 GB/sec on amd64 with wider movnti. IIRC, 16 GB/sec is about > > >> the main memory speed so nothing better is possible but just 1 extra > > >> movnti gives more with faster memory. This is just worse than bzero() > > > > > > What about modern system with 120 GB/sec main memory speed? > > > > Is there such a system? It would have main memory almost twice as fast > > as Haswell L2 and almost half as fast as Haswell L1. > > http://ark.intel.com/products/family/93797/Intel-Xeon-Processor-E7-v4-Family#@Server > > 102 GB/s (sorry, 120 is misprint) > > > My fastest memory actually does 20001 MB/s according to old memtest > > and that is about right according to other tests. > > Some short time I am have free 1650v4 > http://ark.intel.com/products/92994/Intel-Xeon-Processor-E5-1650-v4-15M-Cache-3_60-GHz > with up to 76.8 GB/s (by datasheet, at DDR4-2400). > With installed DDR4-2133 -- up to 68.2 GB/s (teoretical) > After short time system put into production. > > I am unable to boot UEFI Memtest86 7.0, old version (4.3.7) show 15 GB/s. Here http://wccftech.com/intel-broadwell-ep-xeon-e5-2698-v4-processor/ some benchmark show 110 GB/s write speed. From owner-svn-src-head@freebsd.org Sun Jul 31 16:35:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89378BAAB96; Sun, 31 Jul 2016 16:35:33 +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 2259F1C8C; Sun, 31 Jul 2016 16:35:32 +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 u6VGZR3W086517 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 31 Jul 2016 19:35:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u6VGZR3W086517 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u6VGZRsB086516; Sun, 31 Jul 2016 19:35:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 31 Jul 2016 19:35:27 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 Message-ID: <20160731163527.GZ83214@kib.kiev.ua> References: <201607311134.u6VBY81j031059@repo.freebsd.org> <20160731220407.Q3033@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160731220407.Q3033@besplex.bde.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 16:35:33 -0000 On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: > On Haswell, "rep stos" takes about 25 cycles to start up, and the function > call overhead is in the noise. 25 cycles is a lot. Haswell can move > 32 bytes/cycle from L2 to L2, so it misses moving 800 bytes or 1/5 of a > page in its startup overhead. Oops, that is for "rep movs". "rep stos" > is similar. > The commit message contained a probable explanation of the reason why the change demonstrated measurable improvement in non-microbenchmark load. That said, the only thing I am answering and asking there is the above claim about 25 cycles overhead of rep;stosq on hsw. I am curious how the overhead was measured. Note: Agner Fog' tables state that fast mode takes <2n uops and has reciprocal throughput of 0.5n worst case and do not demostrate any setup overhead for hsw. From owner-svn-src-head@freebsd.org Sun Jul 31 17:53:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD4B2BA9FAD; Sun, 31 Jul 2016 17:53:10 +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 6B2C611FA; Sun, 31 Jul 2016 17:53:10 +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 u6VHr9HX074870; Sun, 31 Jul 2016 17:53:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VHr9g8074869; Sun, 31 Jul 2016 17:53:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607311753.u6VHr9g8074869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 31 Jul 2016 17:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303592 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 17:53:10 -0000 Author: andrew Date: Sun Jul 31 17:53:09 2016 New Revision: 303592 URL: https://svnweb.freebsd.org/changeset/base/303592 Log: Extract the common parts of pmap_kenter_device to a new function. This will be used when superpage support is added. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jul 31 15:15:27 2016 (r303591) +++ head/sys/arm64/arm64/pmap.c Sun Jul 31 17:53:09 2016 (r303592) @@ -1037,8 +1037,8 @@ pmap_kextract(vm_offset_t va) * Low level mapping routines..... ***************************************************/ -void -pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) +static void +pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode) { pd_entry_t *pde; pt_entry_t *pte; @@ -1046,23 +1046,22 @@ pmap_kenter_device(vm_offset_t sva, vm_s int lvl; KASSERT((pa & L3_OFFSET) == 0, - ("pmap_kenter_device: Invalid physical address")); + ("pmap_kenter: Invalid physical address")); KASSERT((sva & L3_OFFSET) == 0, - ("pmap_kenter_device: Invalid virtual address")); + ("pmap_kenter: Invalid virtual address")); KASSERT((size & PAGE_MASK) == 0, - ("pmap_kenter_device: Mapping is not page-sized")); + ("pmap_kenter: Mapping is not page-sized")); va = sva; while (size != 0) { pde = pmap_pde(kernel_pmap, va, &lvl); KASSERT(pde != NULL, - ("pmap_kenter_device: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 2, - ("pmap_kenter_device: Invalid level %d", lvl)); + ("pmap_kenter: Invalid page entry, va: 0x%lx", va)); + KASSERT(lvl == 2, ("pmap_kenter: Invalid level %d", lvl)); pte = pmap_l2_to_l3(pde, va); pmap_load_store(pte, (pa & ~L3_OFFSET) | ATTR_DEFAULT | - ATTR_IDX(DEVICE_MEMORY) | L3_PAGE); + ATTR_IDX(mode) | L3_PAGE); PTE_SYNC(pte); va += PAGE_SIZE; @@ -1072,6 +1071,13 @@ pmap_kenter_device(vm_offset_t sva, vm_s pmap_invalidate_range(kernel_pmap, sva, va); } +void +pmap_kenter_device(vm_offset_t sva, vm_size_t size, vm_paddr_t pa) +{ + + pmap_kenter(sva, size, pa, DEVICE_MEMORY); +} + /* * Remove a page from the kernel pagetables. */ From owner-svn-src-head@freebsd.org Sun Jul 31 18:14:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87EF0BAA713; Sun, 31 Jul 2016 18:14:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 583971F51; Sun, 31 Jul 2016 18:14:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VIEg1R082517; Sun, 31 Jul 2016 18:14:42 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VIEgeY082516; Sun, 31 Jul 2016 18:14:42 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607311814.u6VIEgeY082516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 18:14:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303593 - head/sbin/resolvconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 18:14:43 -0000 Author: pfg Date: Sun Jul 31 18:14:42 2016 New Revision: 303593 URL: https://svnweb.freebsd.org/changeset/base/303593 Log: resolvconf(8) now needs an additional @RESTARTCMD@ replacement when installing. After r303062, which brought openresolv 3.8.1, we need to replace an additional @RESTARTCMD@ in resolvconf. Apply a read fix this time. Submitted by: Guy Yur X-MFC with: r303062 Modified: head/sbin/resolvconf/Makefile Modified: head/sbin/resolvconf/Makefile ============================================================================== --- head/sbin/resolvconf/Makefile Sun Jul 31 17:53:09 2016 (r303592) +++ head/sbin/resolvconf/Makefile Sun Jul 31 18:14:42 2016 (r303593) @@ -19,9 +19,12 @@ VARDIR= /var/run/resolvconf # We don't assume to restart the services in /sbin. So, though # our service(8) is in /usr/sbin, we can use it, here. -CMD1= \1 onestatus >/dev/null 2>\&1 -CMD2= \1 restart -RESTARTCMD= /usr/sbin/service ${CMD1} \&\& /usr/sbin/service ${CMD2} +CMD1_WITH_ARG= \1 onestatus >/dev/null 2>\&1 +CMD2_WITH_ARG= \1 restart +RESTARTCMD_WITH_ARG= /usr/sbin/service ${CMD1_WITH_ARG} \&\& /usr/sbin/service ${CMD2_WITH_ARG} +CMD1= \\$$1 onestatus >/dev/null 2>\&1 +CMD2= \\$$1 restart +RESTARTCMD= "/usr/sbin/service ${CMD1} \&\& /usr/sbin/service ${CMD2}" .for f in ${SCRIPTS} ${FILES} ${MAN} ${f}: ${f}.in @@ -29,8 +32,8 @@ ${f}: ${f}.in -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' \ -e 's:@LIBEXECDIR@:${FILESDIR}:g' \ -e 's:@VARDIR@:${VARDIR}:g' \ - -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g' \ - -e 's:@RESTARTCMD@:${RESTARTCMD_}:g' \ + -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD_WITH_ARG}:g' \ + -e 's:@RESTARTCMD@:${RESTARTCMD}:g' \ -e 's:@RCDIR@:${RCDIR}:g' \ -e 's: vpn : ng[0-9]*&:g' \ ${DIST}/$@.in > $@ From owner-svn-src-head@freebsd.org Sun Jul 31 18:58:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17F91BAA9C5; Sun, 31 Jul 2016 18:58:22 +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 C358A16A7; Sun, 31 Jul 2016 18:58:21 +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 u6VIwK7D098483; Sun, 31 Jul 2016 18:58:20 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VIwKkP098482; Sun, 31 Jul 2016 18:58:20 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607311858.u6VIwKkP098482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 31 Jul 2016 18:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303594 - head/sys/arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 18:58:22 -0000 Author: andrew Date: Sun Jul 31 18:58:20 2016 New Revision: 303594 URL: https://svnweb.freebsd.org/changeset/base/303594 Log: Add the Data Fault Status Code values to the ESR_ELx registers for when the fault code is a Data Abort. Obtained from: AT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Sun Jul 31 18:14:42 2016 (r303593) +++ head/sys/arm64/include/armreg.h Sun Jul 31 18:58:20 2016 (r303594) @@ -90,6 +90,32 @@ #define ISS_INSN_S1PTW (0x01 << 7) #define ISS_DATa_WnR (0x01 << 6) #define ISS_DATA_DFSC_MASK (0x1f << 0) +#define ISS_DATA_DFSC_ASF_L0 (0x00 << 0) +#define ISS_DATA_DFSC_ASF_L1 (0x01 << 0) +#define ISS_DATA_DFSC_ASF_L2 (0x02 << 0) +#define ISS_DATA_DFSC_ASF_L3 (0x03 << 0) +#define ISS_DATA_DFSC_TF_L0 (0x04 << 0) +#define ISS_DATA_DFSC_TF_L1 (0x05 << 0) +#define ISS_DATA_DFSC_TF_L2 (0x06 << 0) +#define ISS_DATA_DFSC_TF_L3 (0x07 << 0) +#define ISS_DATA_DFSC_AFF_L1 (0x09 << 0) +#define ISS_DATA_DFSC_AFF_L2 (0x0a << 0) +#define ISS_DATA_DFSC_AFF_L3 (0x0b << 0) +#define ISS_DATA_DFSC_PF_L1 (0x0d << 0) +#define ISS_DATA_DFSC_PF_L2 (0x0e << 0) +#define ISS_DATA_DFSC_PF_L3 (0x0f << 0) +#define ISS_DATA_DFSC_EXT (0x10 << 0) +#define ISS_DATA_DFSC_EXT_L0 (0x14 << 0) +#define ISS_DATA_DFSC_EXT_L1 (0x15 << 0) +#define ISS_DATA_DFSC_EXT_L2 (0x16 << 0) +#define ISS_DATA_DFSC_EXT_L3 (0x17 << 0) +#define ISS_DATA_DFSC_ECC (0x18 << 0) +#define ISS_DATA_DFSC_ECC_L0 (0x1c << 0) +#define ISS_DATA_DFSC_ECC_L1 (0x1d << 0) +#define ISS_DATA_DFSC_ECC_L2 (0x1e << 0) +#define ISS_DATA_DFSC_ECC_L3 (0x1f << 0) +#define ISS_DATA_DFSC_ALIGN (0x21 << 0) +#define ISS_DATA_DFSC_TLB_CONFLICT (0x28 << 0) #define ESR_ELx_IL (0x01 << 25) #define ESR_ELx_EC_SHIFT 26 #define ESR_ELx_EC_MASK (0x3f << 26) From owner-svn-src-head@freebsd.org Sun Jul 31 19:02:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 377D5BAAB8F; Sun, 31 Jul 2016 19:02:20 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A8C91BB8; Sun, 31 Jul 2016 19:02:19 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VJ2J2n002142; Sun, 31 Jul 2016 19:02:19 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VJ2J1j002141; Sun, 31 Jul 2016 19:02:19 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607311902.u6VJ2J1j002141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 31 Jul 2016 19:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303595 - head/usr.bin/nl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 19:02:20 -0000 Author: bapt Date: Sun Jul 31 19:02:19 2016 New Revision: 303595 URL: https://svnweb.freebsd.org/changeset/base/303595 Log: Remove another occurence of _WITH_GETLINE Modified: head/usr.bin/nl/nl.c Modified: head/usr.bin/nl/nl.c ============================================================================== --- head/usr.bin/nl/nl.c Sun Jul 31 18:58:20 2016 (r303594) +++ head/usr.bin/nl/nl.c Sun Jul 31 19:02:19 2016 (r303595) @@ -35,7 +35,6 @@ __COPYRIGHT( __RCSID("$FreeBSD$"); #endif -#define _WITH_GETLINE #include #include From owner-svn-src-head@freebsd.org Sun Jul 31 20:04:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4678BA9AB8; Sun, 31 Jul 2016 20:04:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AEC811B9F; Sun, 31 Jul 2016 20:04:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VK4INr024664; Sun, 31 Jul 2016 20:04:18 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VK4I8W024660; Sun, 31 Jul 2016 20:04:18 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607312004.u6VK4I8W024660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 20:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303596 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 20:04:19 -0000 Author: pfg Date: Sun Jul 31 20:04:18 2016 New Revision: 303596 URL: https://svnweb.freebsd.org/changeset/base/303596 Log: indent(1): Simplify pr_comment(). Modify count_spaces() to take a third parameter "end" that will make the function return when the end is reached. This lets the caller pass a pointer to non nul-terminated sequence of characters. Rename count_spaces() to count_spaces_until() and reinstate count_spaces(), this time based on count_spaces_until(). Use count_spaces_until() to recalculate current column when going through a comment just before the fragment which decides if current line of the comment should be wrapped. This move simplifies this code by eliminating the need for keeping the column counter up to date every time e_com is advanced and also reduces spread of code that has to know how many columns a tab will produce. Deduplicate code that decided if a comment needs a blank line at the top. References: https://github.com/pstef/freebsd_indent/commit/d9fa3b481532a448095f8ddd14fd0797ce59230c https://github.com/pstef/freebsd_indent/commit/27185b4b336b0e2108a3d96aee6df80cced94192 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.h head/usr.bin/indent/io.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/indent.h ============================================================================== --- head/usr.bin/indent/indent.h Sun Jul 31 19:02:19 2016 (r303595) +++ head/usr.bin/indent/indent.h Sun Jul 31 20:04:18 2016 (r303596) @@ -32,6 +32,7 @@ void addkey(char *, int); int compute_code_target(void); int compute_label_target(void); int count_spaces(int, char *); +int count_spaces_until(int, char *, char *); int lexi(void); void diag2(int, const char *); void diag3(int, const char *, int); Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Sun Jul 31 19:02:19 2016 (r303595) +++ head/usr.bin/indent/io.c Sun Jul 31 20:04:18 2016 (r303596) @@ -506,18 +506,15 @@ pad_output(int current, int target) * */ int -count_spaces(int current, char *buffer) +count_spaces_until(int cur, char *buffer, char *end) /* * this routine figures out where the character position will be after * printing the text in buffer starting at column "current" */ { char *buf; /* used to look thru buffer */ - int cur; /* current character counter */ - cur = current; - - for (buf = buffer; *buf != '\0'; ++buf) { + for (buf = buffer; *buf != '\0' && buf != end; ++buf) { switch (*buf) { case '\n': @@ -541,6 +538,12 @@ count_spaces(int current, char *buffer) return (cur); } +int +count_spaces(int cur, char *buffer) +{ + return (count_spaces_until(cur, buffer, NULL)); +} + void diag4(int level, const char *msg, int a, int b) { Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Jul 31 19:02:19 2016 (r303595) +++ head/usr.bin/indent/pr_comment.c Sun Jul 31 20:04:18 2016 (r303596) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "indent_globs.h" #include "indent.h" /* @@ -89,11 +90,6 @@ pr_comment(void) char *t_ptr; /* used for moving string */ int break_delim = comment_delimiter_on_blankline; int l_just_saw_decl = ps.just_saw_decl; - /* - * int ps.last_nl = 0; true iff the last significant thing - * weve seen is a newline - */ - int one_liner = 1; /* true iff this comment is a one-liner */ adj_max_col = max_col; ps.just_saw_decl = 0; last_bl = NULL; /* no blanks found so far */ @@ -107,6 +103,7 @@ pr_comment(void) if (ps.col_1 && !format_col1_comments) { /* if comment starts in column * 1 it should not be touched */ ps.box_com = true; + break_delim = false; ps.com_col = 1; } else { @@ -119,7 +116,7 @@ pr_comment(void) * be a block comment and is treated as a * box comment unless format_block_comments * is nonzero (the default). */ - break_delim = 0; + break_delim = false; } if ( /* ps.bl_line && */ (s_lab == e_lab) && (s_code == e_code)) { /* klg: check only if this line is blank */ @@ -134,7 +131,7 @@ pr_comment(void) } else { int target_col; - break_delim = 0; + break_delim = false; if (s_code != e_code) target_col = count_spaces(compute_code_target(), s_code); else { @@ -165,23 +162,35 @@ pr_comment(void) if (*buf_ptr != ' ' && !ps.box_com) *e_com++ = ' '; + /* Don't put a break delimiter if this comment is a one-liner */ + for (t_ptr = buf_ptr; *t_ptr != '\0' && *t_ptr != '\n'; t_ptr++) { + if (t_ptr >= buf_end) + fill_buffer(); + if (t_ptr[0] == '*' && t_ptr[1] == '/') { + break_delim = false; + break; + } + } + + if (break_delim) { + char *t = e_com; + e_com = s_com + 2; + *e_com = 0; + if (blanklines_before_blockcomments) + prefix_blankline_requested = 1; + dump_line(); + e_com = t; + s_com[0] = s_com[1] = s_com[2] = ' '; + } + *e_com = '\0'; - if (troff) { - now_col = 1; + if (troff) adj_max_col = 80; - } - else - now_col = count_spaces(ps.com_col, s_com); /* figure what column we - * would be in if we - * printed the comment - * now */ /* Start to copy the comment */ while (1) { /* this loop will go until the comment is * copied */ - if (*buf_ptr > 040 && *buf_ptr != '*') - ps.last_nl = 0; CHECK_SIZE_COM; switch (*buf_ptr) { /* this checks for various spcl cases */ case 014: /* check for a form feed */ @@ -209,7 +218,6 @@ pr_comment(void) dump_line(); return; } - one_liner = 0; if (ps.box_com || ps.last_nl) { /* if this is a boxed comment, * we dont ignore the newline */ if (s_com == e_com) { @@ -218,25 +226,12 @@ pr_comment(void) } *e_com = '\0'; if (!ps.box_com && e_com - s_com > 3) { - if (break_delim == 1 && s_com[0] == '/' - && s_com[1] == '*' && s_com[2] == ' ') { - char *t = e_com; - break_delim = 2; - e_com = s_com + 2; - *e_com = 0; - if (blanklines_before_blockcomments) - prefix_blankline_requested = 1; - dump_line(); - e_com = t; - s_com[0] = s_com[1] = s_com[2] = ' '; - } dump_line(); CHECK_SIZE_COM; *e_com++ = ' '; *e_com++ = ' '; } dump_line(); - now_col = ps.com_col; } else { ps.last_nl = 1; @@ -250,7 +245,6 @@ pr_comment(void) last_bl = e_com; CHECK_SIZE_COM; *e_com++ = ' '; - ++now_col; } } ++line_no; /* keep track of input line number */ @@ -281,29 +275,15 @@ pr_comment(void) end_of_comment: if (++buf_ptr >= buf_end) fill_buffer(); - - if (*(e_com - 1) != ' ' && !ps.box_com) { /* insure blank before - * end */ + /* ensure blank before end */ + if (e_com[-1] != ' ' && !ps.box_com) { *e_com++ = ' '; - ++now_col; - } - if (break_delim == 1 && !one_liner && s_com[0] == '/' - && s_com[1] == '*' && s_com[2] == ' ') { - char *t = e_com; - break_delim = 2; - e_com = s_com + 2; - *e_com = 0; - if (blanklines_before_blockcomments) - prefix_blankline_requested = 1; - dump_line(); - e_com = t; - s_com[0] = s_com[1] = s_com[2] = ' '; } - if (break_delim == 2 && e_com > s_com + 3 - /* now_col > adj_max_col - 2 && !ps.box_com */ ) { - *e_com = '\0'; - dump_line(); - now_col = ps.com_col; + if (break_delim) { + if (e_com > s_com + 3) { + *e_com = '\0'; + dump_line(); + } } CHECK_SIZE_COM; *e_com++ = '*'; @@ -312,44 +292,26 @@ pr_comment(void) ps.just_saw_decl = l_just_saw_decl; return; } - else { /* handle isolated '*' */ + else /* handle isolated '*' */ *e_com++ = '*'; - ++now_col; - } break; default: /* we have a random char */ - *e_com = *buf_ptr++; - if (buf_ptr >= buf_end) - fill_buffer(); - - if (*e_com == '\t') /* keep track of column */ - now_col = ((now_col - 1) & tabmask) + tabsize + 1; - else if (*e_com == '\b') /* this is a backspace */ - --now_col; - else - ++now_col; - - if (*e_com == ' ' || *e_com == '\t') - last_bl = e_com; - /* remember we saw a blank */ - - ++e_com; + now_col = count_spaces_until(ps.com_col, s_com, e_com); + do { + *e_com = *buf_ptr++; + if (buf_ptr >= buf_end) + fill_buffer(); + if (*e_com == ' ' || *e_com == '\t') + last_bl = e_com; /* remember we saw a blank */ + ++e_com; + now_col++; + } while (!memchr("*\n\r\b\t", *buf_ptr, 6) && + now_col <= adj_max_col); + ps.last_nl = false; if (now_col > adj_max_col && !ps.box_com && e_com[-1] > ' ') { /* * the comment is too long, it must be broken up */ - if (break_delim == 1 && s_com[0] == '/' - && s_com[1] == '*' && s_com[2] == ' ') { - char *t = e_com; - break_delim = 2; - e_com = s_com + 2; - *e_com = 0; - if (blanklines_before_blockcomments) - prefix_blankline_requested = 1; - dump_line(); - e_com = t; - s_com[0] = s_com[1] = s_com[2] = ' '; - } if (last_bl == NULL) { /* we have seen no blanks */ last_bl = e_com; /* fake it */ *e_com++ = ' '; @@ -378,8 +340,6 @@ pr_comment(void) } } *e_com = '\0'; - now_col = count_spaces(ps.com_col, s_com); /* recompute current - * position */ } break; } From owner-svn-src-head@freebsd.org Sun Jul 31 20:13:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9DAFBA9DBB; Sun, 31 Jul 2016 20:13:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA27C1FA3; Sun, 31 Jul 2016 20:13:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VKD0CO028458; Sun, 31 Jul 2016 20:13:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VKD0qb028457; Sun, 31 Jul 2016 20:13:00 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607312013.u6VKD0qb028457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 20:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303597 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 20:13:02 -0000 Author: pfg Date: Sun Jul 31 20:13:00 2016 New Revision: 303597 URL: https://svnweb.freebsd.org/changeset/base/303597 Log: indent(1): Fix wrapping of some lines in comments. After a blank line was printed (to separate paragraphs in comments), the next line was sometimes wrapped to the column at which the previous non-empty line ended. The fix is to reset the last blank pointer (last_bl) on newline. References: https://github.com/pstef/freebsd_indent/commit/345663c07af0758fd10433bde14722dfd900f85c Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Jul 31 20:04:18 2016 (r303596) +++ head/usr.bin/indent/pr_comment.c Sun Jul 31 20:13:00 2016 (r303597) @@ -218,6 +218,7 @@ pr_comment(void) dump_line(); return; } + last_bl = NULL; if (ps.box_com || ps.last_nl) { /* if this is a boxed comment, * we dont ignore the newline */ if (s_com == e_com) { From owner-svn-src-head@freebsd.org Sun Jul 31 20:16:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D390BBA9EDA; Sun, 31 Jul 2016 20:16:18 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 91E2D12A4; Sun, 31 Jul 2016 20:16:18 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 5D4B1358C66; Sun, 31 Jul 2016 22:16:15 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 3516928494; Sun, 31 Jul 2016 22:16:15 +0200 (CEST) Date: Sun, 31 Jul 2016 22:16:15 +0200 From: Jilles Tjoelker To: Alexey Dokuchaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303586 - head/bin/sh Message-ID: <20160731201614.GA58505@stack.nl> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> <20160731134316.GB85936@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160731134316.GB85936@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 20:16:18 -0000 On Sun, Jul 31, 2016 at 01:43:16PM +0000, Alexey Dokuchaev wrote: > On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: > > New Revision: 303586 > > URL: https://svnweb.freebsd.org/changeset/base/303586 > > Log: > > sh: Fix a clang warning. > > Submitted by: bdrewery > > Modified: > > head/bin/sh/expand.c > > Modified: head/bin/sh/expand.c > > ============================================================================== > > --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) > > +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) > > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in > > if (--in.nleft < 0) { > > if (in.fd < 0) > > break; > > - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); > > + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) > > + ; > `continue;' would be even better; some tools might barf at stray semicolon. Both continue; and ; (the latter with and without comment) occur in the source tree many times. I don't really like a continue that does nothing because it is at the end of a loop, so I prefer to make this whitespace change only (there are two more instances in bin/sh). I think a sole semicolon on a line is conspicuous enough that nothing additional is required. -- Jilles Tjoelker From owner-svn-src-head@freebsd.org Sun Jul 31 21:09:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FD82BA8FD1; Sun, 31 Jul 2016 21:09:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16ABC12AB; Sun, 31 Jul 2016 21:09:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VL9NuP047850; Sun, 31 Jul 2016 21:09:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VL9NLg047848; Sun, 31 Jul 2016 21:09:23 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607312109.u6VL9NLg047848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 21:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303598 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 21:09:24 -0000 Author: pfg Date: Sun Jul 31 21:09:22 2016 New Revision: 303598 URL: https://svnweb.freebsd.org/changeset/base/303598 Log: indent(1): Untangle the connection between pr_comment.c and io.c. It's pr_comment.c that should decide whether to put a "star comment continuation" or not. This duplicates code a bit, but it simplifies pr_comment() at the same time since pr_comment() no longer has to "signal" whether a star continuation is needed or not. This change requires indent(1) to not wrap comment lines that lack a blank character, but I think it's for the better if you look at cases when that happens (mostly long URIs and file system paths, which arguably shouldn't be wrapped). It also fixes two bugs: 1. Cases where asterisk is a part of the comment's content (like in "*we* are the champions") and happens to appear at the beginning of the line, misleading dump_line() into thinking that this is part of the star comment continuation, leading to misalignment. 2. Cases where blank starred lines had three too many characters on the line when wrapped. Reference: https://github.com/pstef/freebsd_indent/commit/3b41ee78aafafc7c3e662b794835e3253218dbb3 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/io.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Sun Jul 31 20:13:00 2016 (r303597) +++ head/usr.bin/indent/io.c Sun Jul 31 21:09:22 2016 (r303598) @@ -242,17 +242,8 @@ dump_line(void) while (e_com > com_st && isspace(e_com[-1])) e_com--; cur_col = pad_output(cur_col, target); - if (!ps.box_com) { - if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) { - if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) - com_st[1] = '*'; - else - fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); - } - } fwrite(com_st, e_com - com_st, 1, output); ps.comment_delta = ps.n_comment_delta; - cur_col = count_spaces(cur_col, com_st); ++ps.com_lines; /* count lines with comments */ } } @@ -282,7 +273,7 @@ inhibit_newline: ps.dumped_decl_indent = 0; *(e_lab = s_lab) = '\0'; /* reset buffers */ *(e_code = s_code) = '\0'; - *(e_com = s_com) = '\0'; + *(e_com = s_com = combuf + 1) = '\0'; ps.ind_level = ps.i_l_follow; ps.paren_level = ps.p_l_follow; paren_target = -ps.paren_indents[ps.paren_level - 1]; Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Sun Jul 31 20:13:00 2016 (r303597) +++ head/usr.bin/indent/pr_comment.c Sun Jul 31 21:09:22 2016 (r303598) @@ -179,11 +179,11 @@ pr_comment(void) if (blanklines_before_blockcomments) prefix_blankline_requested = 1; dump_line(); - e_com = t; - s_com[0] = s_com[1] = s_com[2] = ' '; + e_com = s_com = t; + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; } - *e_com = '\0'; if (troff) adj_max_col = 80; @@ -199,10 +199,10 @@ pr_comment(void) /* fix so dump_line uses a form feed */ dump_line(); last_bl = NULL; - *e_com++ = ' '; - *e_com++ = '*'; - *e_com++ = ' '; - while (*++buf_ptr == ' ' || *buf_ptr == '\t'); + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; + while (*++buf_ptr == ' ' || *buf_ptr == '\t') + ; } else { if (++buf_ptr >= buf_end) @@ -214,25 +214,22 @@ pr_comment(void) case '\n': if (had_eof) { /* check for unexpected eof */ printf("Unterminated comment\n"); - *e_com = '\0'; dump_line(); return; } last_bl = NULL; if (ps.box_com || ps.last_nl) { /* if this is a boxed comment, * we dont ignore the newline */ - if (s_com == e_com) { - *e_com++ = ' '; + if (s_com == e_com) *e_com++ = ' '; - } - *e_com = '\0'; if (!ps.box_com && e_com - s_com > 3) { dump_line(); - CHECK_SIZE_COM; - *e_com++ = ' '; - *e_com++ = ' '; + if (star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; } dump_line(); + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; } else { ps.last_nl = 1; @@ -276,20 +273,18 @@ pr_comment(void) end_of_comment: if (++buf_ptr >= buf_end) fill_buffer(); - /* ensure blank before end */ - if (e_com[-1] != ' ' && !ps.box_com) { - *e_com++ = ' '; - } + CHECK_SIZE_COM; if (break_delim) { if (e_com > s_com + 3) { - *e_com = '\0'; dump_line(); } + else + s_com = e_com; + *e_com++ = ' '; } - CHECK_SIZE_COM; - *e_com++ = '*'; - *e_com++ = '/'; - *e_com = '\0'; + if (e_com[-1] != ' ' && !ps.box_com) + *e_com++ = ' '; /* ensure blank before end */ + *e_com++ = '*', *e_com++ = '/', *e_com = '\0'; ps.just_saw_decl = l_just_saw_decl; return; } @@ -307,40 +302,32 @@ pr_comment(void) ++e_com; now_col++; } while (!memchr("*\n\r\b\t", *buf_ptr, 6) && - now_col <= adj_max_col); + (now_col <= adj_max_col || !last_bl)); ps.last_nl = false; if (now_col > adj_max_col && !ps.box_com && e_com[-1] > ' ') { /* * the comment is too long, it must be broken up */ - if (last_bl == NULL) { /* we have seen no blanks */ - last_bl = e_com; /* fake it */ - *e_com++ = ' '; + if (last_bl == NULL) { + dump_line(); + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; + break; } - *e_com = '\0'; /* print what we have */ - *last_bl = '\0'; - while (last_bl > s_com && last_bl[-1] < 040) - *--last_bl = 0; + *e_com = '\0'; e_com = last_bl; dump_line(); - - *e_com++ = ' '; /* add blanks for continuation */ - *e_com++ = ' '; - *e_com++ = ' '; - - t_ptr = last_bl + 1; + if (!ps.box_com && star_comment_cont) + *e_com++ = ' ', *e_com++ = '*', *e_com++ = ' '; + for (t_ptr = last_bl + 1; *t_ptr == ' ' || *t_ptr == '\t'; + t_ptr++) + ; last_bl = NULL; - if (t_ptr >= e_com) { - while (*t_ptr == ' ' || *t_ptr == '\t') - t_ptr++; - while (*t_ptr != '\0') { /* move unprinted part of - * comment down in buffer */ - if (*t_ptr == ' ' || *t_ptr == '\t') - last_bl = e_com; - *e_com++ = *t_ptr++; - } - } - *e_com = '\0'; + while (*t_ptr != '\0') { + if (*t_ptr == ' ' || *t_ptr == '\t') + last_bl = e_com; + *e_com++ = *t_ptr++; + } } break; } From owner-svn-src-head@freebsd.org Sun Jul 31 21:29:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23222BAA363; Sun, 31 Jul 2016 21:29:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAC891C4B; Sun, 31 Jul 2016 21:29:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VLTBV8055136; Sun, 31 Jul 2016 21:29:11 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VLTB7F055135; Sun, 31 Jul 2016 21:29:11 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607312129.u6VLTB7F055135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 21:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303599 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 21:29:12 -0000 Author: pfg Date: Sun Jul 31 21:29:10 2016 New Revision: 303599 URL: https://svnweb.freebsd.org/changeset/base/303599 Log: indent(1): Don't newline on cpp lines like #endif unless -bacc is on. Reference: https://github.com/pstef/freebsd_indent/commit/01f36f4141c71754b3a73a91886fb425bab0df3e Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Sun Jul 31 21:09:22 2016 (r303598) +++ head/usr.bin/indent/indent.c Sun Jul 31 21:29:10 2016 (r303599) @@ -1100,13 +1100,7 @@ check_type: ps.pcase = false; } - if (strncmp(s_lab, "#if", 3) == 0) { - if (blanklines_around_conditional_compilation) { - int c; - prefix_blankline_requested++; - while ((c = getc(input)) == '\n'); - ungetc(c, input); - } + if (strncmp(s_lab, "#if", 3) == 0) { /* also ifdef, ifndef */ if ((size_t)ifdef_level < nitems(state_stack)) { match_state[ifdef_level].tos = -1; state_stack[ifdef_level++] = ps; @@ -1114,34 +1108,49 @@ check_type: else diag2(1, "#if stack overflow"); } - else if (strncmp(s_lab, "#else", 5) == 0) + else if (strncmp(s_lab, "#el", 3) == 0) { /* else, elif */ if (ifdef_level <= 0) - diag2(1, "Unmatched #else"); + diag2(1, s_lab[3] == 'i' ? "Unmatched #elif" : "Unmatched #else"); else { match_state[ifdef_level - 1] = ps; ps = state_stack[ifdef_level - 1]; } + } else if (strncmp(s_lab, "#endif", 6) == 0) { if (ifdef_level <= 0) diag2(1, "Unmatched #endif"); - else { + else ifdef_level--; - -#ifdef undef - /* - * This match needs to be more intelligent before the - * message is useful - */ - if (match_state[ifdef_level].tos >= 0 - && bcmp(&ps, &match_state[ifdef_level], sizeof ps)) - diag2(0, "Syntactically inconsistent #ifdef alternatives"); -#endif + } else { + struct directives { + int size; + const char *string; } - if (blanklines_around_conditional_compilation) { - postfix_blankline_requested++; - n_real_blanklines = 0; + recognized[] = { + {7, "include"}, + {6, "define"}, + {5, "undef"}, + {4, "line"}, + {5, "error"}, + {6, "pragma"} + }; + int d = nitems(recognized); + while (--d >= 0) + if (strncmp(s_lab + 1, recognized[d].string, recognized[d].size) == 0) + break; + if (d < 0) { + diag2(1, "Unrecognized cpp directive"); + break; } } + if (blanklines_around_conditional_compilation) { + postfix_blankline_requested++; + n_real_blanklines = 0; + } + else { + postfix_blankline_requested = 0; + prefix_blankline_requested = 0; + } break; /* subsequent processing of the newline * character will cause the line to be printed */ From owner-svn-src-head@freebsd.org Sun Jul 31 21:36:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F36ADBAA5C3; Sun, 31 Jul 2016 21:36:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C046A12CA; Sun, 31 Jul 2016 21:36:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VLaeKR058694; Sun, 31 Jul 2016 21:36:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VLaeRb058693; Sun, 31 Jul 2016 21:36:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607312136.u6VLaeRb058693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 21:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303600 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 21:36:42 -0000 Author: pfg Date: Sun Jul 31 21:36:40 2016 New Revision: 303600 URL: https://svnweb.freebsd.org/changeset/base/303600 Log: indent(1): replace function call to bzero with memset. Reference: https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/io.c Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Sun Jul 31 21:29:10 2016 (r303599) +++ head/usr.bin/indent/io.c Sun Jul 31 21:36:40 2016 (r303600) @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * const char *s = s0; int sizedelta = 0; - bzero(f, sizeof *f); + memset(f, 0, sizeof(struct fstate)); while (*s) { if (isdigit(*s)) f->size = f->size * 10 + *s - '0'; From owner-svn-src-head@freebsd.org Sun Jul 31 21:43:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4F73BAA8E8; Sun, 31 Jul 2016 21:43:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87EBB1904; Sun, 31 Jul 2016 21:43:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6VLhhIe062415; Sun, 31 Jul 2016 21:43:43 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6VLhhQB062414; Sun, 31 Jul 2016 21:43:43 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607312143.u6VLhhQB062414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 31 Jul 2016 21:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303601 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 21:43:44 -0000 Author: pfg Date: Sun Jul 31 21:43:43 2016 New Revision: 303601 URL: https://svnweb.freebsd.org/changeset/base/303601 Log: indent(1): Rearrange option parsing code to squelch clang's static analyzer. clang-analyzer complained that eqin() sets file-scoped pointer param_start to point into char buffer defined in scan_profile(), and once scan_profile() exits, param_start is a "dangling reference". param_start was never used afterwards, but it's cleaner to move it to set_option() which is the only branch where param_start is needed. Reference: https://github.com/pstef/freebsd_indent/commit/ab0e44e5da3ff0fa4b62e451e4bbc3ea1ec7f365 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/args.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Sun Jul 31 21:36:40 2016 (r303600) +++ head/usr.bin/indent/args.c Sun Jul 31 21:43:43 2016 (r303601) @@ -223,17 +223,14 @@ scan_profile(FILE *f) } } -const char *param_start; - -static int +static const char * eqin(const char *s1, const char *s2) { while (*s1) { if (*s1++ != *s2++) - return (false); + return (NULL); } - param_start = s2; - return (true); + return (s2); } /* @@ -257,11 +254,12 @@ set_defaults(void) void set_option(char *arg) { - struct pro *p; + struct pro *p; + const char *param_start; arg++; /* ignore leading "-" */ for (p = pro; p->p_name; p++) - if (*p->p_name == *arg && eqin(p->p_name, arg)) + if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL) goto found; errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1); found: From owner-svn-src-head@freebsd.org Mon Aug 1 00:36:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78ADBBA893C; Mon, 1 Aug 2016 00:36:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B7FF1A81; Mon, 1 Aug 2016 00:36:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u710aTU5024890; Mon, 1 Aug 2016 00:36:29 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u710aTjR024889; Mon, 1 Aug 2016 00:36:29 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608010036.u710aTjR024889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 1 Aug 2016 00:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303602 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 00:36:30 -0000 Author: adrian Date: Mon Aug 1 00:36:29 2016 New Revision: 303602 URL: https://svnweb.freebsd.org/changeset/base/303602 Log: [ath] update comments. Modified: head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Sun Jul 31 21:43:43 2016 (r303601) +++ head/sys/dev/ath/if_athioctl.h Mon Aug 1 00:36:29 2016 (r303602) @@ -303,8 +303,8 @@ struct ath_radiotap_vendor_hdr { /* 30 /* At this point it should be 4 byte aligned */ uint32_t evm[ATH_RADIOTAP_MAX_EVM]; /* 5 * 4 = 20 */ - uint8_t rssi_ctl[ATH_RADIOTAP_MAX_CHAINS]; /* 4 */ - uint8_t rssi_ext[ATH_RADIOTAP_MAX_CHAINS]; /* 4 */ + uint8_t rssi_ctl[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ + uint8_t rssi_ext[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ uint8_t vh_phyerr_code; /* Phy error code, or 0xff */ uint8_t vh_rs_status; /* RX status */ From owner-svn-src-head@freebsd.org Mon Aug 1 02:35:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16E1ABAA5B7; Mon, 1 Aug 2016 02:35:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 204AF1F96; Mon, 1 Aug 2016 02:35:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id E12B0421A52; Mon, 1 Aug 2016 12:35:15 +1000 (AEST) Date: Mon, 1 Aug 2016 12:35:15 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303583 - head/sys/amd64/amd64 In-Reply-To: <20160731163527.GZ83214@kib.kiev.ua> Message-ID: <20160801105417.C919@besplex.bde.org> References: <201607311134.u6VBY81j031059@repo.freebsd.org> <20160731220407.Q3033@besplex.bde.org> <20160731163527.GZ83214@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=VIkg5I7X 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=K8udwBj-oB1w_VQ5t28A:9 a=2QhXWfjkxqwJA8as:21 a=cqztS_KOFIGvzGm9:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 02:35:21 -0000 On Sun, 31 Jul 2016, Konstantin Belousov wrote: > On Sun, Jul 31, 2016 at 11:11:25PM +1000, Bruce Evans wrote: I said that I didn't replace (sse2) pagecopy() by bcopy() on amd64 for Haswell. Actually I do, for a small improvement on makeworld. i386 doesn't have (sse*) pagecopy() except in some of my versions, so I don't need to do anything to get the same improvement on the same Haswell. >> On Haswell, "rep stos" takes about 25 cycles to start up, and the function >> call overhead is in the noise. 25 cycles is a lot. Haswell can move >> 32 bytes/cycle from L2 to L2, so it misses moving 800 bytes or 1/5 of a >> page in its startup overhead. Oops, that is for "rep movs". "rep stos" >> is similar. > The commit message contained a probable explanation of the reason why > the change demonstrated measurable improvement in non-microbenchmark load. Pagefaults give some locality, but I think not enough to explain much of the improvement or the larger negative improvements that I measure. makeworld isn't a micro-benchmark. For a tuned ~5.2 world it does about 32 million pagezero()s. makeworld does only 2728 pagefaults with warm (VMIO and buffer...) caches on i386. 24866 with cold caches. On amd64, 15% lower. Page reclaims are about 17 million on i386 and 27 million on amd64. Either page faults each touch a lot of pages (so that nontemporal stores should help in theory by avoiding busting L1 and depleting L2 on every pagefault), or there is a lot of pre-zeroing (so again nontemporal stors should help in theory). In fact, nontemporal stores help in practice on Turion2. Haswell has better caches and that is probably the main reason that nontemporal stores are slower in practice. Turion2 also benefited from the old implementation of pagezero in idle. Clearly, zeroing in idle should use nontemporal stores. But when nontemporal stores are much slower, there is less likely to be enough otherwise-idle cycles to do enough of them. Zeroing in idle works poorly now, and is turned off. On systems with HTT, idle CPUs aren't created equally and aren't really idle if using them would steal sources from another CPU. > That said, the only thing I am answering and asking there is the above > claim about 25 cycles overhead of rep;stosq on hsw. I am curious how > the overhead was measured. Note: Agner Fog' tables state that fast mode > takes <2n uops and has reciprocal throughput of 0.5n worst case and do > not demostrate any setup overhead for hsw. I think the target is 0.25n best case (32 bytes/cycle only 8 bytes wide using integer instructions). ISTR that Fog says something about the latency. He does for older CPUs. I've never noticed latency for x86 string instructions being below about 15 cycles, and the fast string operations have to do more setup so it would be surprising if they had lower latency. To measure latency, just time bcopy() and bzero() with different sizes in a loop and take differences. Use small sizes to stay in L1 and avoid cache misses (except for preemption). I get the following times for amd64 on Haswell @ 4.080 GHz. (These times also disprove my claim that bzero() is just as good as a specialized function -- latency makes it significantly slower except for unusually large sizes.): size 4096 size 8192 0.25n throughput: 130.56 130.56 rep movsb alone in a function: 96.5 110.9 (speeds in 1e9 B/s) 45+0.25n: 96.6 111.0 memcpy (rep movsq in libc): 72.5 92.9 102+0.25n: 72.7 93.4 rep stosq alone in function: 105.8 116.7 31+0.25n: 105.1 116.9 25 is about right for rep stosq inline -- the function call adds about 5, and that is in the fastest possible case with the call in a loop. libc memcpy must be doing something very stupid to take 102 cycles. Note that Haswell can't get very near 0+0.25n because sizes slightly larger than 2*8192. Haswell's L1 is too small to get very near to amortising the startup overhead. The fastest speed I could find for rep movsb in a function was 115.4 for size 13K. Larger sizes are slower because they don't fit in L1 (2 * 14K fits in 32K L1 but is still slower for some reason). Latency for non-rep string functions is also interesting. I think it is almost as high, making these instructions useless for all purposes except saving space on all CPUs and saving time on CPUs almost as old as the 8088 (on the 8088, instruction fetch was very slow, so it was faster to use 1-byte instructions if possible). Bruce From owner-svn-src-head@freebsd.org Mon Aug 1 04:26:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48BF4BAABE3; Mon, 1 Aug 2016 04:26:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CA711F9D; Mon, 1 Aug 2016 04:26:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u714QPwx010645; Mon, 1 Aug 2016 04:26:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u714QOrJ010638; Mon, 1 Aug 2016 04:26:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608010426.u714QOrJ010638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 1 Aug 2016 04:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303603 - in head/sys/dev/hyperv: include netvsc storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 04:26:26 -0000 Author: sephe Date: Mon Aug 1 04:26:24 2016 New Revision: 303603 URL: https://svnweb.freebsd.org/changeset/base/303603 Log: hyperv/vmbus: Remove the artificial entry limit of SG and PRP list. Just make sure that the total channel packet size does not exceed 1/2 data size of the TX bufring. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7359 Modified: head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/vmbus_brvar.h head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/include/vmbus.h Mon Aug 1 04:26:24 2016 (r303603) @@ -102,9 +102,6 @@ struct vmbus_chanpkt_rxbuf { struct vmbus_rxbuf_desc cp_rxbuf[]; } __packed; -#define VMBUS_CHAN_SGLIST_MAX 32 -#define VMBUS_CHAN_PRPLIST_MAX 32 - struct vmbus_channel; struct hyperv_guid; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Aug 1 04:26:24 2016 (r303603) @@ -1088,6 +1088,7 @@ struct vmbus_channel; typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) +#define NETVSC_PACKET_MAXPAGE 32 #define NETVSC_VLAN_PRIO_MASK 0xe000 #define NETVSC_VLAN_PRIO_SHIFT 13 @@ -1137,7 +1138,7 @@ typedef struct netvsc_packet_ { uint32_t tot_data_buf_len; void *data; uint32_t gpa_cnt; - struct vmbus_gpa gpa[VMBUS_CHAN_SGLIST_MAX]; + struct vmbus_gpa gpa[NETVSC_PACKET_MAXPAGE]; } netvsc_packet; typedef struct { Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Aug 1 04:26:24 2016 (r303603) @@ -152,7 +152,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE #define HN_TX_DATA_SEGCNT_MAX \ - (VMBUS_CHAN_SGLIST_MAX - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) + (NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) #define HN_DIRECT_TX_SIZE_DEF 128 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 1 04:26:24 2016 (r303603) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define STORVSC_DATA_SEGCNT_MAX VMBUS_CHAN_PRPLIST_MAX +#define STORVSC_DATA_SEGCNT_MAX 32 #define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE #define STORVSC_DATA_SIZE_MAX \ (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) Modified: head/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Aug 1 04:26:24 2016 (r303603) @@ -71,6 +71,13 @@ struct vmbus_txbr { struct sysctl_ctx_list; struct sysctl_oid; +static __inline int +vmbus_txbr_maxpktsz(const struct vmbus_txbr *tbr) +{ + /* 1/2 data size */ + return (tbr->txbr_dsize / 2); +} + void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, struct vmbus_br *br, const char *name); Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Aug 1 00:36:29 2016 (r303602) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Aug 1 04:26:24 2016 (r303603) @@ -610,6 +610,8 @@ vmbus_chan_send(struct vmbus_channel *ch hlen = sizeof(pkt); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(&chan->ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags = flags; @@ -640,12 +642,11 @@ vmbus_chan_send_sglist(struct vmbus_chan boolean_t send_evt; uint64_t pad = 0; - KASSERT(sglen < VMBUS_CHAN_SGLIST_MAX, - ("invalid sglist len %d", sglen)); - hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(&chan->ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; @@ -681,13 +682,12 @@ vmbus_chan_send_prplist(struct vmbus_cha boolean_t send_evt; uint64_t pad = 0; - KASSERT(prp_cnt < VMBUS_CHAN_PRPLIST_MAX, - ("invalid prplist entry count %d", prp_cnt)); - hlen = __offsetof(struct vmbus_chanpkt_prplist, cp_range[0].gpa_page[prp_cnt]); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(&chan->ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; From owner-svn-src-head@freebsd.org Mon Aug 1 04:33:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A721FBAADBD for ; Mon, 1 Aug 2016 04:33:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::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 6F7D01542 for ; Mon, 1 Aug 2016 04:33:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x232.google.com with SMTP id b62so176542255iod.3 for ; Sun, 31 Jul 2016 21:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=RtJWTP0ntyXggQAt3q/ApA2Yl+qFZQ4rMrMtRpvj40I=; b=eV0Zn31ZGPSsReb5jmVggzJ23Xb7ypHU4901P+xKoWZNNiC9riYm2qnT+n3SXdeeaC 4TSjJfdDVAWSKNwV5K4JtsMxGSLyQFkBHn1hpQQyfL1qXTCQgxXuyNO5n29wFos1mW4s EZARj6+VqSPxxo9K5mdRlkwkAQ+wcgPRYj5/0hR0CCAPNOSkmsHCcrSMz6P4Sr5mLrrm ixpVm561IiHq+qNzrqzXC3/Wsgyo9iebsyBgwipZ9TNkjhiySDwodnCmwyvRewKwE7B5 0LrG0Y/xVyhMMCg9qi7JEkQj45zbRNySetxyTxgDyHFS1NhkWtAaYXkmZ8utirNIfwJT mixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=RtJWTP0ntyXggQAt3q/ApA2Yl+qFZQ4rMrMtRpvj40I=; b=lbqAyMq/fO2fVxrc+6VJPSDqsxiLUWzEt1oycl3x+i3yFRvBcTQ681YeLPL+9U3aK9 p5jUxW7BhGfg8pIwdZUJuX9GxVkY5jITji5G3A9PrS532nCaYwF/2FQPM9wceCi0IjnA IbenKxrqiBF9OaVfLiKslbn/NsIl1sEZ6QrXyc0+J0oxmF1diSEFlRrHatvzwlH74PrK veYF5Oxb+BiXlT6546yP1Lk+fBCbSzMfNh0CEKurex+aCG0iOGN0W7L3pDoDO8zMQbfQ QxvxICxZO23SF0W3ZBNqqUc/AH/i9AaBl6RbQeNmtoVG2FSAhWIJ6ntKM0cOa+jw269U bylA== X-Gm-Message-State: AEkoouvp6iLJ2wsY7MeRSETCr+aQd7TpTpsXhdU+KEf6vHAHTfN6il67ee3X/DpvLW+75JEnfsx1LdweptsYTQ== X-Received: by 10.107.40.133 with SMTP id o127mr52230095ioo.183.1470026009783; Sun, 31 Jul 2016 21:33:29 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.137.131 with HTTP; Sun, 31 Jul 2016 21:33:29 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <20160731201614.GA58505@stack.nl> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> <20160731134316.GB85936@FreeBSD.org> <20160731201614.GA58505@stack.nl> From: Warner Losh Date: Sun, 31 Jul 2016 22:33:29 -0600 X-Google-Sender-Auth: -pDZ689a-uY8HEGwSU34ss_887E Message-ID: Subject: Re: svn commit: r303586 - head/bin/sh To: Jilles Tjoelker Cc: Alexey Dokuchaev , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 04:33:30 -0000 On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker wrote: > On Sun, Jul 31, 2016 at 01:43:16PM +0000, Alexey Dokuchaev wrote: >> On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: >> > New Revision: 303586 >> > URL: https://svnweb.freebsd.org/changeset/base/303586 > >> > Log: >> > sh: Fix a clang warning. > >> > Submitted by: bdrewery > >> > Modified: >> > head/bin/sh/expand.c > >> > Modified: head/bin/sh/expand.c >> > ============================================================================== >> > --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) >> > +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) >> > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in >> > if (--in.nleft < 0) { >> > if (in.fd < 0) >> > break; >> > - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); >> > + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) >> > + ; > >> `continue;' would be even better; some tools might barf at stray semicolon. > > Both continue; and ; (the latter with and without comment) occur in the > source tree many times. I don't really like a continue that does nothing > because it is at the end of a loop, so I prefer to make this whitespace > change only (there are two more instances in bin/sh). I think a sole > semicolon on a line is conspicuous enough that nothing additional is > required. For humans, yes. For picky tools that warn about strange constructs, no. Clang may be happy, but there's many other tools that expect you to declare an 'empty' while loop with continue. This tradition has dated back to at least the late 80's... Warner From owner-svn-src-head@freebsd.org Mon Aug 1 04:51:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9056FBAA071; Mon, 1 Aug 2016 04:51:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 423371BB8; Mon, 1 Aug 2016 04:51:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u714pVWR018153; Mon, 1 Aug 2016 04:51:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u714pVxZ018152; Mon, 1 Aug 2016 04:51:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608010451.u714pVxZ018152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 1 Aug 2016 04:51:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303604 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 04:51:32 -0000 Author: sephe Date: Mon Aug 1 04:51:31 2016 New Revision: 303604 URL: https://svnweb.freebsd.org/changeset/base/303604 Log: hyperv/storvsc: Set maxio to 128KB. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7360 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 1 04:26:24 2016 (r303603) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 1 04:51:31 2016 (r303604) @@ -88,10 +88,25 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define STORVSC_DATA_SEGCNT_MAX 32 +/* + * 33 segments are needed to allow 128KB maxio, in case the data + * in the first page is _not_ PAGE_SIZE aligned, e.g. + * + * |<----------- 128KB ----------->| + * | | + * 0 2K 4K 8K 16K 124K 128K 130K + * | | | | | | | | + * +--+--+-----+-----+.......+-----+--+--+ + * | | | | | | | | | DATA + * | | | | | | | | | + * +--+--+-----+-----+.......------+--+--+ + * | | | | + * | 1| 31 | 1| ...... # of segments + */ +#define STORVSC_DATA_SEGCNT_MAX 33 #define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE #define STORVSC_DATA_SIZE_MAX \ - (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) + ((STORVSC_DATA_SEGCNT_MAX - 1) * STORVSC_DATA_SEGSZ_MAX) struct storvsc_softc; @@ -1386,6 +1401,7 @@ storvsc_action(struct cam_sim *sim, unio cpi->hba_misc = PIM_NOBUSRESET; if (hv_storvsc_use_pim_unmapped) cpi->hba_misc |= PIM_UNMAPPED; + cpi->maxio = STORVSC_DATA_SIZE_MAX; cpi->hba_eng_cnt = 0; cpi->max_target = STORVSC_MAX_TARGETS; cpi->max_lun = sc->hs_drv_props->drv_max_luns_per_target; From owner-svn-src-head@freebsd.org Mon Aug 1 05:09:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60DDCBAC9DD; Mon, 1 Aug 2016 05:09:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C70016C5; Mon, 1 Aug 2016 05:09:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7159BuJ025536; Mon, 1 Aug 2016 05:09:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7159BIl025535; Mon, 1 Aug 2016 05:09:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608010509.u7159BIl025535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 1 Aug 2016 05:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303605 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 05:09:12 -0000 Author: sephe Date: Mon Aug 1 05:09:11 2016 New Revision: 303605 URL: https://svnweb.freebsd.org/changeset/base/303605 Log: hyperv/storvsc: Stringent PRP list assertions MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7361 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 1 04:51:31 2016 (r303604) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 1 05:09:11 2016 (r303605) @@ -1775,13 +1775,28 @@ storvsc_xferbuf_prepare(void *arg, bus_d prplist->gpa_range.gpa_ofs = segs[0].ds_addr & PAGE_MASK; for (i = 0; i < nsegs; i++) { - prplist->gpa_page[i] = atop(segs[i].ds_addr); #ifdef INVARIANTS - if (i != 0 && i != nsegs - 1) { - KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && - segs[i].ds_len == PAGE_SIZE, ("not a full page")); + if (nsegs > 1) { + if (i == 0) { + KASSERT((segs[i].ds_addr & PAGE_MASK) + + segs[i].ds_len == PAGE_SIZE, + ("invalid 1st page, ofs 0x%jx, len %zu", + (uintmax_t)segs[i].ds_addr, + segs[i].ds_len)); + } else if (i == nsegs - 1) { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0, + ("invalid last page, ofs 0x%jx", + (uintmax_t)segs[i].ds_addr)); + } else { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && + segs[i].ds_len == PAGE_SIZE, + ("not a full page, ofs 0x%jx, len %zu", + (uintmax_t)segs[i].ds_addr, + segs[i].ds_len)); + } } #endif + prplist->gpa_page[i] = atop(segs[i].ds_addr); } reqp->prp_cnt = nsegs; } From owner-svn-src-head@freebsd.org Mon Aug 1 05:28:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8159BAB7EB; Mon, 1 Aug 2016 05:28:49 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "anubis.delphij.net", Issuer "StartCom Class 1 DV Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9639614E6; Mon, 1 Aug 2016 05:28:49 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from Xins-MBP.home.us.delphij.net (unknown [IPv6:2601:646:8880:a197:ed7f:1144:1649:8fde]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 64F741CC40; Sun, 31 Jul 2016 22:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=anubis; t=1470029323; x=1470043723; bh=72AirEOq0HzaOFDCABxWZhFsHXKS9aT7BiZzV3vORDk=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=rFLjFes0zoacnA9qD9AwHLN0mU/edRX1RaG0aSjpIvTwY/qykFrjghRxGhVf2Q20M SiGSmpB1cIDNb8SVx7kbQL8CU9mDGlbpQdo7f0UVX99MDf8xisGutbv/YXUZRvy25t FTu+nACdmQ4dKKLkxPiLSFTwe+aWhwbL/tvmaJlM= Subject: Re: svn commit: r303600 - head/usr.bin/indent To: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607312136.u6VLaeRb058693@repo.freebsd.org> Cc: d@delphij.net From: Xin Li Message-ID: <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> Date: Sun, 31 Jul 2016 22:28:38 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607312136.u6VLaeRb058693@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ibkdQuaLo4iB7j34Ll0K30K4it8V0osip" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 05:28:49 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ibkdQuaLo4iB7j34Ll0K30K4it8V0osip Content-Type: multipart/mixed; boundary="ow1a1EjppvvOJkjtFv0l3dEfG3XLHDJMw" From: Xin Li To: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: d@delphij.net Message-ID: <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> Subject: Re: svn commit: r303600 - head/usr.bin/indent References: <201607312136.u6VLaeRb058693@repo.freebsd.org> In-Reply-To: <201607312136.u6VLaeRb058693@repo.freebsd.org> --ow1a1EjppvvOJkjtFv0l3dEfG3XLHDJMw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 7/31/16 14:36, Pedro F. Giffuni wrote: > Author: pfg > Date: Sun Jul 31 21:36:40 2016 > New Revision: 303600 > URL: https://svnweb.freebsd.org/changeset/base/303600 >=20 > Log: > indent(1): replace function call to bzero with memset. > =20 > Reference: > https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833= d7106035dc09230235 > =20 > Differential Revision: https://reviews.freebsd.org/D6966 (Partial) > Submitted by: Piotr Stefaniak >=20 > Modified: > head/usr.bin/indent/io.c >=20 > Modified: head/usr.bin/indent/io.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.bin/indent/io.c Sun Jul 31 21:29:10 2016 (r303599) > +++ head/usr.bin/indent/io.c Sun Jul 31 21:36:40 2016 (r303600) > @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * > const char *s =3D s0; > int sizedelta =3D 0; > =20 > - bzero(f, sizeof *f); > + memset(f, 0, sizeof(struct fstate)); ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone than sizeof(*f) IMHO. Cheers, --ow1a1EjppvvOJkjtFv0l3dEfG3XLHDJMw-- --ibkdQuaLo4iB7j34Ll0K30K4it8V0osip Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJXnt4KAAoJEJW2GBstM+ns71oP+wZGaoyh1/leHqlrQ1ZGY66e PO0RWY+AZQBNqgoqvklQnv3UkPdkwHw19Or0QTziyRaG+PNpf4fZ7WRO53ycO2Ne AsdsjiIZpier2GfjOjSb25hQzc7Qt9tOYm3rNCUyaB9JndJKALcEq0cZczbRuqIk 6dwbqPXk91BkuNIbU78jtPkX0NNa9zBYRcTA8jqxQirn5HX/pVcA7WiIWF3azq9Q q43vNTY4J3+Pxsh0Hyekew/7UA1yI7oSkNy3MiQcYmua1Ag6rGnELGdh3kXJPXBG PCLXhK15BYFBM5RMP8z2ZR/VfIJSc2bsvpoA+uiut9U2PdaTgS3gj6rM5z3ZvCrz Sm08SwP2FvnhqqmXEu/gyxt2kDhQYb4gXVSl4GzeJU+FsEiHXfvw+svNDYlXUVwy qiEbXr4naXK+z6VdETgS2VTP1XmI1hHSy9K0d5r8jJOfhTIjvDroKp55NB5Adov8 80DvtNH/Ymic2RD2FHgsW4sh9RYeYSPlEssEfT5axJwuFIVwixD+K2ong8zInIMr KnnNWAek/XoAqPEQoJzjp81tFp5iLqOaTjVDxMIZBTGuSHfp0qFqgpRRom0wo8A0 +va5exdLtcQlHfyRyeH3qDWSoajNuSv+NJerVQBONTwYy8MlAMP5/v/jETtFb6e+ +WcboMomhRJ97Wm5Vn8M =orQq -----END PGP SIGNATURE----- --ibkdQuaLo4iB7j34Ll0K30K4it8V0osip-- From owner-svn-src-head@freebsd.org Mon Aug 1 05:51:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B7EEBAB974; Mon, 1 Aug 2016 05:51:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 43F2C1486; Mon, 1 Aug 2016 05:51:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id A72EE427BA4; Mon, 1 Aug 2016 15:51:40 +1000 (AEST) Date: Mon, 1 Aug 2016 15:51:39 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Jilles Tjoelker , Alexey Dokuchaev , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r303586 - head/bin/sh In-Reply-To: Message-ID: <20160801154048.K884@besplex.bde.org> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> <20160731134316.GB85936@FreeBSD.org> <20160731201614.GA58505@stack.nl> 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=6I5d2MoRAAAA:8 a=9xrvncSL6j3s53b_JZkA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 05:51:45 -0000 On Sun, 31 Jul 2016, Warner Losh wrote: > On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker wrote: >> On Sun, Jul 31, 2016 at 01:43:16PM +0000, Alexey Dokuchaev wrote: >>> On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: >>>> New Revision: 303586 >>>> URL: https://svnweb.freebsd.org/changeset/base/303586 >> >>>> Log: >>>> sh: Fix a clang warning. >> >>>> Submitted by: bdrewery >> >>>> Modified: >>>> head/bin/sh/expand.c >> >>>> Modified: head/bin/sh/expand.c >>>> ============================================================================== >>>> --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) >>>> +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) >>>> @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in >>>> if (--in.nleft < 0) { >>>> if (in.fd < 0) >>>> break; >>>> - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); >>>> + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) >>>> + ; >> >>> `continue;' would be even better; some tools might barf at stray semicolon. >> >> Both continue; and ; (the latter with and without comment) occur in the >> source tree many times. I don't really like a continue that does nothing >> because it is at the end of a loop, so I prefer to make this whitespace >> change only (there are two more instances in bin/sh). I think a sole >> semicolon on a line is conspicuous enough that nothing additional is >> required. > > For humans, yes. For picky tools that warn about strange constructs, no. > Clang may be happy, but there's many other tools that expect you to declare > an 'empty' while loop with continue. This tradition has dated back to > at least the > late 80's... Buggy tools. I thought that programmers used the stand-alone semicolon since that is shorter and clearer. The stand-alone semicolon is bad if it is misformatted. 'while(foo());' is shorter and unclearer. A C parser must ignore whitespace, so you need a tool like indent that sort of understands whitespace to disallow while(foo()); but accept 'while (foo())\n\t;'. It is not far from full indent(1) and insisting on the correct number of \t's before the semicolon. Bruce From owner-svn-src-head@freebsd.org Mon Aug 1 06:01:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCA8CBAC80D for ; Mon, 1 Aug 2016 06:01:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93FD81B7F for ; Mon, 1 Aug 2016 06:01:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id q83so178297985iod.1 for ; Sun, 31 Jul 2016 23:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=HDJdJ67Gxxd3WDj35/3pjqc5U0plNcP4Hkl0zKFbXOY=; b=g+vkepOHDE5ZbFRneotnA1OWXjzjPtVF4lH3i6eHPE7NVr7cgDifx+JOkDIIzhgsoz SC3eVHrv51Z/CWqFlTpJ9XRvZoybWiGQPstBiCxA8LKNXi217TVlVmN1Ko7/sebUaiFM T2FBWvORn7W+HbcK3aWtRhhpsOJC515ZuS3tymcwAoWXLnVUu9L25zpq5MobBzkbML/4 B3zEeVek79lIQu0CC+P6H4th2LgZ7MKvjLE/3BEK7MbEYGlbkiAWK0Rsmt2cmm1i3KTy kFUQCG524nya8ltm66oyuNVVsKMhad4d4Y4h1qmRK14duImRjU8zWcJJVQKzzT2cPHSe RhrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=HDJdJ67Gxxd3WDj35/3pjqc5U0plNcP4Hkl0zKFbXOY=; b=IlQD8sdyWgtXODMvrdoKLrodzDC+lCQtvlCUFzeZXG18b56sdI5U5WWq++F8avse++ cO94Q+dDYjpjUFHFE63z7a+f1bsQR1utxKVssLqVlbQVo++mcpIwiCOUalMAIEXSa217 nYlzhycVSYSAPZq49btx4iQUVI7B0TCf+GLkC7EqTn0cLJvxFbcccvGeQI71fgwUWr16 4dEyAsZK2SoA4KRAtKs3A1TjD4IQ2CKBq+0jydSz+j+k7gjxYJ+wnZTGnuuur2hwhGuL EicNlVhd8cYhWYsnhf0zU31ZQi5HIggfwNfK/iAdNrLRX7EI3yx2etqnsQppHsz9lyGr T8oA== X-Gm-Message-State: AEkoousIP2YYi+pa88eTmg7WiPme960wyUTWe6uR9DCINo64ju3v5BHJdiE9Pn7ZY3N18F8IhrG5mJLV6RrQIQ== X-Received: by 10.107.133.93 with SMTP id h90mr53799073iod.16.1470031311875; Sun, 31 Jul 2016 23:01:51 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.137.131 with HTTP; Sun, 31 Jul 2016 23:01:51 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <20160801154048.K884@besplex.bde.org> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> <20160731134316.GB85936@FreeBSD.org> <20160731201614.GA58505@stack.nl> <20160801154048.K884@besplex.bde.org> From: Warner Losh Date: Mon, 1 Aug 2016 00:01:51 -0600 X-Google-Sender-Auth: hcoIaCCw562Jg0CA4I__HdOYlio Message-ID: Subject: Re: svn commit: r303586 - head/bin/sh To: Bruce Evans Cc: Jilles Tjoelker , Alexey Dokuchaev , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 06:01:52 -0000 On Sun, Jul 31, 2016 at 11:51 PM, Bruce Evans wrote: > On Sun, 31 Jul 2016, Warner Losh wrote: > >> On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker wrote: >>> >>> On Sun, Jul 31, 2016 at 01:43:16PM +0000, Alexey Dokuchaev wrote: >>>> >>>> On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: >>>>> >>>>> New Revision: 303586 >>>>> URL: https://svnweb.freebsd.org/changeset/base/303586 >>> >>> >>>>> Log: >>>>> sh: Fix a clang warning. >>> >>> >>>>> Submitted by: bdrewery >>> >>> >>>>> Modified: >>>>> head/bin/sh/expand.c >>> >>> >>>>> Modified: head/bin/sh/expand.c >>>>> >>>>> ============================================================================== >>>>> --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) >>>>> +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) >>>>> @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in >>>>> if (--in.nleft < 0) { >>>>> if (in.fd < 0) >>>>> break; >>>>> - while ((i = read(in.fd, buf, sizeof buf)) < 0 && >>>>> errno == EINTR); >>>>> + while ((i = read(in.fd, buf, sizeof buf)) < 0 && >>>>> errno == EINTR) >>>>> + ; >>> >>> >>>> `continue;' would be even better; some tools might barf at stray >>>> semicolon. >>> >>> >>> Both continue; and ; (the latter with and without comment) occur in the >>> source tree many times. I don't really like a continue that does nothing >>> because it is at the end of a loop, so I prefer to make this whitespace >>> change only (there are two more instances in bin/sh). I think a sole >>> semicolon on a line is conspicuous enough that nothing additional is >>> required. >> >> >> For humans, yes. For picky tools that warn about strange constructs, no. >> Clang may be happy, but there's many other tools that expect you to >> declare >> an 'empty' while loop with continue. This tradition has dated back to >> at least the >> late 80's... > > > Buggy tools. I thought that programmers used the stand-alone semicolon > since that is shorter and clearer. It cannot be on the same line though. > The stand-alone semicolon is bad if it is misformatted. 'while(foo());' > is shorter and unclearer. A C parser must ignore whitespace, so you > need a tool like indent that sort of understands whitespace to disallow > while(foo()); but accept 'while (foo())\n\t;'. It is not far from full > indent(1) and insisting on the correct number of \t's before the semicolon. A C parser doesn't completely ignore the whitespace if it doesn't warn in both cases... Warner From owner-svn-src-head@freebsd.org Mon Aug 1 06:08:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E35EBAC406; Mon, 1 Aug 2016 06:08:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id DB4C11EDC; Mon, 1 Aug 2016 06:08:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 4482D1042AD1; Mon, 1 Aug 2016 16:08:06 +1000 (AEST) Date: Mon, 1 Aug 2016 16:08:05 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Xin Li cc: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, d@delphij.net Subject: Re: svn commit: r303600 - head/usr.bin/indent In-Reply-To: <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> Message-ID: <20160801155148.I884@besplex.bde.org> References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=NEAV23lmAAAA:8 a=6I5d2MoRAAAA:8 a=l6pahSjwQ7Of7pMpP0sA:9 a=CjuIK1q_8ugA:10 a=Bn2pgwyD2vrAyMmN8A2t:22 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 06:08:13 -0000 On Sun, 31 Jul 2016, Xin Li wrote: > On 7/31/16 14:36, Pedro F. Giffuni wrote: >> >> Log: >> indent(1): replace function call to bzero with memset. >> >> Reference: >> https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235 >> >> Differential Revision: https://reviews.freebsd.org/D6966 (Partial) >> Submitted by: Piotr Stefaniak >> >> Modified: >> head/usr.bin/indent/io.c >> >> Modified: head/usr.bin/indent/io.c >> ============================================================================== >> --- head/usr.bin/indent/io.c Sun Jul 31 21:29:10 2016 (r303599) >> +++ head/usr.bin/indent/io.c Sun Jul 31 21:36:40 2016 (r303600) >> @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * >> const char *s = s0; >> int sizedelta = 0; >> >> - bzero(f, sizeof *f); >> + memset(f, 0, sizeof(struct fstate)); > ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone > than sizeof(*f) IMHO. I also prefer bzero(). Removal of the space after sizeof is another regression. KNF disallows the space, but indent's style is very far from KNF. It isn't clear if indent's style is to require the space, since old versions of indent never used sizeof(typename), and 'sizeof object' requires the space. Regressions started in r93440 with sizeof(object) in an nitems() expansion. The style of this is very different from an nitems() expansion in r1590. There was 1 more sizeof(object) and 1 sizeof(int). This is the first sizeof(typename) where 'sizeof object' cannot be used for technical reasons. KNF also requires parentheses for sizeof(object). Then the space is unnecessary and disallowed. Bruce From owner-svn-src-head@freebsd.org Mon Aug 1 10:36:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7770ABAB2D3; Mon, 1 Aug 2016 10:36:59 +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 486C81335; Mon, 1 Aug 2016 10:36:59 +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 u71AawRA048160; Mon, 1 Aug 2016 10:36:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71AawdI048159; Mon, 1 Aug 2016 10:36:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201608011036.u71AawdI048159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 1 Aug 2016 10:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303610 - head/sys/arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 10:36:59 -0000 Author: andrew Date: Mon Aug 1 10:36:58 2016 New Revision: 303610 URL: https://svnweb.freebsd.org/changeset/base/303610 Log: Add the fields for the PAR_EL1 register. This is used when performing an address lookup with the AT instructions. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Mon Aug 1 06:59:35 2016 (r303609) +++ head/sys/arm64/include/armreg.h Mon Aug 1 10:36:58 2016 (r303610) @@ -312,6 +312,27 @@ #define MAIR_ATTR_MASK(idx) (0xff << ((n)* 8)) #define MAIR_ATTR(attr, idx) ((attr) << ((idx) * 8)) +/* PAR_EL1 - Physical Address Register */ +#define PAR_F_SHIFT 0 +#define PAR_F (0x1 << PAR_F_SHIFT) +#define PAR_SUCCESS(x) (((x) & PAR_F) == 0) +/* When PAR_F == 0 (success) */ +#define PAR_SH_SHIFT 7 +#define PAR_SH_MASK (0x3 << PAR_SH_SHIFT) +#define PAR_NS_SHIFT 9 +#define PAR_NS_MASK (0x3 << PAR_NS_SHIFT) +#define PAR_PA_SHIFT 12 +#define PAR_PA_MASK 0x0000fffffffff000 +#define PAR_ATTR_SHIFT 56 +#define PAR_ATTR_MASK (0xff << PAR_ATTR_SHIFT) +/* When PAR_F == 1 (aborted) */ +#define PAR_FST_SHIFT 1 +#define PAR_FST_MASK (0x3f << PAR_FST_SHIFT) +#define PAR_PTW_SHIFT 8 +#define PAR_PTW_MASK (0x1 << PAR_PTW_SHIFT) +#define PAR_S_SHIFT 9 +#define PAR_S_MASK (0x1 << PAR_S_SHIFT) + /* SCTLR_EL1 - System Control Register */ #define SCTLR_RES0 0xc8222400 /* Reserved, write 0 */ #define SCTLR_RES1 0x30d00800 /* Reserved, write 1 */ From owner-svn-src-head@freebsd.org Mon Aug 1 11:34:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04F82BA3615; Mon, 1 Aug 2016 11:34:14 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6FD31EC2; Mon, 1 Aug 2016 11:34:13 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71BYDIP070348; Mon, 1 Aug 2016 11:34:13 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71BYD22070346; Mon, 1 Aug 2016 11:34:13 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201608011134.u71BYD22070346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Mon, 1 Aug 2016 11:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303611 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 11:34:14 -0000 Author: julian Date: Mon Aug 1 11:34:12 2016 New Revision: 303611 URL: https://svnweb.freebsd.org/changeset/base/303611 Log: slite style changes. There is an incoming patch that rewrites a lot of this module and I want to get the style and whitespace changes in a separate commit (or maybe more). PR: 206185 Submitted by: Dmitry Vagin MFC after: 1 month Modified: head/sys/netgraph/ng_patch.c head/sys/netgraph/ng_patch.h Modified: head/sys/netgraph/ng_patch.c ============================================================================== --- head/sys/netgraph/ng_patch.c Mon Aug 1 10:36:58 2016 (r303610) +++ head/sys/netgraph/ng_patch.c Mon Aug 1 11:34:12 2016 (r303611) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2010 by Maxim Ignatenko + * Copyright (c) 2010 Maxim Ignatenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,11 +50,12 @@ static int ng_patch_config_getlen(const struct ng_parse_type *type, const u_char *start, const u_char *buf) { - const struct ng_patch_config *p; + const struct ng_patch_config *conf; - p = (const struct ng_patch_config *)(buf - + conf = (const struct ng_patch_config *)(buf - offsetof(struct ng_patch_config, ops)); - return (p->count); + + return (conf->count); } static const struct ng_parse_struct_field ng_patch_op_type_fields[] @@ -64,13 +65,13 @@ static const struct ng_parse_type ng_pat &ng_patch_op_type_fields }; -static const struct ng_parse_array_info ng_patch_confarr_info = { +static const struct ng_parse_array_info ng_patch_ops_array_info = { &ng_patch_op_type, &ng_patch_config_getlen }; -static const struct ng_parse_type ng_patch_confarr_type = { +static const struct ng_parse_type ng_patch_ops_array_type = { &ng_parse_array_type, - &ng_patch_confarr_info + &ng_patch_ops_array_info }; static const struct ng_parse_struct_field ng_patch_config_type_fields[] @@ -137,6 +138,7 @@ static struct ng_type typestruct = { .disconnect = ng_patch_disconnect, .cmdlist = ng_patch_cmdlist, }; + NETGRAPH_INIT(patch, &typestruct); union patch_val { @@ -146,6 +148,7 @@ union patch_val { uint64_t v8; }; +/* private data */ struct ng_patch_priv { hook_p in; hook_p out; Modified: head/sys/netgraph/ng_patch.h ============================================================================== --- head/sys/netgraph/ng_patch.h Mon Aug 1 10:36:58 2016 (r303610) +++ head/sys/netgraph/ng_patch.h Mon Aug 1 11:34:12 2016 (r303611) @@ -57,7 +57,7 @@ enum { NG_PATCH_MODE_DIV = 5, NG_PATCH_MODE_NEG = 6, NG_PATCH_MODE_AND = 7, - NG_PATCH_MODE_OR = 8, + NG_PATCH_MODE_OR = 8, NG_PATCH_MODE_XOR = 9, NG_PATCH_MODE_SHL = 10, NG_PATCH_MODE_SHR = 11 @@ -66,16 +66,16 @@ enum { struct ng_patch_op { uint64_t value; uint32_t offset; - uint16_t length; /* 1,2,4 or 8 (bytes) */ + uint16_t length; /* 1, 2, 4 or 8 (bytes) */ uint16_t mode; }; -#define NG_PATCH_OP_TYPE_INFO { \ - { "value", &ng_parse_uint64_type }, \ - { "offset", &ng_parse_uint32_type }, \ - { "length", &ng_parse_uint16_type }, \ - { "mode", &ng_parse_uint16_type }, \ - { NULL } \ +#define NG_PATCH_OP_TYPE_INFO { \ + { "value", &ng_parse_uint64_type }, \ + { "offset", &ng_parse_uint32_type }, \ + { "length", &ng_parse_uint16_type }, \ + { "mode", &ng_parse_uint16_type }, \ + { NULL } \ } struct ng_patch_config { @@ -84,11 +84,11 @@ struct ng_patch_config { struct ng_patch_op ops[]; }; -#define NG_PATCH_CONFIG_TYPE_INFO { \ - { "count", &ng_parse_uint32_type }, \ - { "csum_flags", &ng_parse_uint32_type }, \ - { "ops", &ng_patch_confarr_type }, \ - { NULL } \ +#define NG_PATCH_CONFIG_TYPE_INFO { \ + { "count", &ng_parse_uint32_type }, \ + { "csum_flags", &ng_parse_uint64_type }, \ + { "ops", &ng_patch_ops_array_type }, \ + { NULL } \ } struct ng_patch_stats { @@ -97,11 +97,11 @@ struct ng_patch_stats { uint64_t dropped; }; -#define NG_PATCH_STATS_TYPE_INFO { \ - { "received", &ng_parse_uint64_type }, \ - { "patched", &ng_parse_uint64_type }, \ - { "dropped", &ng_parse_uint64_type }, \ - { NULL } \ +#define NG_PATCH_STATS_TYPE_INFO { \ + { "Received", &ng_parse_uint64_type }, \ + { "Patched", &ng_parse_uint64_type }, \ + { "Dropped", &ng_parse_uint64_type }, \ + { NULL } \ } #endif /* _NETGRAPH_NG_PATCH_H_ */ From owner-svn-src-head@freebsd.org Mon Aug 1 12:09:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E21DCBAA7BC; Mon, 1 Aug 2016 12:09:05 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF8EC131E; Mon, 1 Aug 2016 12:09:05 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71C95CY081800; Mon, 1 Aug 2016 12:09:05 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71C944j081797; Mon, 1 Aug 2016 12:09:04 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201608011209.u71C944j081797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Mon, 1 Aug 2016 12:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303612 - in head/sys: modules/netgraph/checksum netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 12:09:06 -0000 Author: julian Date: Mon Aug 1 12:09:04 2016 New Revision: 303612 URL: https://svnweb.freebsd.org/changeset/base/303612 Log: netgraph module for reconstructing checksums PR: 206108 Submitted by: Dmitry Vagin daemon.hammer@ya.ru MFC after: 1 month Added: head/sys/modules/netgraph/checksum/ head/sys/modules/netgraph/checksum/Makefile (contents, props changed) head/sys/netgraph/ng_checksum.c (contents, props changed) head/sys/netgraph/ng_checksum.h (contents, props changed) Added: head/sys/modules/netgraph/checksum/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/netgraph/checksum/Makefile Mon Aug 1 12:09:04 2016 (r303612) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +.include + +KMOD= ng_checksum +SRCS= ng_checksum.c opt_inet.h opt_inet6.h + +#.if !defined(KERNBUILDDIR) +# +#.if ${MK_INET_SUPPORT} != "no" +#opt_inet.h: +# echo "#define INET 1" > ${.TARGET} +#.endif +#.if ${MK_INET6_SUPPORT} != "no" +#opt_inet6.h: +# echo "#define INET6 1" > ${.TARGET} +#.endif +#.endif + +.include Added: head/sys/netgraph/ng_checksum.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netgraph/ng_checksum.c Mon Aug 1 12:09:04 2016 (r303612) @@ -0,0 +1,729 @@ +/*- + * Copyright (c) 2015 Dmitry Vagin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* private data */ +struct ng_checksum_priv { + hook_p in; + hook_p out; + uint8_t dlt; /* DLT_XXX from bpf.h */ + struct ng_checksum_config *conf; + struct ng_checksum_stats stats; +}; + +typedef struct ng_checksum_priv *priv_p; + +/* Netgraph methods */ +static ng_constructor_t ng_checksum_constructor; +static ng_rcvmsg_t ng_checksum_rcvmsg; +static ng_shutdown_t ng_checksum_shutdown; +static ng_newhook_t ng_checksum_newhook; +static ng_rcvdata_t ng_checksum_rcvdata; +static ng_disconnect_t ng_checksum_disconnect; + +#define ERROUT(x) { error = (x); goto done; } + +static const struct ng_parse_struct_field ng_checksum_config_type_fields[] + = NG_CHECKSUM_CONFIG_TYPE; +static const struct ng_parse_type ng_checksum_config_type = { + &ng_parse_struct_type, + &ng_checksum_config_type_fields +}; + +static const struct ng_parse_struct_field ng_checksum_stats_fields[] + = NG_CHECKSUM_STATS_TYPE; +static const struct ng_parse_type ng_checksum_stats_type = { + &ng_parse_struct_type, + &ng_checksum_stats_fields +}; + +static const struct ng_cmdlist ng_checksum_cmdlist[] = { + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GETDLT, + "getdlt", + NULL, + &ng_parse_uint8_type + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_SETDLT, + "setdlt", + &ng_parse_uint8_type, + NULL + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GETCONFIG, + "getconfig", + NULL, + &ng_checksum_config_type + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_SETCONFIG, + "setconfig", + &ng_checksum_config_type, + NULL + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GET_STATS, + "getstats", + NULL, + &ng_checksum_stats_type + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_CLR_STATS, + "clrstats", + NULL, + NULL + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GETCLR_STATS, + "getclrstats", + NULL, + &ng_checksum_stats_type + }, + { 0 } +}; + +static struct ng_type typestruct = { + .version = NG_ABI_VERSION, + .name = NG_CHECKSUM_NODE_TYPE, + .constructor = ng_checksum_constructor, + .rcvmsg = ng_checksum_rcvmsg, + .shutdown = ng_checksum_shutdown, + .newhook = ng_checksum_newhook, + .rcvdata = ng_checksum_rcvdata, + .disconnect = ng_checksum_disconnect, + .cmdlist = ng_checksum_cmdlist, +}; + +NETGRAPH_INIT(checksum, &typestruct); + +static int +ng_checksum_constructor(node_p node) +{ + priv_p priv; + + priv = malloc(sizeof(*priv), M_NETGRAPH, M_WAITOK|M_ZERO); + priv->dlt = DLT_RAW; + + NG_NODE_SET_PRIVATE(node, priv); + + return (0); +} + +static int +ng_checksum_newhook(node_p node, hook_p hook, const char *name) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + + if (strncmp(name, NG_CHECKSUM_HOOK_IN, strlen(NG_CHECKSUM_HOOK_IN)) == 0) { + priv->in = hook; + } else if (strncmp(name, NG_CHECKSUM_HOOK_OUT, strlen(NG_CHECKSUM_HOOK_OUT)) == 0) { + priv->out = hook; + } else + return (EINVAL); + + return (0); +} + +static int +ng_checksum_rcvmsg(node_p node, item_p item, hook_p lasthook) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + struct ng_checksum_config *conf, *newconf; + struct ng_mesg *msg; + struct ng_mesg *resp = NULL; + int error = 0; + + NGI_GET_MSG(item, msg); + + if (msg->header.typecookie != NGM_CHECKSUM_COOKIE) + ERROUT(EINVAL); + + switch (msg->header.cmd) + { + case NGM_CHECKSUM_GETDLT: + NG_MKRESPONSE(resp, msg, sizeof(uint8_t), M_WAITOK); + + if (resp == NULL) + ERROUT(ENOMEM); + + *((uint8_t *) resp->data) = priv->dlt; + + break; + + case NGM_CHECKSUM_SETDLT: + if (msg->header.arglen != sizeof(uint8_t)) + ERROUT(EINVAL); + + switch (*(uint8_t *) msg->data) + { + case DLT_EN10MB: + case DLT_RAW: + priv->dlt = *(uint8_t *) msg->data; + break; + + default: + ERROUT(EINVAL); + } + + break; + + case NGM_CHECKSUM_GETCONFIG: + if (priv->conf == NULL) + ERROUT(0); + + NG_MKRESPONSE(resp, msg, sizeof(struct ng_checksum_config), M_WAITOK); + + if (resp == NULL) + ERROUT(ENOMEM); + + bcopy(priv->conf, resp->data, sizeof(struct ng_checksum_config)); + + break; + + case NGM_CHECKSUM_SETCONFIG: + conf = (struct ng_checksum_config *) msg->data; + + if (msg->header.arglen != sizeof(struct ng_checksum_config)) + ERROUT(EINVAL); + + conf->csum_flags &= NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6; + conf->csum_offload &= NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6; + + newconf = malloc(sizeof(struct ng_checksum_config), M_NETGRAPH, M_WAITOK|M_ZERO); + + bcopy(conf, newconf, sizeof(struct ng_checksum_config)); + + if (priv->conf) + free(priv->conf, M_NETGRAPH); + + priv->conf = newconf; + + break; + + case NGM_CHECKSUM_GET_STATS: + case NGM_CHECKSUM_CLR_STATS: + case NGM_CHECKSUM_GETCLR_STATS: + if (msg->header.cmd != NGM_CHECKSUM_CLR_STATS) { + NG_MKRESPONSE(resp, msg, sizeof(struct ng_checksum_stats), M_WAITOK); + + if (resp == NULL) + ERROUT(ENOMEM); + + bcopy(&(priv->stats), resp->data, sizeof(struct ng_checksum_stats)); + } + + if (msg->header.cmd != NGM_CHECKSUM_GET_STATS) + bzero(&(priv->stats), sizeof(struct ng_checksum_stats)); + + break; + + default: + ERROUT(EINVAL); + } + +done: + NG_RESPOND_MSG(error, node, item, resp); + NG_FREE_MSG(msg); + + return (error); +} + +#define PULLUP_CHECK(mbuf, length) do { \ + pullup_len += length; \ + if (((mbuf)->m_pkthdr.len < pullup_len) || \ + (pullup_len > MHLEN)) { \ + return (EINVAL); \ + } \ + if ((mbuf)->m_len < pullup_len && \ + (((mbuf) = m_pullup((mbuf), pullup_len)) == NULL)) { \ + return (ENOBUFS); \ + } \ +} while (0) + +#ifdef INET +static int +checksum_ipv4(priv_p priv, struct mbuf *m, int l3_offset) +{ + struct ip *ip4; + int pullup_len; + int hlen, plen; + int processed = 0; + + pullup_len = l3_offset; + + PULLUP_CHECK(m, sizeof(struct ip)); + ip4 = (struct ip *) mtodo(m, l3_offset); + + if (ip4->ip_v != IPVERSION) + return (EOPNOTSUPP); + + hlen = ip4->ip_hl << 2; + plen = ntohs(ip4->ip_len); + + if (hlen < sizeof(struct ip) || m->m_pkthdr.len < l3_offset + plen) + return (EINVAL); + + if (m->m_pkthdr.csum_flags & CSUM_IP) { + ip4->ip_sum = 0; + + if ((priv->conf->csum_offload & CSUM_IP) == 0) { + if (hlen == sizeof(struct ip)) + ip4->ip_sum = in_cksum_hdr(ip4); + else + ip4->ip_sum = in_cksum_skip(m, l3_offset + hlen, l3_offset); + + m->m_pkthdr.csum_flags &= ~CSUM_IP; + } + + processed = 1; + } + + pullup_len = l3_offset + hlen; + + /* We can not calculate a checksum fragmented packets */ + if (ip4->ip_off & htons(IP_MF|IP_OFFMASK)) { + m->m_pkthdr.csum_flags &= ~(CSUM_TCP|CSUM_UDP); + return (0); + } + + switch (ip4->ip_p) + { + case IPPROTO_TCP: + if (m->m_pkthdr.csum_flags & CSUM_TCP) { + struct tcphdr *th; + + PULLUP_CHECK(m, sizeof(struct tcphdr)); + th = (struct tcphdr *) mtodo(m, l3_offset + hlen); + + th->th_sum = in_pseudo(ip4->ip_src.s_addr, + ip4->ip_dst.s_addr, htons(ip4->ip_p + plen - hlen)); + + if ((priv->conf->csum_offload & CSUM_TCP) == 0) { + th->th_sum = in_cksum_skip(m, l3_offset + plen, l3_offset + hlen); + m->m_pkthdr.csum_flags &= ~CSUM_TCP; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_UDP; + break; + + case IPPROTO_UDP: + if (m->m_pkthdr.csum_flags & CSUM_UDP) { + struct udphdr *uh; + + PULLUP_CHECK(m, sizeof(struct udphdr)); + uh = (struct udphdr *) mtodo(m, l3_offset + hlen); + + uh->uh_sum = in_pseudo(ip4->ip_src.s_addr, + ip4->ip_dst.s_addr, htons(ip4->ip_p + plen - hlen)); + + if ((priv->conf->csum_offload & CSUM_UDP) == 0) { + uh->uh_sum = in_cksum_skip(m, + l3_offset + plen, l3_offset + hlen); + + if (uh->uh_sum == 0) + uh->uh_sum = 0xffff; + + m->m_pkthdr.csum_flags &= ~CSUM_UDP; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_TCP; + break; + + default: + m->m_pkthdr.csum_flags &= ~(CSUM_TCP|CSUM_UDP); + break; + } + + m->m_pkthdr.csum_flags &= ~NG_CHECKSUM_CSUM_IPV6; + + if (processed) + priv->stats.processed++; + + return (0); +} +#endif /* INET */ + +#ifdef INET6 +static int +checksum_ipv6(priv_p priv, struct mbuf *m, int l3_offset) +{ + struct ip6_hdr *ip6; + struct ip6_ext *ip6e = NULL; + int pullup_len; + int hlen, plen; + int nxt; + int processed = 0; + + pullup_len = l3_offset; + + PULLUP_CHECK(m, sizeof(struct ip6_hdr)); + ip6 = (struct ip6_hdr *) mtodo(m, l3_offset); + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) + return (EOPNOTSUPP); + + hlen = sizeof(struct ip6_hdr); + plen = ntohs(ip6->ip6_plen) + hlen; + + if (m->m_pkthdr.len < l3_offset + plen) + return (EINVAL); + + nxt = ip6->ip6_nxt; + + for (;;) { + switch (nxt) + { + case IPPROTO_DSTOPTS: + case IPPROTO_HOPOPTS: + case IPPROTO_ROUTING: + PULLUP_CHECK(m, sizeof(struct ip6_ext)); + ip6e = (struct ip6_ext *) mtodo(m, l3_offset + hlen); + nxt = ip6e->ip6e_nxt; + hlen += (ip6e->ip6e_len + 1) << 3; + pullup_len = l3_offset + hlen; + break; + + case IPPROTO_AH: + PULLUP_CHECK(m, sizeof(struct ip6_ext)); + ip6e = (struct ip6_ext *) mtodo(m, l3_offset + hlen); + nxt = ip6e->ip6e_nxt; + hlen += (ip6e->ip6e_len + 2) << 2; + pullup_len = l3_offset + hlen; + break; + + case IPPROTO_FRAGMENT: + /* We can not calculate a checksum fragmented packets */ + m->m_pkthdr.csum_flags &= ~(CSUM_TCP_IPV6|CSUM_UDP_IPV6); + return (0); + + default: + goto loopend; + } + + if (nxt == 0) + return (EINVAL); + } + +loopend: + + switch (nxt) + { + case IPPROTO_TCP: + if (m->m_pkthdr.csum_flags & CSUM_TCP_IPV6) { + struct tcphdr *th; + + PULLUP_CHECK(m, sizeof(struct tcphdr)); + th = (struct tcphdr *) mtodo(m, l3_offset + hlen); + + th->th_sum = in6_cksum_pseudo(ip6, plen - hlen, nxt, 0); + + if ((priv->conf->csum_offload & CSUM_TCP_IPV6) == 0) { + th->th_sum = in_cksum_skip(m, l3_offset + plen, l3_offset + hlen); + m->m_pkthdr.csum_flags &= ~CSUM_TCP_IPV6; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_UDP_IPV6; + break; + + case IPPROTO_UDP: + if (m->m_pkthdr.csum_flags & CSUM_UDP_IPV6) { + struct udphdr *uh; + + PULLUP_CHECK(m, sizeof(struct udphdr)); + uh = (struct udphdr *) mtodo(m, l3_offset + hlen); + + uh->uh_sum = in6_cksum_pseudo(ip6, plen - hlen, nxt, 0); + + if ((priv->conf->csum_offload & CSUM_UDP_IPV6) == 0) { + uh->uh_sum = in_cksum_skip(m, + l3_offset + plen, l3_offset + hlen); + + if (uh->uh_sum == 0) + uh->uh_sum = 0xffff; + + m->m_pkthdr.csum_flags &= ~CSUM_UDP_IPV6; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_TCP_IPV6; + break; + + default: + m->m_pkthdr.csum_flags &= ~(CSUM_TCP_IPV6|CSUM_UDP_IPV6); + break; + } + + m->m_pkthdr.csum_flags &= ~NG_CHECKSUM_CSUM_IPV4; + + if (processed) + priv->stats.processed++; + + return (0); +} +#endif /* INET6 */ + +#undef PULLUP_CHECK + +static int +ng_checksum_rcvdata(hook_p hook, item_p item) +{ + const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); + struct mbuf *m; + hook_p out; + int error = 0; + + priv->stats.received++; + + NGI_GET_M(item, m); + +#define PULLUP_CHECK(mbuf, length) do { \ + pullup_len += length; \ + if (((mbuf)->m_pkthdr.len < pullup_len) || \ + (pullup_len > MHLEN)) { \ + error = EINVAL; \ + goto bypass; \ + } \ + if ((mbuf)->m_len < pullup_len && \ + (((mbuf) = m_pullup((mbuf), pullup_len)) == NULL)) { \ + error = ENOBUFS; \ + goto drop; \ + } \ +} while (0) + + if (!(priv->conf && hook == priv->in && m && (m->m_flags & M_PKTHDR))) + goto bypass; + + m->m_pkthdr.csum_flags |= priv->conf->csum_flags; + + if (m->m_pkthdr.csum_flags & (NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6)) + { + struct ether_header *eh; + struct ng_checksum_vlan_header *vh; + int pullup_len = 0; + uint16_t etype; + + m = m_unshare(m, M_NOWAIT); + + if (m == NULL) + ERROUT(ENOMEM); + + switch (priv->dlt) + { + case DLT_EN10MB: + PULLUP_CHECK(m, sizeof(struct ether_header)); + eh = mtod(m, struct ether_header *); + etype = ntohs(eh->ether_type); + + for (;;) { /* QinQ support */ + switch (etype) + { + case 0x8100: + case 0x88A8: + case 0x9100: + PULLUP_CHECK(m, sizeof(struct ng_checksum_vlan_header)); + vh = (struct ng_checksum_vlan_header *) mtodo(m, + pullup_len - sizeof(struct ng_checksum_vlan_header)); + etype = ntohs(vh->etype); + break; + + default: + goto loopend; + } + } +loopend: +#ifdef INET + if (etype == ETHERTYPE_IP && + (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV4)) { + error = checksum_ipv4(priv, m, pullup_len); + if (error == ENOBUFS) + goto drop; + } else +#endif +#ifdef INET6 + if (etype == ETHERTYPE_IPV6 && + (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV6)) { + error = checksum_ipv6(priv, m, pullup_len); + if (error == ENOBUFS) + goto drop; + } else +#endif + { + m->m_pkthdr.csum_flags &= + ~(NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6); + } + + break; + + case DLT_RAW: +#ifdef INET + if (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV4) + { + error = checksum_ipv4(priv, m, pullup_len); + + if (error == 0) + goto bypass; + else if (error == ENOBUFS) + goto drop; + } +#endif +#ifdef INET6 + if (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV6) + { + error = checksum_ipv6(priv, m, pullup_len); + + if (error == 0) + goto bypass; + else if (error == ENOBUFS) + goto drop; + } +#endif + if (error) + m->m_pkthdr.csum_flags &= + ~(NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6); + + break; + + default: + ERROUT(EINVAL); + } + } + +#undef PULLUP_CHECK + +bypass: + out = NULL; + + if (hook == priv->in) { + /* return frames on 'in' hook if 'out' not connected */ + out = priv->out ? priv->out : priv->in; + } else if (hook == priv->out && priv->in) { + /* pass frames on 'out' hook if 'in' connected */ + out = priv->in; + } + + if (out == NULL) + ERROUT(0); + + NG_FWD_NEW_DATA(error, item, out, m); + + return (error); + +done: +drop: + NG_FREE_ITEM(item); + NG_FREE_M(m); + + priv->stats.dropped++; + + return (error); +} + +static int +ng_checksum_shutdown(node_p node) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + + NG_NODE_SET_PRIVATE(node, NULL); + NG_NODE_UNREF(node); + + if (priv->conf) + free(priv->conf, M_NETGRAPH); + + free(priv, M_NETGRAPH); + + return (0); +} + +static int +ng_checksum_disconnect(hook_p hook) +{ + priv_p priv; + + priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); + + if (hook == priv->in) + priv->in = NULL; + + if (hook == priv->out) + priv->out = NULL; + + if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0 && + NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) /* already shutting down? */ + ng_rmnode_self(NG_HOOK_NODE(hook)); + + return (0); +} Added: head/sys/netgraph/ng_checksum.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netgraph/ng_checksum.h Mon Aug 1 12:09:04 2016 (r303612) @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2015 Dmitry Vagin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NETGRAPH_NG_CHECKSUM_H_ +#define _NETGRAPH_NG_CHECKSUM_H_ + +/* Node type name. */ +#define NG_CHECKSUM_NODE_TYPE "checksum" + +/* Node type cookie. */ +#define NGM_CHECKSUM_COOKIE 439419912 + +/* Hook names */ +#define NG_CHECKSUM_HOOK_IN "in" +#define NG_CHECKSUM_HOOK_OUT "out" + +/* Checksum flags */ +#define NG_CHECKSUM_CSUM_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP) +#define NG_CHECKSUM_CSUM_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6) + +/* Netgraph commands understood by this node type */ +enum { + NGM_CHECKSUM_GETDLT = 1, + NGM_CHECKSUM_SETDLT, + NGM_CHECKSUM_GETCONFIG, + NGM_CHECKSUM_SETCONFIG, + NGM_CHECKSUM_GETCLR_STATS, + NGM_CHECKSUM_GET_STATS, + NGM_CHECKSUM_CLR_STATS, +}; + +/* Parsing declarations */ + +#define NG_CHECKSUM_CONFIG_TYPE { \ + { "csum_flags", &ng_parse_uint64_type }, \ + { "csum_offload", &ng_parse_uint64_type }, \ + { NULL } \ +} + +#define NG_CHECKSUM_STATS_TYPE { \ + { "Received", &ng_parse_uint64_type }, \ + { "Processed", &ng_parse_uint64_type }, \ + { "Dropped", &ng_parse_uint64_type }, \ + { NULL } \ +} + +struct ng_checksum_config { + uint64_t csum_flags; + uint64_t csum_offload; +}; + +struct ng_checksum_stats { + uint64_t received; + uint64_t processed; + uint64_t dropped; +}; + +struct ng_checksum_vlan_header { + u_int16_t tag; + u_int16_t etype; +}; + +#endif /* _NETGRAPH_NG_CHECKSUM_H_ */ From owner-svn-src-head@freebsd.org Mon Aug 1 12:14:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09EFFBAA98B; Mon, 1 Aug 2016 12:14:23 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C35DE17A0; Mon, 1 Aug 2016 12:14:22 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71CEM9O085288; Mon, 1 Aug 2016 12:14:22 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71CEM7t085287; Mon, 1 Aug 2016 12:14:22 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201608011214.u71CEM7t085287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Mon, 1 Aug 2016 12:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303613 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 12:14:23 -0000 Author: julian Date: Mon Aug 1 12:14:21 2016 New Revision: 303613 URL: https://svnweb.freebsd.org/changeset/base/303613 Log: Man page for the new checksum netgraph module. PR: 206186 Submitted by: Dmitry Vagin MFC after: 1 month Added: head/share/man/man4/ng_checksum.4 (contents, props changed) Added: head/share/man/man4/ng_checksum.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ng_checksum.4 Mon Aug 1 12:14:21 2016 (r303613) @@ -0,0 +1,141 @@ +.\" Copyright (c) 2015 Dmitry Vagin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 29, 2015 +.Dt NG_CHECKSUM 4 +.Os +.Sh NAME +.Nm ng_checksum +.Nd IP checksum node type +.Sh SYNOPSIS +.In netgraph/ng_checksum.h +.Sh DESCRIPTION +The +.Nm checksum +node can calculate and prepare for calculation in hardware +IPv4 header, TCP, UDP checksum. +.Sh HOOKS +This node type has two hooks: +.Bl -tag -width ".Va out" +.It Va in +Packets received on this hook are processed according to settings specified +in config and then forwarded to +.Ar out +hook, if it exists and connected. Otherwise they are reflected back to the +.Ar in +hook. +.It Va out +Packets received on this hook are forwarded to +.Ar in +hook without any changes. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_CHECKSUM_SETDLT Pq Ic setdlt +Sets data link type on the +.Va in +hook. Currently, supported types are +.Cm DLT_RAW +(raw IP datagrams) and +.Cm DLT_EN10MB +(Ethernet). DLT_ definitions can be found in +.In net/bpf.h +header. Currently used values are +.Cm DLT_EN10MB += 1 and +.Cm DLT_RAW += 12. +.It Dv NGM_CHECKSUM_GETDLT Pq Ic getdlt +This control message obtains data link type on the +.Va in +hook. +.It Dv NGM_CHECKSUM_SETCONFIG Pq Ic setconfig +Sets node configuration. The following +.Vt "struct ng_checksum_config" +must be supplied as an argument: +.Bd -literal -offset 4n +struct ng_checksum_config { + uint64_t csum_flags; + uint64_t csum_offload; +}; +.Ed +.Pp +The +.Va csum_flags +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 +(other values are ignored) for instructing node need calculate the corresponding checksum. +.Pp +The +.Va csum_offload +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 +(other values are ignored) for instructing node what checksum can calculate in hardware. +.Pp +Also processed any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 sets before on mbuf. +.It Dv NGM_CHECKSUM_GETCONFIG Pq Ic getconfig +This control message obtains current node configuration, +returned as +.Vt "struct ng_checksum_config" . +.It Dv NGM_CHECKSUM_GET_STATS Pq Ic getstats +Returns node statistics as a +.Vt "struct ng_checksum_stats" . +.It Dv NGM_CHECKSUM_CLR_STATS Pq Ic clrstats +Clear node statistics. +.It Dv NGM_CHECKSUM_GETCLR_STATS Pq Ic getclrstats +This command is identical to +.Dv NGM_CHECKSUM_GET_STATS , +except that the statistics are also atomically cleared. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message, or when all hooks have been disconnected. +.Sh EXAMPLES +.Xr ngctl 8 +script: +.Bd -literal -offset 4n +/usr/sbin/ngctl -f- <<-SEQ + msg checksum-1: "setdlt 1" + ngctl msg checksum-1: "setconfig { csum_flags=0 csum_offload=6 }" +.Ed +.Pp +Set data link type to +.Cm DLT_EN10MB +(Ethernet), not set additional checksum flags, set hardware +can calculate CSUM_IP_UDP|CSUM_IP_TCP. +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ng_patch 4 , +.Xr ngctl 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 10.2 +and first submitted in +.Fx 12.0 . +.Sh AUTHORS +.An "Dmitry Vagin" Aq daemon.hammer@ya.ru . From owner-svn-src-head@freebsd.org Mon Aug 1 12:17:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FCC6BAAB49; Mon, 1 Aug 2016 12:17:46 +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 3DAC81A96; Mon, 1 Aug 2016 12:17:46 +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 u71CHjdb085507; Mon, 1 Aug 2016 12:17:45 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71CHjiB085503; Mon, 1 Aug 2016 12:17:45 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201608011217.u71CHjiB085503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 1 Aug 2016 12:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303614 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 12:17:46 -0000 Author: andrew Date: Mon Aug 1 12:17:44 2016 New Revision: 303614 URL: https://svnweb.freebsd.org/changeset/base/303614 Log: Add a kernel variable to let the user to select their preferred order between ACPI and FDT. This will be needed on machines with both, e.g. the SoftIron Overdrive 3000. The kernel will accept one or more comma separated values of either 'acpi' or 'fdt'. Any other values are skipped. To set it the user can either set it on the loader command line, or in loader.conf e.g. in loader.conf: kern.cfg.order=acpi,fdt This will try using ACPI then FDT. If none of the selected options work the kernel tries to use one to get the serial console, then panics. Reviewed by: emaste (earlier version) Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7274 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/arm64/nexus.c head/sys/arm64/include/machdep.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Mon Aug 1 12:14:21 2016 (r303613) +++ head/sys/arm64/arm64/machdep.c Mon Aug 1 12:17:44 2016 (r303614) @@ -25,6 +25,7 @@ * */ +#include "opt_acpi.h" #include "opt_platform.h" #include "opt_ddb.h" @@ -82,11 +83,19 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef DEV_ACPI +#include +#include +#endif + #ifdef FDT #include #include #endif + +enum arm64_bus arm64_bus_method = ARM64_BUS_NONE; + struct pcpu __pcpu[MAXCPU]; static struct trapframe proc0_tf; @@ -802,6 +811,61 @@ try_load_dtb(caddr_t kmdp) } #endif +static bool +bus_probe(void) +{ + bool has_acpi, has_fdt; + char *order, *env; + + has_acpi = has_fdt = false; + +#ifdef FDT + has_fdt = (OF_peer(0) != 0); +#endif +#ifdef DEV_ACPI + has_acpi = (acpi_find_table(ACPI_SIG_SPCR) != 0); +#endif + + env = kern_getenv("kern.cfg.order"); + if (env != NULL) { + order = env; + while (order != NULL) { + if (has_acpi && + strncmp(order, "acpi", 4) == 0 && + (order[4] == ',' || order[4] == '\0')) { + arm64_bus_method = ARM64_BUS_ACPI; + break; + } + if (has_fdt && + strncmp(order, "fdt", 3) == 0 && + (order[3] == ',' || order[3] == '\0')) { + arm64_bus_method = ARM64_BUS_FDT; + break; + } + order = strchr(order, ','); + } + freeenv(env); + + /* If we set the bus method it is valid */ + if (arm64_bus_method != ARM64_BUS_NONE) + return (true); + } + /* If no order or an invalid order was set use the default */ + if (arm64_bus_method == ARM64_BUS_NONE) { + if (has_fdt) + arm64_bus_method = ARM64_BUS_FDT; + else if (has_acpi) + arm64_bus_method = ARM64_BUS_ACPI; + } + + /* + * If no option was set the default is valid, otherwise we are + * setting one to get cninit() working, then calling panic to tell + * the user about the invalid bus setup. + */ + return (env == NULL); +} + static void cache_setup(void) { @@ -849,6 +913,7 @@ initarm(struct arm64_bootparams *abp) vm_offset_t lastaddr; caddr_t kmdp; vm_paddr_t mem_len; + bool valid; int i; /* Set the module data location */ @@ -921,8 +986,14 @@ initarm(struct arm64_bootparams *abp) devmap_bootstrap(0, NULL); + valid = bus_probe(); + cninit(); + if (!valid) + panic("Invalid bus configuration: %s", + kern_getenv("kern.cfg.order")); + init_proc0(abp->kern_stack); msgbufinit(msgbufp, msgbufsize); mutex_init(); Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Mon Aug 1 12:14:21 2016 (r303613) +++ head/sys/arm64/arm64/mp_machdep.c Mon Aug 1 12:17:44 2016 (r303614) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef VFP @@ -90,13 +91,6 @@ boolean_t ofw_cpu_reg(phandle_t node, u_ extern struct pcpu __pcpu[]; -static enum { - CPUS_UNKNOWN, -#ifdef FDT - CPUS_FDT, -#endif -} cpu_enum_method; - static device_identify_t arm64_cpu_identify; static device_probe_t arm64_cpu_probe; static device_attach_t arm64_cpu_attach; @@ -499,14 +493,14 @@ cpu_mp_start(void) CPU_SET(0, &all_cpus); - switch(cpu_enum_method) { + switch(arm64_bus_method) { #ifdef FDT - case CPUS_FDT: + case ARM64_BUS_FDT: KASSERT(cpu0 >= 0, ("Current CPU was not found")); ofw_cpu_early_foreach(cpu_init_fdt, true); break; #endif - case CPUS_UNKNOWN: + default: break; } } @@ -544,15 +538,17 @@ cpu_mp_setmaxid(void) #ifdef FDT int cores; - cores = ofw_cpu_early_foreach(cpu_find_cpu0_fdt, false); - if (cores > 0) { - cores = MIN(cores, MAXCPU); - if (bootverbose) - printf("Found %d CPUs in the device tree\n", cores); - mp_ncpus = cores; - mp_maxid = cores - 1; - cpu_enum_method = CPUS_FDT; - return; + if (arm64_bus_method == ARM64_BUS_FDT) { + cores = ofw_cpu_early_foreach(cpu_find_cpu0_fdt, false); + if (cores > 0) { + cores = MIN(cores, MAXCPU); + if (bootverbose) + printf("Found %d CPUs in the device tree\n", + cores); + mp_ncpus = cores; + mp_maxid = cores - 1; + return; + } } #endif Modified: head/sys/arm64/arm64/nexus.c ============================================================================== --- head/sys/arm64/arm64/nexus.c Mon Aug 1 12:14:21 2016 (r303613) +++ head/sys/arm64/arm64/nexus.c Mon Aug 1 12:17:44 2016 (r303614) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -411,7 +412,7 @@ static int nexus_fdt_probe(device_t dev) { - if (OF_peer(0) == 0) + if (arm64_bus_method != ARM64_BUS_FDT) return (ENXIO); device_quiet(dev); @@ -455,7 +456,7 @@ static int nexus_acpi_probe(device_t dev) { - if (acpi_identify() != 0) + if (arm64_bus_method != ARM64_BUS_ACPI || acpi_identify() != 0) return (ENXIO); device_quiet(dev); Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Mon Aug 1 12:14:21 2016 (r303613) +++ head/sys/arm64/include/machdep.h Mon Aug 1 12:17:44 2016 (r303614) @@ -37,6 +37,14 @@ struct arm64_bootparams { vm_offset_t kern_l0pt; /* L1 page table for the kernel */ }; +enum arm64_bus { + ARM64_BUS_NONE, + ARM64_BUS_FDT, + ARM64_BUS_ACPI, +}; + +extern enum arm64_bus arm64_bus_method; + extern vm_paddr_t physmap[]; extern u_int physmap_idx; From owner-svn-src-head@freebsd.org Mon Aug 1 13:38:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7B5EBAA6A7; Mon, 1 Aug 2016 13:38:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7228F1880; Mon, 1 Aug 2016 13:38:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71DcmHc019093; Mon, 1 Aug 2016 13:38:48 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71Dcm7o019092; Mon, 1 Aug 2016 13:38:48 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201608011338.u71Dcm7o019092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 1 Aug 2016 13:38:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303615 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 13:38:49 -0000 Author: ae Date: Mon Aug 1 13:38:48 2016 New Revision: 303615 URL: https://svnweb.freebsd.org/changeset/base/303615 Log: An old tables implementation had all tables preallocated, so when user did `ipfw table N flush` it always worked, but now when table N doesn't exist the kernel returns ESRCH error. This isn't fatal error for flush and destroy commands. Do not call err(3) when errno is equal to ESRCH. Also warn only when quiet mode isn't enabled. This fixes a regression in behavior, when old rules are loaded from file. Also use correct value for switch in the table_swap(). Reported by: Kevin Oberman MFC after: 3 days Modified: head/sbin/ipfw/tables.c Modified: head/sbin/ipfw/tables.c ============================================================================== --- head/sbin/ipfw/tables.c Mon Aug 1 12:17:44 2016 (r303614) +++ head/sbin/ipfw/tables.c Mon Aug 1 13:38:48 2016 (r303615) @@ -225,18 +225,30 @@ ipfw_table_handler(int ac, char *av[]) table_modify(&oh, ac, av); break; case TOK_DESTROY: - if (table_destroy(&oh) != 0) + if (table_destroy(&oh) == 0) + break; + if (errno != ESRCH) err(EX_OSERR, "failed to destroy table %s", tablename); + /* ESRCH isn't fatal, warn if not quiet mode */ + if (co.do_quiet == 0) + warn("failed to destroy table %s", tablename); break; case TOK_FLUSH: if (is_all == 0) { - if ((error = table_flush(&oh)) != 0) + if ((error = table_flush(&oh)) == 0) + break; + if (errno != ESRCH) err(EX_OSERR, "failed to flush table %s info", tablename); + /* ESRCH isn't fatal, warn if not quiet mode */ + if (co.do_quiet == 0) + warn("failed to flush table %s info", + tablename); } else { error = tables_foreach(table_flush_one, &oh, 1); if (error != 0) err(EX_OSERR, "failed to flush tables list"); + /* XXX: we ignore errors here */ } break; case TOK_SWAP: @@ -593,14 +605,14 @@ table_do_swap(ipfw_obj_header *oh, char static int table_swap(ipfw_obj_header *oh, char *second) { - int error; if (table_check_name(second) != 0) errx(EX_USAGE, "table name %s is invalid", second); - error = table_do_swap(oh, second); + if (table_do_swap(oh, second) == 0) + return (0); - switch (error) { + switch (errno) { case EINVAL: errx(EX_USAGE, "Unable to swap table: check types"); case EFBIG: From owner-svn-src-head@freebsd.org Mon Aug 1 15:25:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E48F4BAB051; Mon, 1 Aug 2016 15:25:29 +0000 (UTC) (envelope-from email@piotr-stefaniak.me) Received: from BAY004-OMC4S18.hotmail.com (bay004-omc4s18.hotmail.com [65.54.190.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "*.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5A081D39; Mon, 1 Aug 2016 15:25:29 +0000 (UTC) (envelope-from email@piotr-stefaniak.me) Received: from EUR01-DB5-obe.outbound.protection.outlook.com ([65.54.190.200]) by BAY004-OMC4S18.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Mon, 1 Aug 2016 08:24:23 -0700 Received: from DB5EUR01FT009.eop-EUR01.prod.protection.outlook.com (10.152.4.59) by DB5EUR01HT225.eop-EUR01.prod.protection.outlook.com (10.152.5.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.8; Mon, 1 Aug 2016 15:24:22 +0000 Received: from VI1PR0901MB1501.eurprd09.prod.outlook.com (10.152.4.60) by DB5EUR01FT009.mail.protection.outlook.com (10.152.4.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.557.8 via Frontend Transport; Mon, 1 Aug 2016 15:24:22 +0000 Received: from VI1PR0901MB1501.eurprd09.prod.outlook.com ([10.173.75.149]) by VI1PR0901MB1501.eurprd09.prod.outlook.com ([10.173.75.149]) with mapi id 15.01.0549.022; Mon, 1 Aug 2016 15:24:20 +0000 From: Piotr Stefaniak To: Bruce Evans , Xin Li CC: "svn-src-head@freebsd.org" , "d@delphij.net" , "svn-src-all@freebsd.org" , "Pedro F. Giffuni" , "src-committers@freebsd.org" Subject: Re: svn commit: r303600 - head/usr.bin/indent Thread-Topic: svn commit: r303600 - head/usr.bin/indent Thread-Index: AQHR63OmbbYorJJhE0SA7k5BvSoecKAzlDUAgAALBoCAAJtagA== Date: Mon, 1 Aug 2016 15:24:20 +0000 Message-ID: References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> <20160801155148.I884@besplex.bde.org> In-Reply-To: <20160801155148.I884@besplex.bde.org> Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=softfail (sender IP is 10.152.4.60) smtp.mailfrom=piotr-stefaniak.me; optusnet.com.au; dkim=none (message not signed) header.d=none;optusnet.com.au; dmarc=none action=none header.from=piotr-stefaniak.me; received-spf: SoftFail (protection.outlook.com: domain of transitioning piotr-stefaniak.me discourages use of 10.152.4.60 as permitted sender) x-ms-exchange-messagesentrepresentingtype: 1 x-eopattributedmessage: 0 x-forefront-antispam-report: CIP:10.152.4.60; IPV:NLI; CTRY:; EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:DB5EUR01HT225; H:VI1PR0901MB1501.eurprd09.prod.outlook.com; FPR:; SPF:None; LANG:en; x-microsoft-exchange-diagnostics: 1; DB5EUR01HT225; 6:w63irH8/HRCCI/+SBaGjHTqqr4TXSKhksc8LFpESfMS/9b0dYijc+3opjgYw/ZWjw3UZGq59y6CtxcQEajLVCQmhCVC2KxfSMlDEY/bbvWoeLe237AxOXyw2zvdmdbkE6ddnRsV+aGd1Ik+jkbPPBYW/vRaiAQJjPyho25sBbq+jaIpnpBVw1trn5KXpye7vqBdFY/Yc4UAPKvQzPWgBr5Gs47LRzWBb94wCieNb6LatG7M1hwfUZWGpjxOIz05sQEvbnuZ+4W3xwe5eccC8mbZk+0xHUT9hH5OHRzoBVi60fcj6LJUR8T+pwas6qnyz; 5:tlK97QH5z62+53hhnjnSfn4zaMypD8YD7i6g03OXEjIKqHLdKmqHIsom+baivNLZGnukX5+AQjeQKL3f072cVkUeZUsi0+Te7dpa6h7eFsBUY9hrdACBjuR8bGFK0AuTf1VyW8PNfxM9AaihrAabNQ==; 24:VREy7UpWtTD/TAk4Zc8GmYZ4uOikxlnXnnwv4s/WIykGWRFhYrapE2rZvQeRJyxZ3oPkqo5U3MhI0P2n/JF10ltmPPpvjhyoxf6WKxqq9Lo=; 7:NC+jwTDWDIvS5KALUq5tzgdDXg73xP38mKnapXy3np2rDopaqOhV1BsHFS6rKsbXLeh15i+eyMnvp4Gn0JoBNhsNWBA1CHLtjxNybiYDXslNpV5Sn9ZvZ+9lk3llfcWRtV+8dVVQY2RFgCT3XAMkA6DEG7MHkDyE5JOzpAUJE7tSnBQJ/pL6YaqDifOQW4qD4VJ5NDymOsB3osTEOmeKp8Lbmu+3fzCirL/7tXUguGhNX99QaqfgYnkFcxbzHDra x-ms-office365-filtering-correlation-id: 21c97e3b-62e7-4081-e4b4-08d3ba1fe847 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(1601124038)(1601125047); SRVR:DB5EUR01HT225; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(82015046); SRVR:DB5EUR01HT225; BCL:0; PCL:0; RULEID:; SRVR:DB5EUR01HT225; x-forefront-prvs: 0021920B5A spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="Windows-1252" Content-ID: <0130B1D656C4C044A911058F99F73935@eurprd09.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Aug 2016 15:24:20.3808 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR01HT225 X-OriginalArrivalTime: 01 Aug 2016 15:24:23.0907 (UTC) FILETIME=[C88D9330:01D1EC08] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 15:25:30 -0000 On 2016-08-01 08:08, Bruce Evans wrote: > On Sun, 31 Jul 2016, Xin Li wrote: > >> On 7/31/16 14:36, Pedro F. Giffuni wrote: >>> - bzero(f, sizeof *f); >>> + memset(f, 0, sizeof(struct fstate)); >> ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone >> than sizeof(*f) IMHO. > > I also prefer bzero(). I hope this is merely a preference and not a hard rule, because I'm of=20 the opinion that the memset()-based equivalent of bzero() has fewer=20 portability consequences, which is worth paying attention to. Please=20 consider the fact that NetBSD has done this replacement. I do agree that replacing the expression with the type name was a=20 regression; it was my mistake. > Removal of the space after sizeof is another regression. KNF disallows > the space, but indent's style is very far from KNF. It isn't clear if > indent's style is to require the space, since old versions of indent > never used sizeof(typename), and 'sizeof object' requires the space. I was specifically asked in the D6966 differential review to adhere to=20 style(9). I have changed both my own code submitted for review and the=20 rest of style violations of this kind as a separate patch=20 (https://github.com/pstef/freebsd_indent/commit/a2befd74fa54c91d96a38317e90= d38ef17682f4b).=20 I had expected the style fixes to get committed before the change in=20 r303600, in belief that doing so would render possible complaints as the=20 one quoted above as not relevant anymore. > Regressions started in r93440 with sizeof(object) in an nitems() expansio= n. > The style of this is very different from an nitems() expansion in r1590. > There was 1 more sizeof(object) and 1 sizeof(int). This is the first > sizeof(typename) where 'sizeof object' cannot be used for technical > reasons. > > KNF also requires parentheses for sizeof(object). Then the space is > unnecessary and disallowed. On a more general note, I imagined we're heading towards slowly changing=20 indent(1)'s code to make it more style(9)-compliant (not least because=20 it's tempting to imagine indent(1) being able to re-indent itself in=20 accordance with style(9) at some point) but right now I'm confused as to=20 what style decisions in the patches I submit are expected of me. From owner-svn-src-head@freebsd.org Mon Aug 1 15:36:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 470ECBAB371 for ; Mon, 1 Aug 2016 15:36:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm29-vm1.bullet.mail.bf1.yahoo.com (nm29-vm1.bullet.mail.bf1.yahoo.com [98.139.213.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1C5814D3 for ; Mon, 1 Aug 2016 15:36:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1470065414; bh=sDZCzXy7S9eOhYdZwTxWGfegD+/YU60Axfp9drvdc+4=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=dlKI0ytV5nxgeMF06TjnnHjD6dvxGb5yBS3lSChHFMTkgUAmu0ie5qr/+3Px0sNg1n/UCYylkN6UYIA8HS5qO2xS69n0oGs7W5o5dYPMD5Kc/mOarinCcYJh9DSWGG9auAbdAd4yMK+zdwwNqfOg3USB3E/CLXkgdl7sfKi+QB5lMMF21InpZCISlsRaFoZ+sPZ6iUxGApP6cPHPKwHDQj5zZAE3nSdk0i2JNJoVYy/5zBtaBAWp9yl/ExlWDE1QPK/q6D1ZtxGnZACnCa30kDEssOS2eAqFbZ5W7dYsbNdk8LdqlaGudVya0+nTNLiEL4uT2GX7dtafUz360RtNWA== Received: from [66.196.81.174] by nm29.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 15:30:14 -0000 Received: from [98.139.211.198] by tm20.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 15:30:14 -0000 Received: from [127.0.0.1] by smtp207.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 15:30:14 -0000 X-Yahoo-Newman-Id: 31761.84967.bm@smtp207.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: A1WzkpIVM1mAKIg0gDIUOBRI5bZYj6NzXWU9tSfWl4KOpkg CfvziYEawe_vib221N9h02Yy4F_5fp0eNBK.pCpQPCtpkwmpEkNsIPZspKmn o7FLxOCC42uuA9hT_4H_JSfnqqL0MnRuKoJgD0Jn_eTDrO8.ohLzl_KvCu_U wnCeJK5z_IRXHgC9OZP.MvfW6oRGZQ3tcL9U0XBQ3CbMTCaBGpXbK25TvFj7 IUqWSknJD1fVwkJOw42E3qBiUZsXMAFS2_ZMh2tsk5N5iONVluDhwHegt8.Z oVFzxa7dihaUHdoz1NA.p61Wg2e7_7UjkecyEjgusMaXdaM.JuOSYbgj8rlv 9B8aeYEbK_OP9iJ0AXAo2TL67u_EnjEok3DR1iavpUP0XEG64qgcvUZkKbtY 7j3.cIAoegBunOUYYLLgTdhAf3.mQ7avsmgXRPOIz5QHZD_TNtLfzv67oLEp hUynQkI6Xj0qGR_PUTv6PqC3WCeA7e4SRxii_jMPnR7dc.8_5nMhsyCNR_vH 6IyL8Pe_VRqVBvCD.wbB1mGiHX6G_sPC5LZb4d.3BI03kog-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303600 - head/usr.bin/indent To: Xin Li , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> Cc: d@delphij.net From: Pedro Giffuni Message-ID: <3eb7a9fe-f80d-7d34-c78e-df11e4a6aeb4@FreeBSD.org> Date: Mon, 1 Aug 2016 10:30:26 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> Content-Type: multipart/mixed; boundary="------------F06810B83B1DA26EB4E2C552" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 15:36:16 -0000 This is a multi-part message in MIME format. --------------F06810B83B1DA26EB4E2C552 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 08/01/16 00:28, Xin Li wrote: > > > On 7/31/16 14:36, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sun Jul 31 21:36:40 2016 >> New Revision: 303600 >> URL: https://svnweb.freebsd.org/changeset/base/303600 >> >> Log: >> indent(1): replace function call to bzero with memset. >> >> Reference: >> https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235 >> >> Differential Revision: https://reviews.freebsd.org/D6966 (Partial) >> Submitted by: Piotr Stefaniak >> >> Modified: >> head/usr.bin/indent/io.c >> >> Modified: head/usr.bin/indent/io.c >> ============================================================================== >> --- head/usr.bin/indent/io.c Sun Jul 31 21:29:10 2016 (r303599) >> +++ head/usr.bin/indent/io.c Sun Jul 31 21:36:40 2016 (r303600) >> @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * >> const char *s = s0; >> int sizedelta = 0; >> >> - bzero(f, sizeof *f); >> + memset(f, 0, sizeof(struct fstate)); > ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone > than sizeof(*f) IMHO. > > Cheers, > Does this look better? Cheers, Pedro. --------------F06810B83B1DA26EB4E2C552 Content-Type: text/x-patch; name="indent-memset.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="indent-memset.diff" Index: usr.bin/indent/io.c =================================================================== --- usr.bin/indent/io.c (revision 303615) +++ usr.bin/indent/io.c (working copy) @@ -629,7 +629,7 @@ const char *s = s0; int sizedelta = 0; - memset(f, 0, sizeof(struct fstate)); + memset(f, '\0', sizeof(*f)); while (*s) { if (isdigit(*s)) f->size = f->size * 10 + *s - '0'; --------------F06810B83B1DA26EB4E2C552-- From owner-svn-src-head@freebsd.org Mon Aug 1 15:38:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BF85BAB446; Mon, 1 Aug 2016 15:38:53 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7B7F16ED; Mon, 1 Aug 2016 15:38:52 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 8C93F20210; Mon, 1 Aug 2016 11:38:51 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Mon, 01 Aug 2016 11:38:51 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=8vFxLD7RXBgIXGkqx8ubXP4r8mc=; b=SwbJnO Gxf2JdN2Ou3B4mMKrMFzvCeQddRWZjiMVhP20T7uC45gtVk6B2p3B+ZQPKjo+7ez NbW1HIkflHkcA6co0G1VmMUPOi51+eMKLz3euiQKPPza9nhN1lY5hOazgkVRfvos fIBFf+GZvlWfg7oy+k5UX2dF2tWiloK9eVXrA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=8vFxLD7RXBgIXGk qx8ubXP4r8mc=; b=IJmRfLuaMfhZBFv+cM8j60ubZu7zOoNKmaDgexpQINlYRTT CXsNcarIMi/vuTMhFj8LtTU0B7C12WsDxalxjiMlkWnhwXN8oaHABUuwkk/3Dyyp QsKIyed8EgX7T2SLLT+2NhhzRjgdoqqOpSMkzIuvYNmIgX8p56WKcry+LM4M= X-Sasl-enc: S61xbwXWTLx1aynGnUcDg8z/xoNFuQpPd8dOQRPElANz 1470065931 Received: from pion.local (unknown [5.148.105.34]) by mail.messagingengine.com (Postfix) with ESMTPA id EE3B3CCD80; Mon, 1 Aug 2016 11:38:50 -0400 (EDT) Subject: Re: svn commit: r303522 - head/sys/dev/cxgbe To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607292211.u6TMBTEJ092580@repo.freebsd.org> From: Bruce Simpson Message-ID: <86806f53-8ecd-d7d7-aad3-592d6b702609@fastmail.net> Date: Mon, 1 Aug 2016 16:38:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607292211.u6TMBTEJ092580@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 15:38:53 -0000 "Yes, I know it's not a typewriter. Why is this command not working?" Perhaps this errno code should be aliased... and strerror() massaged in places... assuming we strictly follow the POSIX. From owner-svn-src-head@freebsd.org Mon Aug 1 15:42:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA3D1BAB5F2; Mon, 1 Aug 2016 15:42:09 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C20871AAA; Mon, 1 Aug 2016 15:42:09 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B716A205FB; Mon, 1 Aug 2016 11:42:08 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Mon, 01 Aug 2016 11:42:08 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=lcv6OUooP1+78z0j6OTlF9CyrP4=; b=ddNJIF RF1WklNHQs95XHQonCBNRcforPXyQ/sXEAt3wyT4bWnfuTSJ/yt12HFvx8l2s3Fp H/6R2UDqg+QzsvrtyT4OyloFN+qDOeE+34O+NCH95+eWjyc8RH1iI1sjI0CRnFml XYmHwCEUzh3U9o3Le5arsuT/48IkufLB7dSh4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=lcv6OUooP1+78z0 j6OTlF9CyrP4=; b=EF3G0Uy3Ou1wjDphAoyBQzI0Z2emT5d9RZL+gpfur9Q9C7F Aa4ummiZ3wq6G2oJSdURrUlfmFMsuD+srbLcha4wEBtCZMwtLaFNg4tY5nA8ag0H 9v6sZelebhmim5rG3YEGOHjg4sIJXSfX/s8xNWtOAUkXagFkZos8ygNuy6Ik= X-Sasl-enc: qTM9lbc9JO+ICCH19z6BvMlX/8geS87ivwnezNYlwAAV 1470066128 Received: from pion.local (unknown [5.148.105.34]) by mail.messagingengine.com (Postfix) with ESMTPA id 20873CCD84; Mon, 1 Aug 2016 11:42:08 -0400 (EDT) Subject: Re: svn commit: r303574 - head/sys/dev/gpio To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607310624.u6V6OQB4014796@repo.freebsd.org> From: Bruce Simpson Message-ID: <772b250a-97eb-9ec6-96b0-62d32c2ce314@fastmail.net> Date: Mon, 1 Aug 2016 16:42:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607310624.u6V6OQB4014796@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 15:42:10 -0000 On 31/07/16 07:24, Adrian Chadd wrote: > [gpioled] add support for inverting the LED polarity. > No, this isn't a star trek science joke - sometimes LEDs are wired > up to be active low, so this is needed. Actually, just about every bit of hardware I have interacted with on that level recently lights on low. From owner-svn-src-head@freebsd.org Mon Aug 1 15:50:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6693BAB9C3 for ; Mon, 1 Aug 2016 15:50:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm4.bullet.mail.bf1.yahoo.com (nm4.bullet.mail.bf1.yahoo.com [98.139.212.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AEDC13BA for ; Mon, 1 Aug 2016 15:50:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1470066631; bh=RsaYBCjRJCIjosOiolOgOb5zi8w8RhWjFJ+8IXpjqaE=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=QStc1K/zDyDuVpeml9wPO6W46fyoc7F1kr7YHs7FIkiVGAOINoNdNplHdJL8HDcvAh7KjEF1ndVUNLBsTOVvkP4K9mmO6D5ZPPEe2y9JF3sbjle05pwCAD5p+tU6IcMm3ZeuoyBby8D7XlhEEGnW6r2vy14fP4V+s1nkIM053qLa8ekY1UtcjuE+q7BLbV19SaHHb6Cvwts47SBI1aicK7FBcpoELtS/gnp+/VV/As/2wo3BH15aS0dQUJsfN2O7xJMGiZV7XUu9qh2Y0tUPTZ4qWUAaOFNRKgOoGnuZi4g21U3BEytPuOmidnutZUe6dLRUAEyRwXAnYJDgZEF9/A== Received: from [98.139.170.179] by nm4.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 15:50:31 -0000 Received: from [68.142.230.70] by tm22.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 15:50:31 -0000 Received: from [127.0.0.1] by smtp227.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 15:50:31 -0000 X-Yahoo-Newman-Id: 388207.28399.bm@smtp227.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: MwqOBrEVM1mE.X5MQgfYFTSozDKhd0aajj9q1yFozt0jSdW M7mQpZxYk7ROb2LfOwWuudBj9O2c.ExSYO9GPehd.HQjCPtjTCcy1PwlQ.AV u6p9zgo.pLOyrZlAWUZkgx.lqUpdsD5KBQ.yt3IFzTBMA52CEPi6gLvpM6CN 4vnyPgOrT8Chrcy58..kv.7YU2ey0lpUdoAlny7W9d.6M9lXVFuCA7MZF0lc g7vIsCnpcNjL1kjF0mY7R3iVo2lhaIKakfYo5GGtkMNPT0L1gdY6dngW8fED oCQ4LUDLmRTdXpxieaYAV8lXwk4Uplqr6.4Zbj0hTDmfW6SIwyZ3m5S0dP0k VcHhnECxvJnnd1sETPNejagoMoDO7N6YNHF22jjXD2Uok3OUnRM4nT70h0ec pz.Gq8NgR3XUvQINSSQ88USrUhM7Oan1MGuaauD465t3qrtRF1wL6QR2Uagj cjIhMYngWXticOiyvfe6pfIUPaAbSzHz2bF98cSFgtCYltKkS8IynlTEjI7Y CW9i7uBcygxDfAxk2290SgqQLqNv1My3OHn6ouo.MQpqWmw-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303600 - head/usr.bin/indent To: Piotr Stefaniak , Bruce Evans , Xin Li References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> <20160801155148.I884@besplex.bde.org> Cc: "svn-src-head@freebsd.org" , "d@delphij.net" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" From: Pedro Giffuni Message-ID: <93515f84-5c0e-2957-ce63-4a52ba09c50d@FreeBSD.org> Date: Mon, 1 Aug 2016 10:50:43 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 15:50:38 -0000 On 08/01/16 10:24, Piotr Stefaniak wrote: > On 2016-08-01 08:08, Bruce Evans wrote: >> On Sun, 31 Jul 2016, Xin Li wrote: >> >>> On 7/31/16 14:36, Pedro F. Giffuni wrote: > >>>> - bzero(f, sizeof *f); >>>> + memset(f, 0, sizeof(struct fstate)); >>> ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone >>> than sizeof(*f) IMHO. >> >> I also prefer bzero(). > > I hope this is merely a preference and not a hard rule, because I'm of > the opinion that the memset()-based equivalent of bzero() has fewer > portability consequences, which is worth paying attention to. Please > consider the fact that NetBSD has done this replacement. > It is a preference, not a hard rule. In general, replacing bzero with memset is seen as a portability enhancement but bzero is not going away from FreeBSD and replacing it is not a priority. > I do agree that replacing the expression with the type name was a > regression; it was my mistake. > >> Removal of the space after sizeof is another regression. KNF disallows >> the space, but indent's style is very far from KNF. It isn't clear if >> indent's style is to require the space, since old versions of indent >> never used sizeof(typename), and 'sizeof object' requires the space. > > I was specifically asked in the D6966 differential review to adhere to > style(9). I have changed both my own code submitted for review and the > rest of style violations of this kind as a separate patch > (https://github.com/pstef/freebsd_indent/commit/a2befd74fa54c91d96a38317e90d38ef17682f4b). > I had expected the style fixes to get committed before the change in > r303600, in belief that doing so would render possible complaints as the > one quoted above as not relevant anymore. > The idea is that new code should try to adhere to style(9) but it is not an obligation to do so if the codebase already uses a different style. >> Regressions started in r93440 with sizeof(object) in an nitems() expansion. >> The style of this is very different from an nitems() expansion in r1590. >> There was 1 more sizeof(object) and 1 sizeof(int). This is the first >> sizeof(typename) where 'sizeof object' cannot be used for technical >> reasons. >> >> KNF also requires parentheses for sizeof(object). Then the space is >> unnecessary and disallowed. > > On a more general note, I imagined we're heading towards slowly changing > indent(1)'s code to make it more style(9)-compliant (not least because > it's tempting to imagine indent(1) being able to re-indent itself in > accordance with style(9) at some point) but right now I'm confused as to > what style decisions in the patches I submit are expected of me. > You are doing a great job! In the case of indent, while it would be desirable to move it all to KNF, that involves way too many cosmetic changes that have no use. Reviewers can get things wrong, and in general it is up to the committer, IMO, style cleanups are generally very low priority. It is preferable to have smaller to-the-point changes than style issues mixed with effective code changes. Going out of your way to clean indent style --> KNF is a waste of time. IMHO, of course. Pedro. From owner-svn-src-head@freebsd.org Mon Aug 1 16:08:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09B1EBABF4B for ; Mon, 1 Aug 2016 16:08:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm6.bullet.mail.bf1.yahoo.com (nm6.bullet.mail.bf1.yahoo.com [98.139.212.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5F1E1DF0 for ; Mon, 1 Aug 2016 16:08:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1470067720; bh=rS28cQSZUSupZnNtq+E1HxsRtg++CRuiiGktuBQDk1k=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=HG+Duq7X2t5/ptdEDuhGZzyWE8bEUiYsy2enNEito3LCY16filMemk+EHVc9fIMOwSRpVczvwF+WnijELIMSl7Hhe9GommWeFcI68scMHrxXvQVf+hXgNMY3fCnj5OG0JqzfPI/O9PP8s4Mc18O8g21HGGxlWVkm4z8Qh9w8Gqrfm3DRUrEdNK6tJvrgjGbWdo8IVCEA+VTBUcUscj8zCxjTwrFWHqJAdtIAP7gjJwtav78flY/FzZbACHz97sGzAUfkTpZqhLsihwNqKeA8adui07wdFF/YYNaVVIWkPdVo6XzjqMjdbivulrK30tEjDdP1COMbKrBDJdRo3OYIrA== Received: from [66.196.81.173] by nm6.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 16:08:40 -0000 Received: from [68.142.230.65] by tm19.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 16:08:40 -0000 Received: from [127.0.0.1] by smtp222.mail.bf1.yahoo.com with NNFMP; 01 Aug 2016 16:08:40 -0000 X-Yahoo-Newman-Id: 767651.27885.bm@smtp222.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: FOo2kRMVM1nGlWWEMYCkzMLIa1wzNzx7reHV8Tgs7Ya7idw A1FomZFW898e_OzedC2xZYlZASF61out73X6eaKwF7sEECKx23Y36RUuwQ0X Joi3lNvTRoociC7ULZKpnz6y7BQkKTkx2NDmD3EwXM9wawzD2_FeWsui.y1J evt9g_WryhDGBO9kDrPWdzgrTh4dRHbF0E4cMXh1kznSWVmMJnDx2SvkVD3o eK.MvBAjUk1ZLSzDC9t_JNUo194V0kDiV0ENl912v.zBeMx7uoQe6kBS3mhP Di0fEA0crtLalPvrZxIMw.JBb2RmMlmADhdUjC72jcsM6X7MyRM9jgwZfrJf Q7zdsBhFMjvN8xeHr5wWTnCwSeJWylziqvzk9Z1zHLmt_6j0ZQM6I_0vYiP6 FoZnSmTRzC_j_inPBg8RNMJgkkGkIgbBdGSYhvKQHkbIykrciVvMPV52.DsS D8FcvHRBckEjDcLKWcylYGE1vXgBljk3P2IGtSZe6mBeFK6jrDuZzyS_J5JJ HCBdH.zGNmwj2KLqkyJBL7wonL7he_Tf2DK1dsZ9h8lBLVQ-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303600 - head/usr.bin/indent To: Bruce Evans , Xin Li References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> <20160801155148.I884@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, d@delphij.net From: Pedro Giffuni Message-ID: <809fadc7-0ac1-2f50-1d77-588e1b756302@FreeBSD.org> Date: Mon, 1 Aug 2016 11:08:51 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160801155148.I884@besplex.bde.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:08:49 -0000 On 08/01/16 01:08, Bruce Evans wrote: > On Sun, 31 Jul 2016, Xin Li wrote: > >> On 7/31/16 14:36, Pedro F. Giffuni wrote: >>> >>> Log: >>> indent(1): replace function call to bzero with memset. >>> >>> Reference: >>> >>> https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235 >>> >>> >>> Differential Revision: https://reviews.freebsd.org/D6966 (Partial) >>> Submitted by: Piotr Stefaniak >>> >>> Modified: >>> head/usr.bin/indent/io.c >>> >>> Modified: head/usr.bin/indent/io.c >>> ============================================================================== >>> >>> --- head/usr.bin/indent/io.c Sun Jul 31 21:29:10 2016 (r303599) >>> +++ head/usr.bin/indent/io.c Sun Jul 31 21:36:40 2016 (r303600) >>> @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * >>> const char *s = s0; >>> int sizedelta = 0; >>> >>> - bzero(f, sizeof *f); >>> + memset(f, 0, sizeof(struct fstate)); >> ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone >> than sizeof(*f) IMHO. > > I also prefer bzero(). > bzero --> memset changes are done to ease portability ... On another BSD such replacements were done for performance but then they discovered it was their bzero that was broken. > Removal of the space after sizeof is another regression. KNF disallows > the space, but indent's style is very far from KNF. It isn't clear if > indent's style is to require the space, since old versions of indent > never used sizeof(typename), and 'sizeof object' requires the space. > Regressions started in r93440 with sizeof(object) in an nitems() expansion. OK ... that was in 2002. We are using nitems() now, which undoes the portability meant to be brought by memset. OTOH, using sys/param.h is implicit permission to use nitems() and may involve other portability issues already. Can't keep everybody happy. Pedro. From owner-svn-src-head@freebsd.org Mon Aug 1 16:26:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 575B9BAA5AB; Mon, 1 Aug 2016 16:26:10 +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 154D31DCD; Mon, 1 Aug 2016 16:26:10 +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 u71GQ9KO082945; Mon, 1 Aug 2016 16:26:09 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71GQ8Cj082940; Mon, 1 Aug 2016 16:26:08 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201608011626.u71GQ8Cj082940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 1 Aug 2016 16:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303621 - head/sys/dev/cfe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:26:10 -0000 Author: landonf Date: Mon Aug 1 16:26:08 2016 New Revision: 303621 URL: https://svnweb.freebsd.org/changeset/base/303621 Log: Sync CFE interface with upstream cfe-1.4.2 release. Approved by: adrian (mentor) Obtained from: https://www.broadcom.com/support/communications-processors Differential Revision: https://reviews.freebsd.org/D7375 Modified: head/sys/dev/cfe/cfe_api.c head/sys/dev/cfe/cfe_api.h head/sys/dev/cfe/cfe_api_int.h head/sys/dev/cfe/cfe_error.h head/sys/dev/cfe/cfe_ioctl.h Modified: head/sys/dev/cfe/cfe_api.c ============================================================================== --- head/sys/dev/cfe/cfe_api.c Mon Aug 1 16:24:46 2016 (r303620) +++ head/sys/dev/cfe/cfe_api.c Mon Aug 1 16:26:08 2016 (r303621) @@ -1,5 +1,4 @@ -/* $NetBSD: cfe_api.c,v 1.5 2005/12/11 12:18:07 christos Exp $ */ -/* from: SiByte Id: cfe_api.c,v 1.16 2002/07/09 23:29:11 cgd Exp $ */ +/* from: Broadcom Id: cfe_api.c,v 1.18 2006/08/24 02:13:56 binh Exp $ */ /*- * Copyright 2000, 2001, 2002 @@ -177,6 +176,27 @@ cfe_enumenv(int idx, char *name, int nam } #endif /* CFE_API_enumenv || CFE_API_ALL */ +#if defined(CFE_API_enumdev) || defined(CFE_API_ALL) +int +cfe_enumdev(int idx, char *name, int namelen) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_ENUM; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); + xiocb.plist.xiocb_envbuf.enum_idx = idx; + xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); + xiocb.plist.xiocb_envbuf.name_length = namelen; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_enumdev || CFE_API_ALL */ + #if defined(CFE_API_enummem) || defined(CFE_API_ALL) int cfe_enummem(int idx, int flags, cfe_xuint_t *start, cfe_xuint_t *length, Modified: head/sys/dev/cfe/cfe_api.h ============================================================================== --- head/sys/dev/cfe/cfe_api.h Mon Aug 1 16:24:46 2016 (r303620) +++ head/sys/dev/cfe/cfe_api.h Mon Aug 1 16:26:08 2016 (r303621) @@ -1,5 +1,4 @@ -/* $NetBSD: cfe_api.h,v 1.3 2003/02/07 17:38:48 cgd Exp $ */ -/* from: SiByte Id: cfe_api.h,v 1.29 2002/07/09 23:29:11 cgd Exp $ */ +/* from: Broadcom Id: cfe_api.h,v 1.31 2006/08/24 02:13:56 binh Exp $ */ /*- * Copyright 2000, 2001, 2002 @@ -154,6 +153,7 @@ int64_t cfe_getticks(void); #define cfe_cpu_start(a,b,c,d,e) __cfe_cpu_start(a,b,c,d,e) #define cfe_cpu_stop(a) __cfe_cpu_stop(a) #define cfe_enumenv(a,b,d,e,f) __cfe_enumenv(a,b,d,e,f) +#define cfe_enumdev(a,b,c) __cfe_enumdev(a,b,c) #define cfe_enummem(a,b,c,d,e) __cfe_enummem(a,b,c,d,e) #define cfe_exit(a,b) __cfe_exit(a,b) #define cfe_flushcache(a) __cfe_cacheflush(a) @@ -176,6 +176,7 @@ int cfe_close(int handle); int cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1); int cfe_cpu_stop(int cpu); int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen); +int cfe_enumdev(int idx, char *name, int namelen); int cfe_enummem(int idx, int flags, uint64_t *start, uint64_t *length, uint64_t *type); int cfe_exit(int warm,int status); Modified: head/sys/dev/cfe/cfe_api_int.h ============================================================================== --- head/sys/dev/cfe/cfe_api_int.h Mon Aug 1 16:24:46 2016 (r303620) +++ head/sys/dev/cfe/cfe_api_int.h Mon Aug 1 16:26:08 2016 (r303621) @@ -1,5 +1,4 @@ -/* $NetBSD: cfe_api_int.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */ -/* from: SiByte Id: cfe_api_int.h,v 1.21 2002/07/09 23:29:11 cgd Exp $ */ +/* from: Broadcom Id: cfe_api_int.h,v 1.22 2003/02/07 17:27:56 cgd Exp $ */ /*- * Copyright 2000, 2001, 2002 Modified: head/sys/dev/cfe/cfe_error.h ============================================================================== --- head/sys/dev/cfe/cfe_error.h Mon Aug 1 16:24:46 2016 (r303620) +++ head/sys/dev/cfe/cfe_error.h Mon Aug 1 16:26:08 2016 (r303621) @@ -1,5 +1,4 @@ -/* $NetBSD: cfe_error.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */ -/* from: SiByte Id: cfe_error.h,v 1.2 2002/07/09 19:37:52 cgd Exp $ */ +/* from: Broadcom Id: cfe_error.h,v 1.3 2003/02/07 17:27:56 cgd Exp $ */ /*- * Copyright 2000, 2001, 2002 Modified: head/sys/dev/cfe/cfe_ioctl.h ============================================================================== --- head/sys/dev/cfe/cfe_ioctl.h Mon Aug 1 16:24:46 2016 (r303620) +++ head/sys/dev/cfe/cfe_ioctl.h Mon Aug 1 16:26:08 2016 (r303621) @@ -1,14 +1,13 @@ -/* $NetBSD: cfe_ioctl.h,v 1.2 2003/02/07 17:52:08 cgd Exp $ */ - /*- - * Copyright 2000, 2001 + * Copyright 2000, 2001, 2002, 2003 * Broadcom Corporation. All rights reserved. * - * This software is furnished under license and may be used and copied only - * in accordance with the following terms and conditions. Subject to these - * conditions, you may download, copy, install, use, modify and distribute - * modified or unmodified copies of this software in source and/or binary - * form. No title or ownership is transferred hereby. + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. * * 1) Any source code used, modified or distributed must reproduce and * retain this copyright notice and list of conditions as they appear in @@ -41,7 +40,7 @@ * * IOCTL function numbers and I/O data structures. * - * Author: Mitch Lichtenberg (mpl@broadcom.com) + * Author: Mitch Lichtenberg * ********************************************************************* */ @@ -53,23 +52,115 @@ #define IOCTL_NVRAM_GETINFO 1 /* return nvram_info_t */ #define IOCTL_NVRAM_ERASE 2 /* erase sector containing nvram_info_t area */ #define IOCTL_FLASH_ERASE_SECTOR 3 /* erase an arbitrary sector */ -#define IOCTL_FLASH_ERASE_ALL 4 /* Erase the entire flash */ +#define IOCTL_FLASH_ERASE_ALL 4 /* Erase the entire flash */ +#define IOCTL_FLASH_WRITE_ALL 5 /* write entire flash */ +#define IOCTL_FLASH_GETINFO 6 /* get flash device info */ +#define IOCTL_FLASH_GETSECTORS 7 /* get sector information */ +#define IOCTL_FLASH_ERASE_RANGE 8 /* erase range of bytes */ +#define IOCTL_NVRAM_UNLOCK 9 /* allow r/w beyond logical end of device */ +#define IOCTL_FLASH_PROTECT_RANGE 10 /* Protect a group of sectors */ +#define IOCTL_FLASH_UNPROTECT_RANGE 11 /* unprotect a group of sectors */ +#define IOCTL_FLASH_DATA_WIDTH_MODE 12 /* switch flash and gen bus to support 8 or 16-bit mode I/Os */ +#define IOCTL_FLASH_BURST_MODE 13 /* configure gen bus for burst mode */ + +typedef struct flash_range_s { + unsigned int range_base; + unsigned int range_length; +} flash_range_t; + +typedef struct flash_info_s { + unsigned long long flash_base; /* flash physical base address */ + unsigned int flash_size; /* available device size in bytes */ + unsigned int flash_type; /* type, from FLASH_TYPE below */ + unsigned int flash_flags; /* Various flags (FLASH_FLAG_xxx) */ +} flash_info_t; + +typedef struct flash_sector_s { + int flash_sector_idx; + int flash_sector_status; + unsigned int flash_sector_offset; + unsigned int flash_sector_size; +} flash_sector_t; + +#define FLASH_SECTOR_OK 0 +#define FLASH_SECTOR_INVALID -1 + +#define FLASH_TYPE_UNKNOWN 0 /* not sure what kind of flash */ +#define FLASH_TYPE_SRAM 1 /* not flash: it's SRAM */ +#define FLASH_TYPE_ROM 2 /* not flash: it's ROM */ +#define FLASH_TYPE_FLASH 3 /* it's flash memory of some sort */ + +#define FLASH_FLAG_NOERASE 1 /* Byte-range writes supported, + Erasing is not necessary */ typedef struct nvram_info_s { - int nvram_offset; /* offset of environment area */ - int nvram_size; /* size of environment area */ - int nvram_eraseflg; /* true if we need to erase first */ + int nvram_offset; /* offset of environment area */ + int nvram_size; /* size of environment area */ + int nvram_eraseflg; /* true if we need to erase first */ } nvram_info_t; /* ********************************************************************* * Ethernet stuff ********************************************************************* */ -#define IOCTL_ETHER_GETHWADDR 1 +#define IOCTL_ETHER_GETHWADDR 1 /* Get hardware address (6bytes) */ +#define IOCTL_ETHER_SETHWADDR 2 /* Set hardware address (6bytes) */ +#define IOCTL_ETHER_GETSPEED 3 /* Get Speed and Media (int) */ +#define IOCTL_ETHER_SETSPEED 4 /* Set Speed and Media (int) */ +#define IOCTL_ETHER_GETLINK 5 /* get link status (int) */ +#define IOCTL_ETHER_GETLOOPBACK 7 /* get loopback state */ +#define IOCTL_ETHER_SETLOOPBACK 8 /* set loopback state */ +#define IOCTL_ETHER_SETPACKETFIFO 9 /* set packet fifo mode (int) */ +#define IOCTL_ETHER_SETSTROBESIG 10 /* set strobe signal (int) */ + +#define ETHER_LOOPBACK_OFF 0 /* no loopback */ +#define ETHER_LOOPBACK_INT 1 /* Internal loopback */ +#define ETHER_LOOPBACK_EXT 2 /* External loopback (through PHY) */ + +#define ETHER_SPEED_AUTO 0 /* Auto detect */ +#define ETHER_SPEED_UNKNOWN 0 /* Speed not known (on link status) */ +#define ETHER_SPEED_10HDX 1 /* 10MB hdx and fdx */ +#define ETHER_SPEED_10FDX 2 +#define ETHER_SPEED_100HDX 3 /* 100MB hdx and fdx */ +#define ETHER_SPEED_100FDX 4 +#define ETHER_SPEED_1000HDX 5 /* 1000MB hdx and fdx */ +#define ETHER_SPEED_1000FDX 6 + +#define ETHER_FIFO_8 0 /* 8-bit packet fifo mode */ +#define ETHER_FIFO_16 1 /* 16-bit packet fifo mode */ +#define ETHER_ETHER 2 /* Standard ethernet mode */ + +#define ETHER_STROBE_GMII 0 /* GMII style strobe signal */ +#define ETHER_STROBE_ENCODED 1 /* Encoded */ +#define ETHER_STROBE_SOP 2 /* SOP flagged. Only in 8-bit mode*/ +#define ETHER_STROBE_EOP 3 /* EOP flagged. Only in 8-bit mode*/ + +/* ********************************************************************* + * Serial Ports + ********************************************************************* */ + +#define IOCTL_SERIAL_SETSPEED 1 /* get baud rate (int) */ +#define IOCTL_SERIAL_GETSPEED 2 /* set baud rate (int) */ +#define IOCTL_SERIAL_SETFLOW 3 /* Set Flow Control */ +#define IOCTL_SERIAL_GETFLOW 4 /* Get Flow Control */ + +#define SERIAL_FLOW_NONE 0 /* no flow control */ +#define SERIAL_FLOW_SOFTWARE 1 /* software flow control (not impl) */ +#define SERIAL_FLOW_HARDWARE 2 /* hardware flow control */ /* ********************************************************************* * Block device stuff ********************************************************************* */ -#define IOCTL_BLOCK_GETBLOCKSIZE 1 -#define IOCTL_BLOCK_GETTOTALBLOCKS 2 +#define IOCTL_BLOCK_GETBLOCKSIZE 1 /* get block size (int) */ +#define IOCTL_BLOCK_GETTOTALBLOCKS 2 /* get total bocks (long long) */ +#define IOCTL_BLOCK_GETDEVTYPE 3 /* get device type (struct) */ + +typedef struct blockdev_info_s { + unsigned long long blkdev_totalblocks; + unsigned int blkdev_blocksize; + unsigned int blkdev_devtype; +} blockdev_info_t; + +#define BLOCK_DEVTYPE_DISK 0 +#define BLOCK_DEVTYPE_CDROM 1 From owner-svn-src-head@freebsd.org Mon Aug 1 16:29:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A99FEBAA699; Mon, 1 Aug 2016 16:29:05 +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 551771F7B; Mon, 1 Aug 2016 16:29:05 +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 u71GT4ae083119; Mon, 1 Aug 2016 16:29:04 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71GT4E6083115; Mon, 1 Aug 2016 16:29:04 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201608011629.u71GT4E6083115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 1 Aug 2016 16:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303622 - in head/sys: arm/arm conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:29:05 -0000 Author: andrew Date: Mon Aug 1 16:29:04 2016 New Revision: 303622 URL: https://svnweb.freebsd.org/changeset/base/303622 Log: Split out the FDT parts of the GICv2 interrupt controller driver. This will allow us to add an ACPI attachment for arm64. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7307 Added: head/sys/arm/arm/gic.h (contents, props changed) head/sys/arm/arm/gic_fdt.c - copied, changed from r303614, head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c head/sys/conf/files.arm head/sys/conf/files.arm64 Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Mon Aug 1 16:26:08 2016 (r303621) +++ head/sys/arm/arm/gic.c Mon Aug 1 16:29:04 2016 (r303622) @@ -62,17 +62,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include +#include + #ifdef INTRNG #include "pic_if.h" #include "msi_if.h" #endif -#define GIC_DEBUG_SPURIOUS - /* We are using GICv2 register naming */ /* Distributor Registers */ @@ -102,12 +100,6 @@ __FBSDID("$FreeBSD$"); #define GICC_ABPR 0x001C /* v1 ICCABPR */ #define GICC_IIDR 0x00FC /* v1 ICCIIDR*/ -#define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ -#define GIC_LAST_SGI 15 -#define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ -#define GIC_LAST_PPI 31 /* core) peripheral interrupts. */ -#define GIC_FIRST_SPI 32 /* Irqs 32+ are shared peripherals. */ - /* TYPER Registers */ #define GICD_TYPER_SECURITYEXT 0x400 #define GIC_SUPPORT_SECEXT(_sc) \ @@ -141,58 +133,26 @@ struct gic_irqsrc { }; static u_int gic_irq_cpu; -static int arm_gic_intr(void *); static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc); #ifdef SMP static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1]; static u_int sgi_first_unused = GIC_FIRST_SGI; #endif -#endif -#ifdef INTRNG -struct arm_gic_range { - uint64_t bus; - uint64_t host; - uint64_t size; -}; - -struct arm_gic_devinfo { - struct ofw_bus_devinfo obdinfo; - struct resource_list rl; -}; -#endif - -struct arm_gic_softc { - device_t gic_dev; -#ifdef INTRNG - void * gic_intrhand; - struct gic_irqsrc * gic_irqs; -#endif - struct resource * gic_res[3]; - bus_space_tag_t gic_c_bst; - bus_space_tag_t gic_d_bst; - bus_space_handle_t gic_c_bsh; - bus_space_handle_t gic_d_bsh; - uint8_t ver; - struct mtx mutex; - uint32_t nirqs; - uint32_t typer; -#ifdef GIC_DEBUG_SPURIOUS - uint32_t last_irq[MAXCPU]; -#endif - -#ifdef INTRNG - /* FDT child data */ - pcell_t addr_cells; - pcell_t size_cells; - int nranges; - struct arm_gic_range * ranges; -#endif -}; - -#ifdef INTRNG #define GIC_INTR_ISRC(sc, irq) (&sc->gic_irqs[irq].gi_isrc) +#else /* !INTRNG */ +static struct ofw_compat_data compat_data[] = { + {"arm,gic", true}, /* Non-standard, used in FreeBSD dts. */ + {"arm,gic-400", true}, + {"arm,cortex-a15-gic", true}, + {"arm,cortex-a9-gic", true}, + {"arm,cortex-a7-gic", true}, + {"arm,arm11mp-gic", true}, + {"brcm,brahma-b15-gic", true}, + {"qcom,msm-qgic2", true}, + {NULL, false} +}; #endif static struct resource_spec arm_gic_spec[] = { @@ -225,31 +185,6 @@ static int gic_config_irq(int irq, enum static void gic_post_filter(void *); #endif -static struct ofw_compat_data compat_data[] = { - {"arm,gic", true}, /* Non-standard, used in FreeBSD dts. */ - {"arm,gic-400", true}, - {"arm,cortex-a15-gic", true}, - {"arm,cortex-a9-gic", true}, - {"arm,cortex-a7-gic", true}, - {"arm,arm11mp-gic", true}, - {"brcm,brahma-b15-gic", true}, - {"qcom,msm-qgic2", true}, - {NULL, false} -}; - -static int -arm_gic_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) - return (ENXIO); - device_set_desc(dev, "ARM Generic Interrupt Controller"); - return (BUS_PROBE_DEFAULT); -} - #ifdef INTRNG static inline void gic_irq_unmask(struct arm_gic_softc *sc, u_int irq) @@ -427,16 +362,6 @@ gic_decode_fdt(phandle_t iparent, pcell_ #endif #ifdef INTRNG -static inline intptr_t -gic_xref(device_t dev) -{ -#ifdef FDT - return (OF_xref_from_node(ofw_bus_get_node(dev))); -#else - return (0); -#endif -} - static int arm_gic_register_isrcs(struct arm_gic_softc *sc, uint32_t num) { @@ -477,107 +402,6 @@ arm_gic_register_isrcs(struct arm_gic_so return (0); } -static int -arm_gic_fill_ranges(phandle_t node, struct arm_gic_softc *sc) -{ - pcell_t host_cells; - cell_t *base_ranges; - ssize_t nbase_ranges; - int i, j, k; - - host_cells = 1; - OF_getencprop(OF_parent(node), "#address-cells", &host_cells, - sizeof(host_cells)); - sc->addr_cells = 2; - OF_getencprop(node, "#address-cells", &sc->addr_cells, - sizeof(sc->addr_cells)); - sc->size_cells = 2; - OF_getencprop(node, "#size-cells", &sc->size_cells, - sizeof(sc->size_cells)); - - nbase_ranges = OF_getproplen(node, "ranges"); - if (nbase_ranges < 0) - return (-1); - sc->nranges = nbase_ranges / sizeof(cell_t) / - (sc->addr_cells + host_cells + sc->size_cells); - if (sc->nranges == 0) - return (0); - - sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]), - M_DEVBUF, M_WAITOK); - base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK); - OF_getencprop(node, "ranges", base_ranges, nbase_ranges); - - for (i = 0, j = 0; i < sc->nranges; i++) { - sc->ranges[i].bus = 0; - for (k = 0; k < sc->addr_cells; k++) { - sc->ranges[i].bus <<= 32; - sc->ranges[i].bus |= base_ranges[j++]; - } - sc->ranges[i].host = 0; - for (k = 0; k < host_cells; k++) { - sc->ranges[i].host <<= 32; - sc->ranges[i].host |= base_ranges[j++]; - } - sc->ranges[i].size = 0; - for (k = 0; k < sc->size_cells; k++) { - sc->ranges[i].size <<= 32; - sc->ranges[i].size |= base_ranges[j++]; - } - } - - free(base_ranges, M_DEVBUF); - return (sc->nranges); -} - -static bool -arm_gic_add_children(device_t dev) -{ - struct arm_gic_softc *sc; - struct arm_gic_devinfo *dinfo; - phandle_t child, node; - device_t cdev; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - - /* If we have no children don't probe for them */ - child = OF_child(node); - if (child == 0) - return (false); - - if (arm_gic_fill_ranges(node, sc) < 0) { - device_printf(dev, "Have a child, but no ranges\n"); - return (false); - } - - for (; child != 0; child = OF_peer(child)) { - dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); - - if (ofw_bus_gen_setup_devinfo(&dinfo->obdinfo, child) != 0) { - free(dinfo, M_DEVBUF); - continue; - } - - resource_list_init(&dinfo->rl); - ofw_bus_reg_to_rl(dev, child, sc->addr_cells, - sc->size_cells, &dinfo->rl); - - cdev = device_add_child(dev, NULL, -1); - if (cdev == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - dinfo->obdinfo.obd_name); - resource_list_free(&dinfo->rl); - ofw_bus_gen_destroy_devinfo(&dinfo->obdinfo); - free(dinfo, M_DEVBUF); - continue; - } - device_set_ivars(cdev, dinfo); - } - - return (true); -} - static void arm_gic_reserve_msi_range(device_t dev, u_int start, u_int count) { @@ -606,16 +430,12 @@ arm_gic_reserve_msi_range(device_t dev, } #endif -static int +int arm_gic_attach(device_t dev) { struct arm_gic_softc *sc; int i; uint32_t icciidr, mask, nirqs; -#ifdef INTRNG - phandle_t pxref; - intptr_t xref = gic_xref(dev); -#endif if (gic_sc) return (ENXIO); @@ -704,75 +524,60 @@ arm_gic_attach(device_t dev) /* Enable interrupt distribution */ gic_d_write_4(sc, GICD_CTLR, 0x01); -#ifndef INTRNG return (0); -#else - /* - * Now, when everything is initialized, it's right time to - * register interrupt controller to interrupt framefork. - */ - if (intr_pic_register(dev, xref) == NULL) { - device_printf(dev, "could not register PIC\n"); - goto cleanup; - } - /* - * Controller is root if: - * - doesn't have interrupt parent - * - his interrupt parent is this controller - */ - pxref = ofw_bus_find_iparent(ofw_bus_get_node(dev)); - if (pxref == 0 || xref == pxref) { - if (intr_pic_claim_root(dev, xref, arm_gic_intr, sc, - GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) { - device_printf(dev, "could not set PIC as a root\n"); - intr_pic_deregister(dev, xref); - goto cleanup; - } - } else { - if (sc->gic_res[2] == NULL) { - device_printf(dev, - "not root PIC must have defined interrupt\n"); - intr_pic_deregister(dev, xref); - goto cleanup; - } - if (bus_setup_intr(dev, sc->gic_res[2], INTR_TYPE_CLK, - arm_gic_intr, NULL, sc, &sc->gic_intrhand)) { - device_printf(dev, "could not setup irq handler\n"); - intr_pic_deregister(dev, xref); - goto cleanup; - } - } - - OF_device_register_xref(xref, dev); +#ifdef INTRNG +cleanup: + arm_gic_detach(dev); + return(ENXIO); +#endif +} - /* If we have children probe and attach them */ - if (arm_gic_add_children(dev)) { - bus_generic_probe(dev); - return (bus_generic_attach(dev)); - } +int +arm_gic_detach(device_t dev) +{ +#ifdef INTRNG + struct arm_gic_softc *sc; - return (0); + sc = device_get_softc(dev); -cleanup: - /* - * XXX - not implemented arm_gic_detach() should be called ! - */ if (sc->gic_irqs != NULL) free(sc->gic_irqs, M_DEVBUF); + bus_release_resources(dev, arm_gic_spec, sc->gic_res); - return(ENXIO); #endif + + return (0); } #ifdef INTRNG +static int +arm_gic_print_child(device_t bus, device_t child) +{ + struct resource_list *rl; + int rv; + + rv = bus_print_child_header(bus, child); + + rl = BUS_GET_RESOURCE_LIST(bus, child); + if (rl != NULL) { + rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, + "%#jx"); + rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); + } + + rv += bus_print_child_footer(bus, child); + + return (rv); +} + static struct resource * arm_gic_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct arm_gic_softc *sc; - struct arm_gic_devinfo *di; struct resource_list_entry *rle; + struct resource_list *rl; int j; KASSERT(type == SYS_RES_MEMORY, ("Invalid resoure type %x", type)); @@ -784,13 +589,12 @@ arm_gic_alloc_resource(device_t bus, dev * list stored in the local device info. */ if (RMAN_IS_DEFAULT_RANGE(start, end)) { - if ((di = device_get_ivars(child)) == NULL) - return (NULL); + rl = BUS_GET_RESOURCE_LIST(bus, child); if (type == SYS_RES_IOPORT) type = SYS_RES_MEMORY; - rle = resource_list_find(&di->rl, type, *rid); + rle = resource_list_find(rl, type, *rid); if (rle == NULL) { if (bootverbose) device_printf(bus, "no default resources for " @@ -825,17 +629,7 @@ arm_gic_alloc_resource(device_t bus, dev count, flags)); } -static const struct ofw_bus_devinfo * -arm_gic_ofw_get_devinfo(device_t bus __unused, device_t child) -{ - struct arm_gic_devinfo *di; - - di = device_get_ivars(child); - - return (&di->obdinfo); -} - -static int +int arm_gic_intr(void *arg) { struct arm_gic_softc *sc = arg; @@ -1494,25 +1288,14 @@ pic_ipi_clear(int ipi) #endif /* INTRNG */ static device_method_t arm_gic_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, arm_gic_probe), - DEVMETHOD(device_attach, arm_gic_attach), - #ifdef INTRNG /* Bus interface */ + DEVMETHOD(bus_print_child, arm_gic_print_child), DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_alloc_resource, arm_gic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, arm_gic_ofw_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, arm_gic_disable_intr), DEVMETHOD(pic_enable_intr, arm_gic_enable_intr), @@ -1532,18 +1315,8 @@ static device_method_t arm_gic_methods[] { 0, 0 } }; -static driver_t arm_gic_driver = { - "gic", - arm_gic_methods, - sizeof(struct arm_gic_softc), -}; - -static devclass_t arm_gic_devclass; - -EARLY_DRIVER_MODULE(gic, simplebus, arm_gic_driver, arm_gic_devclass, 0, 0, - BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); -EARLY_DRIVER_MODULE(gic, ofwbus, arm_gic_driver, arm_gic_devclass, 0, 0, - BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); +DEFINE_CLASS_0(gic, arm_gic_driver, arm_gic_methods, + sizeof(struct arm_gic_softc)); #ifdef INTRNG /* @@ -1556,34 +1329,7 @@ EARLY_DRIVER_MODULE(gic, ofwbus, arm_gic #define GICv2M_MSI_SETSPI_NS 0x040 #define GICV2M_MSI_IIDR 0xFCC -struct arm_gicv2m_softc { - struct resource *sc_mem; - struct mtx sc_mutex; - u_int sc_spi_start; - u_int sc_spi_end; - u_int sc_spi_count; -}; - -static struct ofw_compat_data gicv2m_compat_data[] = { - {"arm,gic-v2m-frame", true}, - {NULL, false} -}; - -static int -arm_gicv2m_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_search_compatible(dev, gicv2m_compat_data)->ocd_data) - return (ENXIO); - - device_set_desc(dev, "ARM Generic Interrupt Controller MSI/MSIX"); - return (BUS_PROBE_DEFAULT); -} - -static int +int arm_gicv2m_attach(device_t dev) { struct arm_gicv2m_softc *sc; @@ -1613,7 +1359,7 @@ arm_gicv2m_attach(device_t dev) mtx_init(&sc->sc_mutex, "GICv2m lock", "", MTX_DEF); - intr_msi_register(dev, gic_xref(dev)); + intr_msi_register(dev, sc->sc_xref); if (bootverbose) device_printf(dev, "using spi %u to %u\n", sc->sc_spi_start, @@ -1782,7 +1528,6 @@ arm_gicv2m_map_msi(device_t dev, device_ static device_method_t arm_gicv2m_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, arm_gicv2m_probe), DEVMETHOD(device_attach, arm_gicv2m_attach), /* MSI/MSI-X */ @@ -1798,9 +1543,4 @@ static device_method_t arm_gicv2m_method DEFINE_CLASS_0(gicv2m, arm_gicv2m_driver, arm_gicv2m_methods, sizeof(struct arm_gicv2m_softc)); - -static devclass_t arm_gicv2m_devclass; - -EARLY_DRIVER_MODULE(gicv2m, gic, arm_gicv2m_driver, - arm_gicv2m_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); #endif Added: head/sys/arm/arm/gic.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/gic.h Mon Aug 1 16:29:04 2016 (r303622) @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2011,2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Developed by Damjan Marion + * + * Based on OMAP4 GIC code by Ben Gray + * + * 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. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ARM_GIC_H_ +#define _ARM_GIC_H_ + +#define GIC_DEBUG_SPURIOUS + +#define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ +#define GIC_LAST_SGI 15 +#define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ +#define GIC_LAST_PPI 31 /* core) peripheral interrupts. */ +#define GIC_FIRST_SPI 32 /* Irqs 32+ are shared peripherals. */ + +#ifdef INTRNG +struct arm_gic_range { + uint64_t bus; + uint64_t host; + uint64_t size; +}; +#endif + +struct arm_gic_softc { + device_t gic_dev; +#ifdef INTRNG + void * gic_intrhand; + struct gic_irqsrc * gic_irqs; +#endif + struct resource * gic_res[3]; + bus_space_tag_t gic_c_bst; + bus_space_tag_t gic_d_bst; + bus_space_handle_t gic_c_bsh; + bus_space_handle_t gic_d_bsh; + uint8_t ver; + struct mtx mutex; + uint32_t nirqs; + uint32_t typer; +#ifdef GIC_DEBUG_SPURIOUS + uint32_t last_irq[MAXCPU]; +#endif + +#ifdef INTRNG + /* FDT child data */ + pcell_t addr_cells; + pcell_t size_cells; + int nranges; + struct arm_gic_range * ranges; +#endif +}; + +DECLARE_CLASS(arm_gic_driver); + +#ifdef INTRNG +struct arm_gicv2m_softc { + struct resource *sc_mem; + struct mtx sc_mutex; + uintptr_t sc_xref; + u_int sc_spi_start; + u_int sc_spi_end; + u_int sc_spi_count; +}; + +DECLARE_CLASS(arm_gicv2m_driver); +#endif + +int arm_gic_attach(device_t); +int arm_gic_detach(device_t); +int arm_gicv2m_attach(device_t); +int arm_gic_intr(void *); + +#endif /* _ARM_GIC_H_ */ Copied and modified: head/sys/arm/arm/gic_fdt.c (from r303614, head/sys/arm/arm/gic.c) ============================================================================== --- head/sys/arm/arm/gic.c Mon Aug 1 12:17:44 2016 (r303614, copy source) +++ head/sys/arm/arm/gic_fdt.c Mon Aug 1 16:29:04 2016 (r303622) @@ -1,7 +1,10 @@ /*- - * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (c) 2011,2016 The FreeBSD Foundation * All rights reserved. * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * * Developed by Damjan Marion * * Based on OMAP4 GIC code by Ben Gray @@ -31,198 +34,39 @@ * SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); -#include "opt_platform.h" - #include #include #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef INTRNG -#include -#endif - -#include -#include -#include #include -#include #include #include #include #include -#ifdef INTRNG -#include "pic_if.h" -#include "msi_if.h" -#endif - -#define GIC_DEBUG_SPURIOUS - -/* We are using GICv2 register naming */ - -/* Distributor Registers */ -#define GICD_CTLR 0x000 /* v1 ICDDCR */ -#define GICD_TYPER 0x004 /* v1 ICDICTR */ -#define GICD_IIDR 0x008 /* v1 ICDIIDR */ -#define GICD_IGROUPR(n) (0x0080 + ((n) * 4)) /* v1 ICDISER */ -#define GICD_ISENABLER(n) (0x0100 + ((n) * 4)) /* v1 ICDISER */ -#define GICD_ICENABLER(n) (0x0180 + ((n) * 4)) /* v1 ICDICER */ -#define GICD_ISPENDR(n) (0x0200 + ((n) * 4)) /* v1 ICDISPR */ -#define GICD_ICPENDR(n) (0x0280 + ((n) * 4)) /* v1 ICDICPR */ -#define GICD_ICACTIVER(n) (0x0380 + ((n) * 4)) /* v1 ICDABR */ -#define GICD_IPRIORITYR(n) (0x0400 + ((n) * 4)) /* v1 ICDIPR */ -#define GICD_ITARGETSR(n) (0x0800 + ((n) * 4)) /* v1 ICDIPTR */ -#define GICD_ICFGR(n) (0x0C00 + ((n) * 4)) /* v1 ICDICFR */ -#define GICD_SGIR(n) (0x0F00 + ((n) * 4)) /* v1 ICDSGIR */ -#define GICD_SGI_TARGET_SHIFT 16 - -/* CPU Registers */ -#define GICC_CTLR 0x0000 /* v1 ICCICR */ -#define GICC_PMR 0x0004 /* v1 ICCPMR */ -#define GICC_BPR 0x0008 /* v1 ICCBPR */ -#define GICC_IAR 0x000C /* v1 ICCIAR */ -#define GICC_EOIR 0x0010 /* v1 ICCEOIR */ -#define GICC_RPR 0x0014 /* v1 ICCRPR */ -#define GICC_HPPIR 0x0018 /* v1 ICCHPIR */ -#define GICC_ABPR 0x001C /* v1 ICCABPR */ -#define GICC_IIDR 0x00FC /* v1 ICCIIDR*/ - -#define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ -#define GIC_LAST_SGI 15 -#define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ -#define GIC_LAST_PPI 31 /* core) peripheral interrupts. */ -#define GIC_FIRST_SPI 32 /* Irqs 32+ are shared peripherals. */ - -/* TYPER Registers */ -#define GICD_TYPER_SECURITYEXT 0x400 -#define GIC_SUPPORT_SECEXT(_sc) \ - ((_sc->typer & GICD_TYPER_SECURITYEXT) == GICD_TYPER_SECURITYEXT) - -/* First bit is a polarity bit (0 - low, 1 - high) */ -#define GICD_ICFGR_POL_LOW (0 << 0) -#define GICD_ICFGR_POL_HIGH (1 << 0) -#define GICD_ICFGR_POL_MASK 0x1 -/* Second bit is a trigger bit (0 - level, 1 - edge) */ -#define GICD_ICFGR_TRIG_LVL (0 << 1) -#define GICD_ICFGR_TRIG_EDGE (1 << 1) -#define GICD_ICFGR_TRIG_MASK 0x2 - -#ifndef GIC_DEFAULT_ICFGR_INIT -#define GIC_DEFAULT_ICFGR_INIT 0x00000000 -#endif - -#ifdef INTRNG -struct gic_irqsrc { - struct intr_irqsrc gi_isrc; - uint32_t gi_irq; - enum intr_polarity gi_pol; - enum intr_trigger gi_trig; -#define GI_FLAG_EARLY_EOI (1 << 0) -#define GI_FLAG_MSI (1 << 1) /* This interrupt source should only */ - /* be used for MSI/MSI-X interrupts */ -#define GI_FLAG_MSI_USED (1 << 2) /* This irq is already allocated */ - /* for a MSI/MSI-X interrupt */ - u_int gi_flags; -}; - -static u_int gic_irq_cpu; -static int arm_gic_intr(void *); -static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc); - -#ifdef SMP -static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1]; -static u_int sgi_first_unused = GIC_FIRST_SGI; -#endif -#endif +#include #ifdef INTRNG -struct arm_gic_range { - uint64_t bus; - uint64_t host; - uint64_t size; -}; - struct arm_gic_devinfo { struct ofw_bus_devinfo obdinfo; struct resource_list rl; }; #endif -struct arm_gic_softc { - device_t gic_dev; -#ifdef INTRNG - void * gic_intrhand; - struct gic_irqsrc * gic_irqs; -#endif - struct resource * gic_res[3]; - bus_space_tag_t gic_c_bst; - bus_space_tag_t gic_d_bst; - bus_space_handle_t gic_c_bsh; - bus_space_handle_t gic_d_bsh; - uint8_t ver; - struct mtx mutex; - uint32_t nirqs; - uint32_t typer; -#ifdef GIC_DEBUG_SPURIOUS - uint32_t last_irq[MAXCPU]; -#endif - -#ifdef INTRNG - /* FDT child data */ - pcell_t addr_cells; - pcell_t size_cells; - int nranges; - struct arm_gic_range * ranges; -#endif -}; - -#ifdef INTRNG -#define GIC_INTR_ISRC(sc, irq) (&sc->gic_irqs[irq].gi_isrc) -#endif - -static struct resource_spec arm_gic_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Distributor registers */ - { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* CPU Interrupt Intf. registers */ +static device_probe_t gic_fdt_probe; +static device_attach_t gic_fdt_attach; +static ofw_bus_get_devinfo_t gic_ofw_get_devinfo; #ifdef INTRNG - { SYS_RES_IRQ, 0, RF_ACTIVE | RF_OPTIONAL }, /* Parent interrupt */ -#endif - { -1, 0 } -}; - -static u_int arm_gic_map[MAXCPU]; - -static struct arm_gic_softc *gic_sc = NULL; - -#define gic_c_read_4(_sc, _reg) \ - bus_space_read_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg)) -#define gic_c_write_4(_sc, _reg, _val) \ - bus_space_write_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg), (_val)) -#define gic_d_read_4(_sc, _reg) \ - bus_space_read_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg)) -#define gic_d_write_1(_sc, _reg, _val) \ - bus_space_write_1((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val)) -#define gic_d_write_4(_sc, _reg, _val) \ - bus_space_write_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val)) - -#ifndef INTRNG -static int gic_config_irq(int irq, enum intr_trigger trig, - enum intr_polarity pol); -static void gic_post_filter(void *); +static bus_get_resource_list_t gic_fdt_get_resource_list; +static bool arm_gic_add_children(device_t); #endif static struct ofw_compat_data compat_data[] = { @@ -237,8 +81,39 @@ static struct ofw_compat_data compat_dat {NULL, false} }; +static device_method_t gic_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gic_fdt_probe), + DEVMETHOD(device_attach, gic_fdt_attach), + +#ifdef INTRNG + /* Bus interface */ + DEVMETHOD(bus_get_resource_list,gic_fdt_get_resource_list), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, gic_ofw_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), +#endif + + DEVMETHOD_END, +}; + +DEFINE_CLASS_1(gic, gic_fdt_driver, gic_fdt_methods, + sizeof(struct arm_gic_softc), arm_gic_driver); + +static devclass_t gic_fdt_devclass; + +EARLY_DRIVER_MODULE(gic, simplebus, gic_fdt_driver, gic_fdt_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(gic, ofwbus, gic_fdt_driver, gic_fdt_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + static int -arm_gic_probe(device_t dev) +gic_fdt_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) @@ -250,231 +125,88 @@ arm_gic_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -#ifdef INTRNG -static inline void -gic_irq_unmask(struct arm_gic_softc *sc, u_int irq) -{ - - gic_d_write_4(sc, GICD_ISENABLER(irq >> 5), (1UL << (irq & 0x1F))); -} - -static inline void -gic_irq_mask(struct arm_gic_softc *sc, u_int irq) -{ - - gic_d_write_4(sc, GICD_ICENABLER(irq >> 5), (1UL << (irq & 0x1F))); -} -#endif - -static uint8_t -gic_cpu_mask(struct arm_gic_softc *sc) +static int +gic_fdt_attach(device_t dev) { - uint32_t mask; - int i; - - /* Read the current cpuid mask by reading ITARGETSR{0..7} */ - for (i = 0; i < 8; i++) { - mask = gic_d_read_4(sc, GICD_ITARGETSR(i)); - if (mask != 0) - break; - } - /* No mask found, assume we are on CPU interface 0 */ - if (mask == 0) - return (1); - - /* Collect the mask in the lower byte */ - mask |= mask >> 16; - mask |= mask >> 8; - - return (mask); -} - -#ifdef SMP #ifdef INTRNG -static void -arm_gic_init_secondary(device_t dev) -{ - struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq, cpu; - - /* Set the mask so we can find this CPU to send it IPIs */ - cpu = PCPU_GET(cpuid); - arm_gic_map[cpu] = gic_cpu_mask(sc); - - for (irq = 0; irq < sc->nirqs; irq += 4) - gic_d_write_4(sc, GICD_IPRIORITYR(irq >> 2), 0); - - /* Set all the interrupts to be in Group 0 (secure) */ - for (irq = 0; GIC_SUPPORT_SECEXT(sc) && irq < sc->nirqs; irq += 32) { - gic_d_write_4(sc, GICD_IGROUPR(irq >> 5), 0); - } - - /* Enable CPU interface */ - gic_c_write_4(sc, GICC_CTLR, 1); - - /* Set priority mask register. */ - gic_c_write_4(sc, GICC_PMR, 0xff); - - /* Enable interrupt distribution */ - gic_d_write_4(sc, GICD_CTLR, 0x01); - - /* Unmask attached SGI interrupts. */ - for (irq = GIC_FIRST_SGI; irq <= GIC_LAST_SGI; irq++) - if (intr_isrc_init_on_cpu(GIC_INTR_ISRC(sc, irq), cpu)) - gic_irq_unmask(sc, irq); - - /* Unmask attached PPI interrupts. */ - for (irq = GIC_FIRST_PPI; irq <= GIC_LAST_PPI; irq++) - if (intr_isrc_init_on_cpu(GIC_INTR_ISRC(sc, irq), cpu)) - gic_irq_unmask(sc, irq); -} -#else -static void -arm_gic_init_secondary(device_t dev) -{ struct arm_gic_softc *sc = device_get_softc(dev); - int i; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Aug 1 16:29:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEB45BAA6F2; Mon, 1 Aug 2016 16:29:33 +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 CCB8A1278; Mon, 1 Aug 2016 16:29:33 +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 u71GTXER083186; Mon, 1 Aug 2016 16:29:33 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71GTWOA083183; Mon, 1 Aug 2016 16:29:32 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201608011629.u71GTWOA083183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 1 Aug 2016 16:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303623 - in head/sys/mips: broadcom conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:29:34 -0000 Author: landonf Date: Mon Aug 1 16:29:32 2016 New Revision: 303623 URL: https://svnweb.freebsd.org/changeset/base/303623 Log: [mips/broadcom] Fetch UART console configuration from CFE. Relying on the boot loader console configuration allows us to use a common set of device hints for all SENTRY5 devices. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7376 Modified: head/sys/mips/broadcom/uart_cpu_chipc.c head/sys/mips/conf/SENTRY5.hints Modified: head/sys/mips/broadcom/uart_cpu_chipc.c ============================================================================== --- head/sys/mips/broadcom/uart_cpu_chipc.c Mon Aug 1 16:29:04 2016 (r303622) +++ head/sys/mips/broadcom/uart_cpu_chipc.c Mon Aug 1 16:29:32 2016 (r303623) @@ -47,6 +47,12 @@ __FBSDID("$FreeBSD$"); #include "bcm_socinfo.h" +#ifdef CFE +#include +#include +#include +#endif + bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; @@ -61,7 +67,7 @@ uart_cpu_eqres(struct uart_bas *b1, stru } static int -uart_cpu_init(struct uart_devinfo *di, int uart, int baudrate) +uart_cpu_init(struct uart_devinfo *di, u_int uart, int baudrate) { struct bcm_socinfo *socinfo; @@ -83,6 +89,44 @@ uart_cpu_init(struct uart_devinfo *di, i return (0); } +#ifdef CFE +static int +uart_getenv_cfe(int devtype, struct uart_devinfo *di) +{ + char device[sizeof("uartXX")]; + int baud, fd, len; + int ret; + u_int uart; + + /* CFE only vends console configuration */ + if (devtype != UART_DEV_CONSOLE) + return (ENODEV); + + /* Fetch console device */ + ret = cfe_getenv("BOOT_CONSOLE", device, sizeof(device)); + if (ret != CFE_OK) + return (ENXIO); + + /* Parse serial console unit. Fails on non-uart devices. */ + if (sscanf(device, "uart%u", &uart) != 1) + return (ENXIO); + + /* Fetch device handle */ + fd = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); + if (fd < 0) + return (ENXIO); + + /* Fetch serial configuration */ + ret = cfe_ioctl(fd, IOCTL_SERIAL_GETSPEED, (unsigned char *)&baud, + sizeof(baud), &len, 0); + if (ret != CFE_OK) + baud = CHIPC_UART_BAUDRATE; + + /* Initialize device info */ + return (uart_cpu_init(di, uart, baud)); +} +#endif /* CFE */ + int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { @@ -91,12 +135,18 @@ uart_cpu_getdev(int devtype, struct uart uart_bus_space_io = NULL; uart_bus_space_mem = mips_bus_space_generic; - /* Check the environment. */ +#ifdef CFE + /* Check the CFE environment */ + if (uart_getenv_cfe(devtype, di) == 0) + return (0); +#endif /* CFE */ + + /* Check the kernel environment. */ if (uart_getenv(devtype, di, chipc_uart_class) == 0) return (0); /* Scan the device hints for the first matching device */ - for (int i = 0; i < CHIPC_UART_MAX; i++) { + for (u_int i = 0; i < CHIPC_UART_MAX; i++) { if (resource_int_value("uart", i, "flags", &ivar)) continue; Modified: head/sys/mips/conf/SENTRY5.hints ============================================================================== --- head/sys/mips/conf/SENTRY5.hints Mon Aug 1 16:29:04 2016 (r303622) +++ head/sys/mips/conf/SENTRY5.hints Mon Aug 1 16:29:32 2016 (r303623) @@ -2,6 +2,3 @@ hint.bhnd.0.at="nexus0" hint.bhnd.0.maddr="0x18000000" hint.bhnd.0.msize="0x00100000" - -# console on uart1 -hint.uart.1.flags="0x10" From owner-svn-src-head@freebsd.org Mon Aug 1 16:40:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CA8CBAAA52 for ; Mon, 1 Aug 2016 16:40:36 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D69791B22 for ; Mon, 1 Aug 2016 16:40:35 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: a7fd057a-5806-11e6-a0ff-e511cd071b9b X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Mon, 1 Aug 2016 16:40:28 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u71GdOMW034225; Mon, 1 Aug 2016 10:39:24 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1470069564.1283.20.camel@freebsd.org> Subject: Re: svn commit: r303586 - head/bin/sh From: Ian Lepore To: Alexey Dokuchaev , Jilles Tjoelker Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 01 Aug 2016 10:39:24 -0600 In-Reply-To: <20160731134316.GB85936@FreeBSD.org> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> <20160731134316.GB85936@FreeBSD.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:40:36 -0000 On Sun, 2016-07-31 at 13:43 +0000, Alexey Dokuchaev wrote: > On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: > > New Revision: 303586 > > URL: https://svnweb.freebsd.org/changeset/base/303586 > > > > Log: > > sh: Fix a clang warning. > > > > Submitted by: bdrewery > > > > Modified: > > head/bin/sh/expand.c > > > > Modified: head/bin/sh/expand.c > > =================================================================== > > =========== > > --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r3 > > 03585) > > +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r3 > > 03586) > > @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in > > if (--in.nleft < 0) { > > if (in.fd < 0) > > break; > > - while ((i = read(in.fd, buf, sizeof buf)) > > < 0 && errno == EINTR); > > + while ((i = read(in.fd, buf, sizeof buf)) > > < 0 && errno == EINTR) > > + ; > > `continue;' would be even better; some tools might barf at stray > semicolon. > > ./danfe > I strongly agree that the right way to do an empty loop is to use "continue;" on a line by itself. Unfortunately, what style(9) suggests by way of example is a single semicolon on a line by itself with a comment of "/* nothing */" to the right on the same line. Ick. -- Ian From owner-svn-src-head@freebsd.org Mon Aug 1 16:40:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0345BAAAAC; Mon, 1 Aug 2016 16:40:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE00E1CB4; Mon, 1 Aug 2016 16:40:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71GehpZ087268; Mon, 1 Aug 2016 16:40:43 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71GehrP087259; Mon, 1 Aug 2016 16:40:43 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608011640.u71GehrP087259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 1 Aug 2016 16:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303625 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:40:44 -0000 Author: pfg Date: Mon Aug 1 16:40:42 2016 New Revision: 303625 URL: https://svnweb.freebsd.org/changeset/base/303625 Log: indent(1): Use a dash in the license headers. Use of the canonical dash avoids indent(1) from reformatting the license headers. Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent.c head/usr.bin/indent/indent.h head/usr.bin/indent/indent_codes.h head/usr.bin/indent/indent_globs.h head/usr.bin/indent/io.c head/usr.bin/indent/lexi.c head/usr.bin/indent/parse.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/args.c Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/indent.c Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1976 Board of Trustees of the University of Illinois. * Copyright (c) 1980, 1993 Modified: head/usr.bin/indent/indent.h ============================================================================== --- head/usr.bin/indent/indent.h Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/indent.h Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Jens Schweikhardt * All rights reserved. * Modified: head/usr.bin/indent/indent_codes.h ============================================================================== --- head/usr.bin/indent/indent_codes.h Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/indent_codes.h Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/indent_globs.h Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/io.c Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/lexi.c Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. Modified: head/usr.bin/indent/parse.c ============================================================================== --- head/usr.bin/indent/parse.c Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/parse.c Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. Modified: head/usr.bin/indent/pr_comment.c ============================================================================== --- head/usr.bin/indent/pr_comment.c Mon Aug 1 16:39:40 2016 (r303624) +++ head/usr.bin/indent/pr_comment.c Mon Aug 1 16:40:42 2016 (r303625) @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1985 Sun Microsystems, Inc. * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. From owner-svn-src-head@freebsd.org Mon Aug 1 16:51:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CA0BBAADB1; Mon, 1 Aug 2016 16:51:02 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E27F14A6; Mon, 1 Aug 2016 16:51:01 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A5DFD2065B; Mon, 1 Aug 2016 12:51:00 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Mon, 01 Aug 2016 12:51:00 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=p9LQ5qAFxdGh8gPJcIxufIJGjic=; b=FY8ViV zCjlDrUW22n+03fg3XPetsO6ICdwldcMIKKjPlVMNCmS/K+Q04XjLJ3Vl0Kub0wh ZQ5ZOX8yEp5RPK7H8cUVuEQuxN5Qdf85l5Ikk6l41rOXhoa3VJHTEFbfd0U1VbcE yzw1lWAqmVilVorqPg1L/hE42RmiGmKHAPSic= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=p9LQ5qAFxdGh8gP JcIxufIJGjic=; b=RlBFmD0tB4fhQbxoR3kFyUI97iDBoTB/SOTS6gKmLhVZOrA eU4RWZp+09kgZxrDhc9gkjczyRFpe8NHnhl9ADNJIhmFXRHuZSuaVL2dSDFfztNg 6eEhXfsx3CVQyXpU8T25wT0dHR1Med51iREwhYTvhg+c/V/73JeEkj1ztxOY= X-Sasl-enc: ihHbw/liH9/aZcJXWdnyosA1/D2RTR4BHqJgzwIitfYM 1470070260 Received: from pion.local (unknown [5.148.105.34]) by mail.messagingengine.com (Postfix) with ESMTPA id E9F51CCD80; Mon, 1 Aug 2016 12:50:59 -0400 (EDT) Subject: Re: svn commit: r303522 - head/sys/dev/cxgbe To: Ian Lepore , John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607292211.u6TMBTEJ092580@repo.freebsd.org> <86806f53-8ecd-d7d7-aad3-592d6b702609@fastmail.net> <1470070196.1283.25.camel@freebsd.org> From: Bruce Simpson Message-ID: Date: Mon, 1 Aug 2016 17:50:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1470070196.1283.25.camel@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:51:02 -0000 On 01/08/16 17:49, Ian Lepore wrote: ... > In addition, the strerror() output for ENOTTY says nothing about a > typewriter, the text is "Inappropriate ioctl for device." If that semantic gap has already been plugged, ignore my message. From owner-svn-src-head@freebsd.org Mon Aug 1 16:51:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89079BAAED8 for ; Mon, 1 Aug 2016 16:51:14 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D55191654 for ; Mon, 1 Aug 2016 16:51:13 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 0368576a-5808-11e6-ac92-3142cfe117f2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.eu.mailhop.org (Halon Mail Gateway) with ESMTPSA; Mon, 1 Aug 2016 16:50:11 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u71GnuC1034256; Mon, 1 Aug 2016 10:49:56 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1470070196.1283.25.camel@freebsd.org> Subject: Re: svn commit: r303522 - head/sys/dev/cxgbe From: Ian Lepore To: Bruce Simpson , John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 01 Aug 2016 10:49:56 -0600 In-Reply-To: <86806f53-8ecd-d7d7-aad3-592d6b702609@fastmail.net> References: <201607292211.u6TMBTEJ092580@repo.freebsd.org> <86806f53-8ecd-d7d7-aad3-592d6b702609@fastmail.net> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:51:14 -0000 On Mon, 2016-08-01 at 16:38 +0100, Bruce Simpson wrote: > "Yes, I know it's not a typewriter. Why is this command not working?" > > Perhaps this errno code should be aliased... and strerror() massaged > in > places... assuming we strictly follow the POSIX. > It's not clear just what point you're trying to make. ENOTTY has a special meaning as a return value from an ioctl call in some contexts (it specifically means the called routine did not handle the command and other routines hooked into the ioctl call chain may be able to do the job). In addition, the strerror() output for ENOTTY says nothing about a typewriter, the text is "Inappropriate ioctl for device." -- Ian From owner-svn-src-head@freebsd.org Mon Aug 1 17:02:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C260BBAB2D6; Mon, 1 Aug 2016 17:02:22 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 872CB1E35; Mon, 1 Aug 2016 17:02:22 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71H2LAF095818; Mon, 1 Aug 2016 17:02:21 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71H2L1e095815; Mon, 1 Aug 2016 17:02:21 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201608011702.u71H2L1e095815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 1 Aug 2016 17:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303626 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 17:02:22 -0000 Author: gallatin Date: Mon Aug 1 17:02:21 2016 New Revision: 303626 URL: https://svnweb.freebsd.org/changeset/base/303626 Log: Rework IPV6 TCP path MTU discovery to match IPv4 - Re-write tcp_ctlinput6() to closely mimic the IPv4 tcp_ctlinput() - Now that tcp_ctlinput6() updates t_maxseg, we can allow ip6_output() to send TCP packets without looking at the tcp host cache for every single transmit. - Make the icmp6 code mimic the IPv4 code & avoid returning PRC_HOSTDEAD because it is so expensive. Without these changes in place, every TCP6 pmtu discovery or host unreachable ICMP resulted in a call to in6_pcbnotify() which walks the tcbinfo table with the write lock held. Because the tcbinfo table is shared between IPv4 and IPv6, this causes huge scalabilty issues on servers with lots of (~100K) TCP connections, to the point where even a small percent of IPv6 traffic had a disproportionate impact on overall throughput. Reviewed by: bz, rrs, ae (all earlier versions), lstewart (in Netflix's tree) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D7272 Modified: head/sys/netinet/tcp_subr.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Mon Aug 1 16:40:42 2016 (r303625) +++ head/sys/netinet/tcp_subr.c Mon Aug 1 17:02:21 2016 (r303626) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #ifdef INET6 +#include #include #include #include @@ -2040,72 +2041,146 @@ tcp_ctlinput(int cmd, struct sockaddr *s void tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d) { - struct tcphdr th; + struct in6_addr *dst; + struct tcphdr *th; struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify; struct ip6_hdr *ip6; struct mbuf *m; + struct inpcb *inp; + struct tcpcb *tp; + struct icmp6_hdr *icmp6; struct ip6ctlparam *ip6cp = NULL; const struct sockaddr_in6 *sa6_src = NULL; - int off; - struct tcp_portonly { - u_int16_t th_sport; - u_int16_t th_dport; - } *thp; + struct in_conninfo inc; + tcp_seq icmp_tcp_seq; + unsigned int mtu; + unsigned int off; + if (sa->sa_family != AF_INET6 || sa->sa_len != sizeof(struct sockaddr_in6)) return; - if (cmd == PRC_MSGSIZE) - notify = tcp_mtudisc_notify; - else if (!PRC_IS_REDIRECT(cmd) && - ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0)) - return; - /* if the parameter is from icmp6, decode it. */ if (d != NULL) { ip6cp = (struct ip6ctlparam *)d; + icmp6 = ip6cp->ip6c_icmp6; m = ip6cp->ip6c_m; ip6 = ip6cp->ip6c_ip6; off = ip6cp->ip6c_off; sa6_src = ip6cp->ip6c_src; + dst = ip6cp->ip6c_finaldst; } else { m = NULL; ip6 = NULL; off = 0; /* fool gcc */ sa6_src = &sa6_any; + dst = NULL; } - if (ip6 != NULL) { - struct in_conninfo inc; - /* - * XXX: We assume that when IPV6 is non NULL, - * M and OFF are valid. - */ + if (cmd == PRC_MSGSIZE) + notify = tcp_mtudisc_notify; + else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || + cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && + ip6 != NULL) + notify = tcp_drop_syn_sent; - /* check if we can safely examine src and dst ports */ - if (m->m_pkthdr.len < off + sizeof(*thp)) - return; + /* + * Hostdead is ugly because it goes linearly through all PCBs. + * XXX: We never get this from ICMP, otherwise it makes an + * excellent DoS attack on machines with many connections. + */ + else if (cmd == PRC_HOSTDEAD) + ip6 = NULL; + else if ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0) + return; - bzero(&th, sizeof(th)); - m_copydata(m, off, sizeof(*thp), (caddr_t)&th); + if (ip6 == NULL) { + in6_pcbnotify(&V_tcbinfo, sa, 0, + (const struct sockaddr *)sa6_src, + 0, cmd, NULL, notify); + return; + } - in6_pcbnotify(&V_tcbinfo, sa, th.th_dport, - (struct sockaddr *)ip6cp->ip6c_src, - th.th_sport, cmd, NULL, notify); + /* Check if we can safely get the ports from the tcp hdr */ + if (m == NULL || + (m->m_pkthdr.len < + (int32_t) (off + offsetof(struct tcphdr, th_seq)))) { + return; + } + th = (struct tcphdr *) mtodo(ip6cp->ip6c_m, ip6cp->ip6c_off); + INP_INFO_RLOCK(&V_tcbinfo); + inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_dst, th->th_dport, + &ip6->ip6_src, th->th_sport, INPLOOKUP_WLOCKPCB, NULL); + if (inp != NULL && PRC_IS_REDIRECT(cmd)) { + /* signal EHOSTDOWN, as it flushes the cached route */ + inp = (*notify)(inp, EHOSTDOWN); + if (inp != NULL) + INP_WUNLOCK(inp); + } else if (inp != NULL) { + if (!(inp->inp_flags & INP_TIMEWAIT) && + !(inp->inp_flags & INP_DROPPED) && + !(inp->inp_socket == NULL)) { + icmp_tcp_seq = ntohl(th->th_seq); + tp = intotcpcb(inp); + if (SEQ_GEQ(icmp_tcp_seq, tp->snd_una) && + SEQ_LT(icmp_tcp_seq, tp->snd_max)) { + if (cmd == PRC_MSGSIZE) { + /* + * MTU discovery: + * If we got a needfrag set the MTU + * in the route to the suggested new + * value (if given) and then notify. + */ + mtu = ntohl(icmp6->icmp6_mtu); + /* + * If no alternative MTU was + * proposed, or the proposed + * MTU was too small, set to + * the min. + */ + if (mtu < IPV6_MMTU) + mtu = IPV6_MMTU - 8; + + + bzero(&inc, sizeof(inc)); + inc.inc_fibnum = M_GETFIB(m); + inc.inc_flags |= INC_ISIPV6; + inc.inc6_faddr = *dst; + if (in6_setscope(&inc.inc6_faddr, + m->m_pkthdr.rcvif, NULL)) + goto unlock_inp; + + /* + * Only process the offered MTU if it + * is smaller than the current one. + */ + if (mtu < tp->t_maxseg + + (sizeof (*th) + sizeof (*ip6))) { + tcp_hc_updatemtu(&inc, mtu); + tcp_mtudisc(inp, mtu); + ICMP6STAT_INC(icp6s_pmtuchg); + } + } else + inp = (*notify)(inp, + inet6ctlerrmap[cmd]); + } + } +unlock_inp: + if (inp != NULL) + INP_WUNLOCK(inp); + } else { bzero(&inc, sizeof(inc)); - inc.inc_fport = th.th_dport; - inc.inc_lport = th.th_sport; - inc.inc6_faddr = ((struct sockaddr_in6 *)sa)->sin6_addr; - inc.inc6_laddr = ip6cp->ip6c_src->sin6_addr; + inc.inc_fibnum = M_GETFIB(m); inc.inc_flags |= INC_ISIPV6; - INP_INFO_RLOCK(&V_tcbinfo); - syncache_unreach(&inc, &th); - INP_INFO_RUNLOCK(&V_tcbinfo); - } else - in6_pcbnotify(&V_tcbinfo, sa, 0, (const struct sockaddr *)sa6_src, - 0, cmd, NULL, notify); + inc.inc_fport = th->th_dport; + inc.inc_lport = th->th_sport; + inc.inc6_faddr = *dst; + inc.inc6_laddr = ip6->ip6_src; + syncache_unreach(&inc, th); + } + INP_INFO_RUNLOCK(&V_tcbinfo); } #endif /* INET6 */ Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Mon Aug 1 16:40:42 2016 (r303625) +++ head/sys/netinet6/icmp6.c Mon Aug 1 17:02:21 2016 (r303626) @@ -485,15 +485,13 @@ icmp6_input(struct mbuf **mp, int *offp, icmp6_ifstat_inc(ifp, ifs6_in_dstunreach); switch (code) { case ICMP6_DST_UNREACH_NOROUTE: + case ICMP6_DST_UNREACH_ADDR: /* PRC_HOSTDEAD is a DOS */ code = PRC_UNREACH_NET; break; case ICMP6_DST_UNREACH_ADMIN: icmp6_ifstat_inc(ifp, ifs6_in_adminprohib); code = PRC_UNREACH_PROTOCOL; /* is this a good code? */ break; - case ICMP6_DST_UNREACH_ADDR: - code = PRC_HOSTDEAD; - break; case ICMP6_DST_UNREACH_BEYONDSCOPE: /* I mean "source address was incorrect." */ code = PRC_PARAMPROB; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Mon Aug 1 16:40:42 2016 (r303625) +++ head/sys/netinet6/ip6_output.c Mon Aug 1 17:02:21 2016 (r303626) @@ -150,9 +150,10 @@ static int ip6_insertfraghdr(struct mbuf static int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t); static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *); static int ip6_getpmtu(struct route_in6 *, int, - struct ifnet *, const struct in6_addr *, u_long *, int *, u_int); + struct ifnet *, const struct in6_addr *, u_long *, int *, u_int, + u_int); static int ip6_calcmtu(struct ifnet *, const struct in6_addr *, u_long, - u_long *, int *); + u_long *, int *, u_int); static int ip6_getpmtu_ctl(u_int, const struct in6_addr *, u_long *); static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int); @@ -718,7 +719,7 @@ again: /* Determine path MTU. */ if ((error = ip6_getpmtu(ro_pmtu, ro != ro_pmtu, ifp, &ip6->ip6_dst, - &mtu, &alwaysfrag, fibnum)) != 0) + &mtu, &alwaysfrag, fibnum, *nexthdrp)) != 0) goto bad; /* @@ -1250,7 +1251,7 @@ ip6_getpmtu_ctl(u_int fibnum, const stru ifp = nh6.nh_ifp; mtu = nh6.nh_mtu; - error = ip6_calcmtu(ifp, dst, mtu, mtup, NULL); + error = ip6_calcmtu(ifp, dst, mtu, mtup, NULL, 0); fib6_free_nh_ext(fibnum, &nh6); return (error); @@ -1269,7 +1270,7 @@ ip6_getpmtu_ctl(u_int fibnum, const stru static int ip6_getpmtu(struct route_in6 *ro_pmtu, int do_lookup, struct ifnet *ifp, const struct in6_addr *dst, u_long *mtup, - int *alwaysfragp, u_int fibnum) + int *alwaysfragp, u_int fibnum, u_int proto) { struct nhop6_basic nh6; struct in6_addr kdst; @@ -1307,7 +1308,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, i if (ro_pmtu->ro_rt) mtu = ro_pmtu->ro_rt->rt_mtu; - return (ip6_calcmtu(ifp, dst, mtu, mtup, alwaysfragp)); + return (ip6_calcmtu(ifp, dst, mtu, mtup, alwaysfragp, proto)); } /* @@ -1319,7 +1320,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, i */ static int ip6_calcmtu(struct ifnet *ifp, const struct in6_addr *dst, u_long rt_mtu, - u_long *mtup, int *alwaysfragp) + u_long *mtup, int *alwaysfragp, u_int proto) { u_long mtu = 0; int alwaysfrag = 0; @@ -1334,7 +1335,11 @@ ip6_calcmtu(struct ifnet *ifp, const str inc.inc6_faddr = *dst; ifmtu = IN6_LINKMTU(ifp); - mtu = tcp_hc_getmtu(&inc); + + /* TCP is known to react to pmtu changes so skip hc */ + if (proto != IPPROTO_TCP) + mtu = tcp_hc_getmtu(&inc); + if (mtu) mtu = min(mtu, rt_mtu); else From owner-svn-src-head@freebsd.org Mon Aug 1 17:25:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 190FABAB7AB; Mon, 1 Aug 2016 17:25:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D07DD1A12; Mon, 1 Aug 2016 17:25:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71HP8N7005386; Mon, 1 Aug 2016 17:25:08 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71HP8IN005385; Mon, 1 Aug 2016 17:25:08 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201608011725.u71HP8IN005385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 1 Aug 2016 17:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303627 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 17:25:09 -0000 Author: alc Date: Mon Aug 1 17:25:07 2016 New Revision: 303627 URL: https://svnweb.freebsd.org/changeset/base/303627 Log: Restore the historical behavior of "sysctl vm.swap_idle_enabled=1". Prior to r254304, we had separate functions for reclamation and laundering (vm_pageout_scan) versus updating usage information, i.e., "reference bits", on active pages (vm_pageout_page_stats), and we only performed vm_req_vmdaemon(VM_SWAP_IDLE) if vm_pages_needed was true. However, since r254303, if vm_swap_idle_enabled was "1", we have performed vm_req_vmdaemon(VM_SWAP_IDLE) regardless of whether we are short of free pages. This was unintended and too aggressive, so I suspect no one uses this feature. With this change, we restore the historical behavior and only perform vm_req_vmdaemon(VM_SWAP_IDLE) when we are short of free pages. Reviewed by: kib, markj Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Mon Aug 1 17:02:21 2016 (r303626) +++ head/sys/vm/vm_pageout.c Mon Aug 1 17:25:07 2016 (r303627) @@ -1289,9 +1289,10 @@ relock_queue: vm_pagequeue_unlock(pq); #if !defined(NO_SWAPPING) /* - * Idle process swapout -- run once per second. + * Idle process swapout -- run once per second when we are reclaiming + * pages. */ - if (vm_swap_idle_enabled) { + if (vm_swap_idle_enabled && pass > 0) { static long lsec; if (time_second != lsec) { vm_req_vmdaemon(VM_SWAP_IDLE); From owner-svn-src-head@freebsd.org Mon Aug 1 18:17:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29398BAB424; Mon, 1 Aug 2016 18:17:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A72B186E; Mon, 1 Aug 2016 18:17:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D4943B94B; Mon, 1 Aug 2016 14:17:50 -0400 (EDT) From: John Baldwin To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303503 - head/sys/kern Date: Mon, 01 Aug 2016 11:11:13 -0700 Message-ID: <2029591.4vEqM4NCGk@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160730101227.J1336@besplex.bde.org> References: <201607292019.u6TKJE98050271@repo.freebsd.org> <20160730101227.J1336@besplex.bde.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 01 Aug 2016 14:17:50 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 18:17:52 -0000 On Saturday, July 30, 2016 10:38:34 AM Bruce Evans wrote: > On Fri, 29 Jul 2016, John Baldwin wrote: > > > Log: > > Don't treat NOCPU as a valid CPU to CPU_ISSET. > > > > If a thread is created bound to a cpuset it might already be bound before > > it's very first timeslice, and td_lastcpu will be NOCPU in that case. > > > > MFC after: 1 week > > Thanks. Did you get this from your mail queue on 2016/05/08? No. :( I will go back and check that mail to see what else I missed. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Aug 1 19:24:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EEAFBABD34; Mon, 1 Aug 2016 19:24:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2489B17A2; Mon, 1 Aug 2016 19:24:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71JO1SV050559; Mon, 1 Aug 2016 19:24:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71JO1RH050558; Mon, 1 Aug 2016 19:24:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608011924.u71JO1RH050558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 1 Aug 2016 19:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303629 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 19:24:02 -0000 Author: pfg Date: Mon Aug 1 19:24:01 2016 New Revision: 303629 URL: https://svnweb.freebsd.org/changeset/base/303629 Log: indent: Avoid using values of pointers that refer to deallocated space. For now maintain the local style in this file. Reviewed by: jilles Reference: https://github.com/pstef/freebsd_indent/commit/9099a9f17bc5f579514a4c11111f5cf3df6624c6 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent_globs.h Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Mon Aug 1 17:51:35 2016 (r303628) +++ head/usr.bin/indent/indent_globs.h Mon Aug 1 19:24:01 2016 (r303629) @@ -57,41 +57,46 @@ FILE *output; /* the output file #define CHECK_SIZE_CODE \ if (e_code >= l_code) { \ int nsize = l_code-s_code+400; \ + int code_len = e_code-s_code; \ codebuf = (char *) realloc(codebuf, nsize); \ if (codebuf == NULL) \ err(1, NULL); \ - e_code = codebuf + (e_code-s_code) + 1; \ + e_code = codebuf + code_len + 1; \ l_code = codebuf + nsize - 5; \ s_code = codebuf + 1; \ } #define CHECK_SIZE_COM \ if (e_com >= l_com) { \ int nsize = l_com-s_com+400; \ + int com_len = e_com - s_com; \ + int blank_pos = last_bl - s_com; \ combuf = (char *) realloc(combuf, nsize); \ if (combuf == NULL) \ err(1, NULL); \ - e_com = combuf + (e_com-s_com) + 1; \ - last_bl = combuf + (last_bl-s_com) + 1; \ + e_com = combuf + com_len + 1; \ + last_bl = combuf + blank_pos + 1; \ l_com = combuf + nsize - 5; \ s_com = combuf + 1; \ } #define CHECK_SIZE_LAB \ if (e_lab >= l_lab) { \ int nsize = l_lab-s_lab+400; \ + int label_len = e_lab - s_lab; \ labbuf = (char *) realloc(labbuf, nsize); \ if (labbuf == NULL) \ err(1, NULL); \ - e_lab = labbuf + (e_lab-s_lab) + 1; \ + e_lab = labbuf + label_len + 1; \ l_lab = labbuf + nsize - 5; \ s_lab = labbuf + 1; \ } #define CHECK_SIZE_TOKEN \ if (e_token >= l_token) { \ int nsize = l_token-s_token+400; \ + int token_len = e_token - s_token; \ tokenbuf = (char *) realloc(tokenbuf, nsize); \ if (tokenbuf == NULL) \ err(1, NULL); \ - e_token = tokenbuf + (e_token-s_token) + 1; \ + e_token = tokenbuf + token_len + 1; \ l_token = tokenbuf + nsize - 5; \ s_token = tokenbuf + 1; \ } From owner-svn-src-head@freebsd.org Mon Aug 1 19:37:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17685BAB3ED; Mon, 1 Aug 2016 19:37:45 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E71ED1637; Mon, 1 Aug 2016 19:37:44 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71JbiHM055121; Mon, 1 Aug 2016 19:37:44 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71JbhGD055117; Mon, 1 Aug 2016 19:37:43 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201608011937.u71JbhGD055117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Mon, 1 Aug 2016 19:37:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303630 - in head/sys: boot/zfs cddl/boot/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 19:37:45 -0000 Author: allanjude Date: Mon Aug 1 19:37:43 2016 New Revision: 303630 URL: https://svnweb.freebsd.org/changeset/base/303630 Log: Make boot code and loader check for unsupported ZFS feature flags OpenZFS uses feature flags instead of a zpool version number to track features since the split from Oracle. In addition to avoiding confusion on ZFS vs OpenZFS version numbers, this also allows features to be added to different operating systems that use OpenZFS in different order. The previous zfs boot code (gptzfsboot) and loader (zfsloader) blindly tries to read the pool, and if failed provided only a vague error message. With this change, both the boot code and loader check the MOS features list in the ZFS label and compare it against the list of features that the loader supports. If any unsupported feature is active, the pool is not considered as a candidate for booting, and a helpful diagnostic message is printed to the screen. Features that are merely enabled via zpool upgrade, but not in use, do not block booting from the pool. Submitted by: Toomas Soome Reviewed by: delphij, mav Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6857 Modified: head/sys/boot/zfs/libzfs.h head/sys/boot/zfs/zfs.c head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/sys/boot/zfs/libzfs.h ============================================================================== --- head/sys/boot/zfs/libzfs.h Mon Aug 1 19:24:01 2016 (r303629) +++ head/sys/boot/zfs/libzfs.h Mon Aug 1 19:37:43 2016 (r303630) @@ -65,7 +65,7 @@ int zfs_probe_dev(const char *devname, u int zfs_list(const char *name); void init_zfs_bootenv(char *currdev); int zfs_bootenv(const char *name); -int zfs_belist_add(const char *name); +int zfs_belist_add(const char *name, uint64_t __unused); int zfs_set_env(void); extern struct devsw zfs_dev; Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Mon Aug 1 19:24:01 2016 (r303629) +++ head/sys/boot/zfs/zfs.c Mon Aug 1 19:37:43 2016 (r303630) @@ -801,7 +801,7 @@ zfs_bootenv(const char *name) } int -zfs_belist_add(const char *name) +zfs_belist_add(const char *name, uint64_t value __unused) { /* Skip special datasets that start with a $ character */ Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Mon Aug 1 19:24:01 2016 (r303629) +++ head/sys/boot/zfs/zfsimpl.c Mon Aug 1 19:37:43 2016 (r303630) @@ -1473,12 +1473,12 @@ zap_lookup(const spa_t *spa, const dnode * the directory contents. */ static int -mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *)) +mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t)) { const mzap_phys_t *mz; const mzap_ent_phys_t *mze; size_t size; - int chunks, i; + int chunks, i, rc; /* * Microzap objects use exactly one block. Read the whole @@ -1490,9 +1490,11 @@ mzap_list(const dnode_phys_t *dnode, int for (i = 0; i < chunks; i++) { mze = &mz->mz_chunk[i]; - if (mze->mze_name[0]) - //printf("%-32s 0x%jx\n", mze->mze_name, (uintmax_t)mze->mze_value); - callback(mze->mze_name); + if (mze->mze_name[0]) { + rc = callback(mze->mze_name, mze->mze_value); + if (rc != 0) + return (rc); + } } return (0); @@ -1503,12 +1505,12 @@ mzap_list(const dnode_phys_t *dnode, int * the directory header. */ static int -fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *)) +fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t)) { int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT; zap_phys_t zh = *(zap_phys_t *) zap_scratch; fat_zap_t z; - int i, j; + int i, j, rc; if (zh.zap_magic != ZAP_MAGIC) return (EIO); @@ -1566,14 +1568,16 @@ fzap_list(const spa_t *spa, const dnode_ value = fzap_leaf_value(&zl, zc); //printf("%s 0x%jx\n", name, (uintmax_t)value); - callback((const char *)name); + rc = callback((const char *)name, value); + if (rc != 0) + return (rc); } } return (0); } -static int zfs_printf(const char *name) +static int zfs_printf(const char *name, uint64_t value __unused) { printf("%s\n", name); @@ -1868,7 +1872,7 @@ zfs_list_dataset(const spa_t *spa, uint6 } int -zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *name)) +zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *, uint64_t)) { uint64_t dir_obj, child_dir_zapobj, zap_type; dnode_phys_t child_dir_zap, dir, dataset; @@ -2008,9 +2012,67 @@ zfs_mount(const spa_t *spa, uint64_t roo return (0); } +/* + * callback function for feature name checks. + */ +static int +check_feature(const char *name, uint64_t value) +{ + int i; + + if (value == 0) + return (0); + if (name[0] == '\0') + return (0); + + for (i = 0; features_for_read[i] != NULL; i++) { + if (strcmp(name, features_for_read[i]) == 0) + return (0); + } + printf("ZFS: unsupported feature: %s\n", name); + return (EIO); +} + +/* + * Checks whether the MOS features that are active are supported. + */ +static int +check_mos_features(const spa_t *spa) +{ + dnode_phys_t dir; + uint64_t objnum, zap_type; + size_t size; + int rc; + + if ((rc = objset_get_dnode(spa, &spa->spa_mos, DMU_OT_OBJECT_DIRECTORY, + &dir)) != 0) + return (rc); + if ((rc = zap_lookup(spa, &dir, DMU_POOL_FEATURES_FOR_READ, &objnum)) != 0) + return (rc); + + if ((rc = objset_get_dnode(spa, &spa->spa_mos, objnum, &dir)) != 0) + return (rc); + + if (dir.dn_type != DMU_OTN_ZAP_METADATA) + return (EIO); + + size = dir.dn_datablkszsec * 512; + if (dnode_read(spa, &dir, 0, zap_scratch, size)) + return (EIO); + + zap_type = *(uint64_t *) zap_scratch; + if (zap_type == ZBT_MICRO) + rc = mzap_list(&dir, check_feature); + else + rc = fzap_list(spa, &dir, check_feature); + + return (rc); +} + static int zfs_spa_init(spa_t *spa) { + int rc; if (zio_read(spa, &spa->spa_uberblock.ub_rootbp, &spa->spa_mos)) { printf("ZFS: can't read MOS of pool %s\n", spa->spa_name); @@ -2020,7 +2082,13 @@ zfs_spa_init(spa_t *spa) printf("ZFS: corrupted MOS of pool %s\n", spa->spa_name); return (EIO); } - return (0); + + rc = check_mos_features(spa); + if (rc != 0) { + printf("ZFS: pool %s is not supported\n", spa->spa_name); + } + + return (rc); } static int Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Mon Aug 1 19:24:01 2016 (r303629) +++ head/sys/cddl/boot/zfs/zfsimpl.h Mon Aug 1 19:37:43 2016 (r303630) @@ -63,6 +63,8 @@ #define _NOTE(s) +typedef enum { B_FALSE, B_TRUE } boolean_t; + /* CRC64 table */ #define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ @@ -899,6 +901,41 @@ typedef struct dnode_phys { blkptr_t dn_spill; } dnode_phys_t; +typedef enum dmu_object_byteswap { + DMU_BSWAP_UINT8, + DMU_BSWAP_UINT16, + DMU_BSWAP_UINT32, + DMU_BSWAP_UINT64, + DMU_BSWAP_ZAP, + DMU_BSWAP_DNODE, + DMU_BSWAP_OBJSET, + DMU_BSWAP_ZNODE, + DMU_BSWAP_OLDACL, + DMU_BSWAP_ACL, + /* + * Allocating a new byteswap type number makes the on-disk format + * incompatible with any other format that uses the same number. + * + * Data can usually be structured to work with one of the + * DMU_BSWAP_UINT* or DMU_BSWAP_ZAP types. + */ + DMU_BSWAP_NUMFUNCS +} dmu_object_byteswap_t; + +#define DMU_OT_NEWTYPE 0x80 +#define DMU_OT_METADATA 0x40 +#define DMU_OT_BYTESWAP_MASK 0x3f + +/* + * Defines a uint8_t object type. Object types specify if the data + * in the object is metadata (boolean) and how to byteswap the data + * (dmu_object_byteswap_t). + */ +#define DMU_OT(byteswap, metadata) \ + (DMU_OT_NEWTYPE | \ + ((metadata) ? DMU_OT_METADATA : 0) | \ + ((byteswap) & DMU_OT_BYTESWAP_MASK)) + typedef enum dmu_object_type { DMU_OT_NONE, /* general: */ @@ -959,7 +996,21 @@ typedef enum dmu_object_type { DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */ DMU_OT_SCAN_XLATE, /* ZAP */ DMU_OT_DEDUP, /* fake dedup BP from ddt_bp_create() */ - DMU_OT_NUMTYPES + DMU_OT_NUMTYPES, + + /* + * Names for valid types declared with DMU_OT(). + */ + DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE), + DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE), + DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE), + DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE), + DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE), + DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE), + DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE), + DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE), + DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE), + DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE) } dmu_object_type_t; typedef enum dmu_objset_type { @@ -1097,6 +1148,7 @@ typedef struct dsl_dataset_phys { */ #define DMU_POOL_DIRECTORY_OBJECT 1 #define DMU_POOL_CONFIG "config" +#define DMU_POOL_FEATURES_FOR_READ "features_for_read" #define DMU_POOL_ROOT_DATASET "root_dataset" #define DMU_POOL_SYNC_BPLIST "sync_bplist" #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" From owner-svn-src-head@freebsd.org Mon Aug 1 19:49:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1EB7BAB90E; Mon, 1 Aug 2016 19:49:43 +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 B4C1C11F3; Mon, 1 Aug 2016 19:49:43 +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 u71Jng86058974; Mon, 1 Aug 2016 19:49:42 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71JngPt058973; Mon, 1 Aug 2016 19:49:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201608011949.u71JngPt058973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 1 Aug 2016 19:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303631 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 19:49:44 -0000 Author: dim Date: Mon Aug 1 19:49:42 2016 New Revision: 303631 URL: https://svnweb.freebsd.org/changeset/base/303631 Log: Fix non-functional bsdinstall services dialog. The most recent version of bsdinstall does not seem to respect any of the checkboxes in the "Choose the services you would like to be started at boot" dialog. None of the chosen services end up in the rc.conf file that is installed onto the target system. This is caused by the bsdinstall/scripts/hardening script, which implements the new hardening options dialog. The script starts by overwriting the previously written rc.conf.services file: echo -n > $BSDINSTALL_TMPETC/rc.conf.services which is obviously incorrect. It should clear out rc.conf.hardening instead. Reviewed by: allanjude PR: 211506 MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7387 Modified: head/usr.sbin/bsdinstall/scripts/hardening Modified: head/usr.sbin/bsdinstall/scripts/hardening ============================================================================== --- head/usr.sbin/bsdinstall/scripts/hardening Mon Aug 1 19:37:43 2016 (r303630) +++ head/usr.sbin/bsdinstall/scripts/hardening Mon Aug 1 19:49:42 2016 (r303631) @@ -28,7 +28,7 @@ : ${DIALOG_OK=0} -echo -n > $BSDINSTALL_TMPETC/rc.conf.services +echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening exec 3>&1 FEATURES=$( dialog --backtitle "FreeBSD Installer" \ From owner-svn-src-head@freebsd.org Mon Aug 1 20:27:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C986BAAD94; Mon, 1 Aug 2016 20:27:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 457A51AB1; Mon, 1 Aug 2016 20:27:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71KRBNL074014; Mon, 1 Aug 2016 20:27:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71KRBl3074013; Mon, 1 Aug 2016 20:27:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608012027.u71KRBl3074013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 1 Aug 2016 20:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303635 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 20:27:12 -0000 Author: markj Date: Mon Aug 1 20:27:11 2016 New Revision: 303635 URL: https://svnweb.freebsd.org/changeset/base/303635 Log: MFV 29f27e847: "IB/cma: Use cached gids" This addresses a regression from an earlier upstream change which caused cma_acquire_dev() to bypass the port GID cache and instead query the HCA for each entry in its GID table. These queries can become extremely slow on multiport devices, which has a negative impact on connection setup times. Discussed with: hselasky Obtained from: Linux MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/core/cma.c Modified: head/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 1 20:02:59 2016 (r303634) +++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 1 20:27:11 2016 (r303635) @@ -485,7 +485,7 @@ static int cma_acquire_dev(struct rdma_i struct cma_device *cma_dev; union ib_gid gid, iboe_gid; int ret = -ENODEV; - u8 port; + u8 port, found_port; enum rdma_link_layer dev_ll = dev_addr->dev_type == ARPHRD_INFINIBAND ? IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET; @@ -500,21 +500,20 @@ static int cma_acquire_dev(struct rdma_i memcpy(&gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof gid); list_for_each_entry(cma_dev, &dev_list, list) { - for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) { + for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) if (rdma_port_get_link_layer(cma_dev->device, port) == dev_ll) { if (rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB && rdma_port_get_link_layer(cma_dev->device, port) == IB_LINK_LAYER_ETHERNET) - ret = find_gid_port(cma_dev->device, &iboe_gid, port); + ret = ib_find_cached_gid(cma_dev->device, &iboe_gid, &found_port, NULL); else - ret = find_gid_port(cma_dev->device, &gid, port); + ret = ib_find_cached_gid(cma_dev->device, &gid, &found_port, NULL); - if (!ret) { + if (!ret && (port == found_port)) { id_priv->id.port_num = port; goto out; } else if (ret == 1) - break; - } - } + break; + } } out: From owner-svn-src-head@freebsd.org Mon Aug 1 20:29:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5EC8BAAE45; Mon, 1 Aug 2016 20:29:10 +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 813DB1CB1; Mon, 1 Aug 2016 20:29:10 +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 u71KT9QF074119; Mon, 1 Aug 2016 20:29:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71KT9rF074118; Mon, 1 Aug 2016 20:29:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608012029.u71KT9rF074118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 1 Aug 2016 20:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303636 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 20:29:10 -0000 Author: markj Date: Mon Aug 1 20:29:09 2016 New Revision: 303636 URL: https://svnweb.freebsd.org/changeset/base/303636 Log: MFV be9130cc9: "IB/cma: Check for GID on listening devices first" This is an optimization that improves IB connection setup times. Discussed with: hselasky Obtained from: Linux MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/core/cma.c Modified: head/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 1 20:27:11 2016 (r303635) +++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 1 20:29:09 2016 (r303636) @@ -479,7 +479,8 @@ err: } EXPORT_SYMBOL(rdma_find_cmid_laddr); -static int cma_acquire_dev(struct rdma_id_private *id_priv) +static int cma_acquire_dev(struct rdma_id_private *id_priv, + struct rdma_id_private *listen_id_priv) { struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; struct cma_device *cma_dev; @@ -499,8 +500,30 @@ static int cma_acquire_dev(struct rdma_i memcpy(&gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof gid); + if (listen_id_priv && + rdma_port_get_link_layer(listen_id_priv->id.device, + listen_id_priv->id.port_num) == dev_ll) { + cma_dev = listen_id_priv->cma_dev; + port = listen_id_priv->id.port_num; + if (rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB && + rdma_port_get_link_layer(cma_dev->device, port) == IB_LINK_LAYER_ETHERNET) + ret = ib_find_cached_gid(cma_dev->device, &iboe_gid, + &found_port, NULL); + else + ret = ib_find_cached_gid(cma_dev->device, &gid, + &found_port, NULL); + + if (!ret && (port == found_port)) { + id_priv->id.port_num = found_port; + goto out; + } + } list_for_each_entry(cma_dev, &dev_list, list) { - for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) + for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) { + if (listen_id_priv && + listen_id_priv->cma_dev == cma_dev && + listen_id_priv->id.port_num == port) + continue; if (rdma_port_get_link_layer(cma_dev->device, port) == dev_ll) { if (rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB && rdma_port_get_link_layer(cma_dev->device, port) == IB_LINK_LAYER_ETHERNET) @@ -514,6 +537,7 @@ static int cma_acquire_dev(struct rdma_i } else if (ret == 1) break; } + } } out: @@ -1423,7 +1447,7 @@ static int cma_req_handler(struct ib_cm_ } mutex_lock_nested(&conn_id->handler_mutex, SINGLE_DEPTH_NESTING); - ret = cma_acquire_dev(conn_id); + ret = cma_acquire_dev(conn_id, listen_id); if (ret) goto err2; @@ -1656,7 +1680,7 @@ static int iw_conn_req_handler(struct iw goto out; } - ret = cma_acquire_dev(conn_id); + ret = cma_acquire_dev(conn_id, listen_id); if (ret) { mutex_unlock(&conn_id->handler_mutex); rdma_destroy_id(new_cm_id); @@ -2218,7 +2242,7 @@ static void addr_handler(int status, str memcpy(&id_priv->id.route.addr.src_addr, src_addr, ip_addr_size(src_addr)); if (!status && !id_priv->cma_dev) - status = cma_acquire_dev(id_priv); + status = cma_acquire_dev(id_priv, NULL); if (status) { if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED, @@ -2744,7 +2768,7 @@ int rdma_bind_addr(struct rdma_cm_id *id if (ret) goto err1; - ret = cma_acquire_dev(id_priv); + ret = cma_acquire_dev(id_priv, NULL); if (ret) goto err1; } From owner-svn-src-head@freebsd.org Mon Aug 1 20:54:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47258BAB8BC; Mon, 1 Aug 2016 20:54:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 179821F1E; Mon, 1 Aug 2016 20:54:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71KssnZ084871; Mon, 1 Aug 2016 20:54:54 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71KssUh084870; Mon, 1 Aug 2016 20:54:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201608012054.u71KssUh084870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 1 Aug 2016 20:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303637 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 20:54:55 -0000 Author: ae Date: Mon Aug 1 20:54:54 2016 New Revision: 303637 URL: https://svnweb.freebsd.org/changeset/base/303637 Log: Do not invoke resize event if initial disk size is zero. Some disks report the size only after first opening. And due to the events are asynchronous, some consumers can receive this event too late and this confuses them. This partially restores previous behaviour, and at the same time this should fix the problem, when already opened provider loses resize event. PR: 211028 MFC after: 3 weeks Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Mon Aug 1 20:29:09 2016 (r303636) +++ head/sys/geom/geom_disk.c Mon Aug 1 20:54:54 2016 (r303637) @@ -142,7 +142,14 @@ g_disk_access(struct g_provider *pp, int pp->stripeoffset = dp->d_stripeoffset; pp->stripesize = dp->d_stripesize; dp->d_flags |= DISKFLAG_OPEN; - g_resize_provider(pp, dp->d_mediasize); + /* + * Do not invoke resize event when initial size was zero. + * Some disks report its size only after first opening. + */ + if (pp->mediasize == 0) + pp->mediasize = dp->d_mediasize; + else + g_resize_provider(pp, dp->d_mediasize); } else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) { if (dp->d_close != NULL) { error = dp->d_close(dp); From owner-svn-src-head@freebsd.org Mon Aug 1 21:19:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17D0DBABEB1; Mon, 1 Aug 2016 21:19:53 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA9DA1EA8; Mon, 1 Aug 2016 21:19:52 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71LJqGq092308; Mon, 1 Aug 2016 21:19:52 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71LJqV4092307; Mon, 1 Aug 2016 21:19:52 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201608012119.u71LJqV4092307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Mon, 1 Aug 2016 21:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303638 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 21:19:53 -0000 Author: sbruno Date: Mon Aug 1 21:19:51 2016 New Revision: 303638 URL: https://svnweb.freebsd.org/changeset/base/303638 Log: r293331 mistakingly failed to add an assignment of paddr to the rxbuf but only in the NETMAP code. This lead to the NETMAP code paths passing nothing up to userland. Submitted by: Ad Schellevis Reported by: Franco Fichtner MFC after: 1 day Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Aug 1 20:54:54 2016 (r303637) +++ head/sys/dev/e1000/if_em.c Mon Aug 1 21:19:51 2016 (r303638) @@ -4392,6 +4392,7 @@ em_setup_receive_ring(struct rx_ring *rx addr = PNMB(na, slot + si, &paddr); netmap_load_map(na, rxr->rxtag, rxbuf->map, addr); + rxbuf->paddr = paddr; em_setup_rxdesc(&rxr->rx_base[j], rxbuf); continue; } From owner-svn-src-head@freebsd.org Mon Aug 1 21:48:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15288BAB69B; Mon, 1 Aug 2016 21:48:39 +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 D5CC3132A; Mon, 1 Aug 2016 21:48:38 +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 u71LmcbC003745; Mon, 1 Aug 2016 21:48:38 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71LmbaA003739; Mon, 1 Aug 2016 21:48:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201608012148.u71LmbaA003739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 1 Aug 2016 21:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303643 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 21:48:39 -0000 Author: mjg Date: Mon Aug 1 21:48:37 2016 New Revision: 303643 URL: https://svnweb.freebsd.org/changeset/base/303643 Log: Implement trivial backoff for locking primitives. All current spinning loops retry an atomic op the first chance they get, which leads to performance degradation under load. One classic solution to the problem consists of delaying the test to an extent. This implementation has a trivial linear increment and a random factor for each attempt. For simplicity, this first thouch implementation only modifies spinning loops where the lock owner is running. spin mutexes and thread lock were not modified. Current parameters are autotuned on boot based on mp_cpus. Autotune factors are very conservative and are subject to change later. Reviewed by: kib, jhb Tested by: pho MFC after: 1 week Modified: head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/kern/subr_lock.c head/sys/sys/lock.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Mon Aug 1 21:28:34 2016 (r303642) +++ head/sys/kern/kern_mutex.c Mon Aug 1 21:48:37 2016 (r303643) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -138,6 +139,37 @@ struct lock_class lock_class_mtx_spin = #endif }; +#ifdef ADAPTIVE_MUTEXES +static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging"); + +static struct lock_delay_config mtx_delay = { + .initial = 1000, + .step = 500, + .min = 100, + .max = 5000, +}; + +SYSCTL_INT(_debug_mtx, OID_AUTO, delay_initial, CTLFLAG_RW, &mtx_delay.initial, + 0, ""); +SYSCTL_INT(_debug_mtx, OID_AUTO, delay_step, CTLFLAG_RW, &mtx_delay.step, + 0, ""); +SYSCTL_INT(_debug_mtx, OID_AUTO, delay_min, CTLFLAG_RW, &mtx_delay.min, + 0, ""); +SYSCTL_INT(_debug_mtx, OID_AUTO, delay_max, CTLFLAG_RW, &mtx_delay.max, + 0, ""); + +static void +mtx_delay_sysinit(void *dummy) +{ + + mtx_delay.initial = mp_ncpus * 25; + mtx_delay.step = (mp_ncpus * 25) / 2; + mtx_delay.min = mp_ncpus * 5; + mtx_delay.max = mp_ncpus * 25 * 10; +} +LOCK_DELAY_SYSINIT(mtx_delay_sysinit); +#endif + /* * System-wide mutexes */ @@ -408,8 +440,10 @@ __mtx_lock_sleep(volatile uintptr_t *c, int contested = 0; uint64_t waittime = 0; #endif +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + struct lock_delay_arg lda; +#endif #ifdef KDTRACE_HOOKS - u_int spin_cnt = 0; u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; @@ -418,6 +452,9 @@ __mtx_lock_sleep(volatile uintptr_t *c, if (SCHEDULER_STOPPED()) return; +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, &mtx_delay); +#endif m = mtxlock2mtx(c); if (mtx_owned(m)) { @@ -451,7 +488,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, if (m->mtx_lock == MTX_UNOWNED && _mtx_obtain_lock(m, tid)) break; #ifdef KDTRACE_HOOKS - spin_cnt++; + lda.spin_cnt++; #endif #ifdef ADAPTIVE_MUTEXES /* @@ -471,12 +508,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, "spinning", "lockname:\"%s\"", m->lock_object.lo_name); while (mtx_owner(m) == owner && - TD_IS_RUNNING(owner)) { - cpu_spinwait(); -#ifdef KDTRACE_HOOKS - spin_cnt++; -#endif - } + TD_IS_RUNNING(owner)) + lock_delay(&lda); KTR_STATE0(KTR_SCHED, "thread", sched_tdname((struct thread *)tid), "running"); @@ -570,7 +603,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, /* * Only record the loops spinning and not sleeping. */ - if (spin_cnt > sleep_cnt) + if (lda.spin_cnt > sleep_cnt) LOCKSTAT_RECORD1(adaptive__spin, m, all_time - sleep_time); #endif } Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Mon Aug 1 21:28:34 2016 (r303642) +++ head/sys/kern/kern_rwlock.c Mon Aug 1 21:48:37 2016 (r303643) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -65,15 +66,6 @@ PMC_SOFT_DECLARE( , , lock, failed); */ #define rwlock2rw(c) (__containerof(c, struct rwlock, rw_lock)) -#ifdef ADAPTIVE_RWLOCKS -static int rowner_retries = 10; -static int rowner_loops = 10000; -static SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL, - "rwlock debugging"); -SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, ""); -SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, ""); -#endif - #ifdef DDB #include @@ -100,6 +92,42 @@ struct lock_class lock_class_rw = { #endif }; +#ifdef ADAPTIVE_RWLOCKS +static int rowner_retries = 10; +static int rowner_loops = 10000; +static SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL, + "rwlock debugging"); +SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, ""); +SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, ""); + +static struct lock_delay_config rw_delay = { + .initial = 1000, + .step = 500, + .min = 100, + .max = 5000, +}; + +SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_initial, CTLFLAG_RW, &rw_delay.initial, + 0, ""); +SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_step, CTLFLAG_RW, &rw_delay.step, + 0, ""); +SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_min, CTLFLAG_RW, &rw_delay.min, + 0, ""); +SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_max, CTLFLAG_RW, &rw_delay.max, + 0, ""); + +static void +rw_delay_sysinit(void *dummy) +{ + + rw_delay.initial = mp_ncpus * 25; + rw_delay.step = (mp_ncpus * 25) / 2; + rw_delay.min = mp_ncpus * 5; + rw_delay.max = mp_ncpus * 25 * 10; +} +LOCK_DELAY_SYSINIT(rw_delay_sysinit); +#endif + /* * Return a pointer to the owning thread if the lock is write-locked or * NULL if the lock is unlocked or read-locked. @@ -355,9 +383,11 @@ __rw_rlock(volatile uintptr_t *c, const int contested = 0; #endif uintptr_t v; +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + struct lock_delay_arg lda; +#endif #ifdef KDTRACE_HOOKS uintptr_t state; - u_int spin_cnt = 0; u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; @@ -366,6 +396,9 @@ __rw_rlock(volatile uintptr_t *c, const if (SCHEDULER_STOPPED()) return; +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, &rw_delay); +#endif rw = rwlock2rw(c); KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), @@ -412,7 +445,7 @@ __rw_rlock(volatile uintptr_t *c, const continue; } #ifdef KDTRACE_HOOKS - spin_cnt++; + lda.spin_cnt++; #endif #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); @@ -437,12 +470,8 @@ __rw_rlock(volatile uintptr_t *c, const sched_tdname(curthread), "spinning", "lockname:\"%s\"", rw->lock_object.lo_name); while ((struct thread*)RW_OWNER(rw->rw_lock) == - owner && TD_IS_RUNNING(owner)) { - cpu_spinwait(); -#ifdef KDTRACE_HOOKS - spin_cnt++; -#endif - } + owner && TD_IS_RUNNING(owner)) + lock_delay(&lda); KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); continue; @@ -459,7 +488,7 @@ __rw_rlock(volatile uintptr_t *c, const cpu_spinwait(); } #ifdef KDTRACE_HOOKS - spin_cnt += rowner_loops - i; + lda.spin_cnt += rowner_loops - i; #endif KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); @@ -552,7 +581,7 @@ __rw_rlock(volatile uintptr_t *c, const (state & RW_LOCK_READ) == 0 ? 0 : RW_READERS(state)); /* Record only the loops spinning and not sleeping. */ - if (spin_cnt > sleep_cnt) + if (lda.spin_cnt > sleep_cnt) LOCKSTAT_RECORD4(rw__spin, rw, all_time - sleep_time, LOCKSTAT_READER, (state & RW_LOCK_READ) == 0, (state & RW_LOCK_READ) == 0 ? 0 : RW_READERS(state)); @@ -740,9 +769,11 @@ __rw_wlock_hard(volatile uintptr_t *c, u uint64_t waittime = 0; int contested = 0; #endif +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + struct lock_delay_arg lda; +#endif #ifdef KDTRACE_HOOKS uintptr_t state; - u_int spin_cnt = 0; u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; @@ -751,6 +782,9 @@ __rw_wlock_hard(volatile uintptr_t *c, u if (SCHEDULER_STOPPED()) return; +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, &rw_delay); +#endif rw = rwlock2rw(c); if (rw_wlocked(rw)) { @@ -775,7 +809,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u if (rw->rw_lock == RW_UNLOCKED && _rw_write_lock(rw, tid)) break; #ifdef KDTRACE_HOOKS - spin_cnt++; + lda.spin_cnt++; #endif #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); @@ -798,12 +832,8 @@ __rw_wlock_hard(volatile uintptr_t *c, u "spinning", "lockname:\"%s\"", rw->lock_object.lo_name); while ((struct thread*)RW_OWNER(rw->rw_lock) == owner && - TD_IS_RUNNING(owner)) { - cpu_spinwait(); -#ifdef KDTRACE_HOOKS - spin_cnt++; -#endif - } + TD_IS_RUNNING(owner)) + lock_delay(&lda); KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); continue; @@ -828,7 +858,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); #ifdef KDTRACE_HOOKS - spin_cnt += rowner_loops - i; + lda.spin_cnt += rowner_loops - i; #endif if (i != rowner_loops) continue; @@ -918,7 +948,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u (state & RW_LOCK_READ) == 0 ? 0 : RW_READERS(state)); /* Record only the loops spinning and not sleeping. */ - if (spin_cnt > sleep_cnt) + if (lda.spin_cnt > sleep_cnt) LOCKSTAT_RECORD4(rw__spin, rw, all_time - sleep_time, LOCKSTAT_WRITER, (state & RW_LOCK_READ) == 0, (state & RW_LOCK_READ) == 0 ? 0 : RW_READERS(state)); Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Mon Aug 1 21:28:34 2016 (r303642) +++ head/sys/kern/kern_sx.c Mon Aug 1 21:48:37 2016 (r303643) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #if defined(SMP) && !defined(NO_ADAPTIVE_SX) @@ -145,6 +146,33 @@ static u_int asx_loops = 10000; static SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging"); SYSCTL_UINT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, ""); SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, ""); + +static struct lock_delay_config sx_delay = { + .initial = 1000, + .step = 500, + .min = 100, + .max = 5000, +}; + +SYSCTL_INT(_debug_sx, OID_AUTO, delay_initial, CTLFLAG_RW, &sx_delay.initial, + 0, ""); +SYSCTL_INT(_debug_sx, OID_AUTO, delay_step, CTLFLAG_RW, &sx_delay.step, + 0, ""); +SYSCTL_INT(_debug_sx, OID_AUTO, delay_min, CTLFLAG_RW, &sx_delay.min, + 0, ""); +SYSCTL_INT(_debug_sx, OID_AUTO, delay_max, CTLFLAG_RW, &sx_delay.max, + 0, ""); + +static void +sx_delay_sysinit(void *dummy) +{ + + sx_delay.initial = mp_ncpus * 25; + sx_delay.step = (mp_ncpus * 25) / 2; + sx_delay.min = mp_ncpus * 5; + sx_delay.max = mp_ncpus * 25 * 10; +} +LOCK_DELAY_SYSINIT(sx_delay_sysinit); #endif void @@ -513,9 +541,11 @@ _sx_xlock_hard(struct sx *sx, uintptr_t int contested = 0; #endif int error = 0; +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + struct lock_delay_arg lda; +#endif #ifdef KDTRACE_HOOKS uintptr_t state; - u_int spin_cnt = 0; u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; @@ -524,6 +554,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t if (SCHEDULER_STOPPED()) return (0); +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, &sx_delay); +#endif + /* If we already hold an exclusive lock, then recurse. */ if (sx_xlocked(sx)) { KASSERT((sx->lock_object.lo_flags & LO_RECURSABLE) != 0, @@ -549,7 +583,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid)) break; #ifdef KDTRACE_HOOKS - spin_cnt++; + lda.spin_cnt++; #endif #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); @@ -578,12 +612,8 @@ _sx_xlock_hard(struct sx *sx, uintptr_t sx->lock_object.lo_name); GIANT_SAVE(); while (SX_OWNER(sx->sx_lock) == x && - TD_IS_RUNNING(owner)) { - cpu_spinwait(); -#ifdef KDTRACE_HOOKS - spin_cnt++; -#endif - } + TD_IS_RUNNING(owner)) + lock_delay(&lda); KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); continue; @@ -605,7 +635,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t break; cpu_spinwait(); #ifdef KDTRACE_HOOKS - spin_cnt++; + lda.spin_cnt++; #endif } KTR_STATE0(KTR_SCHED, "thread", @@ -725,7 +755,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t LOCKSTAT_RECORD4(sx__block, sx, sleep_time, LOCKSTAT_WRITER, (state & SX_LOCK_SHARED) == 0, (state & SX_LOCK_SHARED) == 0 ? 0 : SX_SHARERS(state)); - if (spin_cnt > sleep_cnt) + if (lda.spin_cnt > sleep_cnt) LOCKSTAT_RECORD4(sx__spin, sx, all_time - sleep_time, LOCKSTAT_WRITER, (state & SX_LOCK_SHARED) == 0, (state & SX_LOCK_SHARED) == 0 ? 0 : SX_SHARERS(state)); @@ -818,9 +848,11 @@ _sx_slock_hard(struct sx *sx, int opts, #endif uintptr_t x; int error = 0; +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + struct lock_delay_arg lda; +#endif #ifdef KDTRACE_HOOKS uintptr_t state; - u_int spin_cnt = 0; u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; @@ -829,6 +861,9 @@ _sx_slock_hard(struct sx *sx, int opts, if (SCHEDULER_STOPPED()) return (0); +#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, &sx_delay); +#endif #ifdef KDTRACE_HOOKS state = sx->sx_lock; all_time -= lockstat_nsecs(&sx->lock_object); @@ -840,7 +875,7 @@ _sx_slock_hard(struct sx *sx, int opts, */ for (;;) { #ifdef KDTRACE_HOOKS - spin_cnt++; + lda.spin_cnt++; #endif x = sx->sx_lock; @@ -888,12 +923,8 @@ _sx_slock_hard(struct sx *sx, int opts, "lockname:\"%s\"", sx->lock_object.lo_name); GIANT_SAVE(); while (SX_OWNER(sx->sx_lock) == x && - TD_IS_RUNNING(owner)) { - cpu_spinwait(); -#ifdef KDTRACE_HOOKS - spin_cnt++; -#endif - } + TD_IS_RUNNING(owner)) + lock_delay(&lda); KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread), "running"); continue; @@ -989,7 +1020,7 @@ _sx_slock_hard(struct sx *sx, int opts, LOCKSTAT_RECORD4(sx__block, sx, sleep_time, LOCKSTAT_READER, (state & SX_LOCK_SHARED) == 0, (state & SX_LOCK_SHARED) == 0 ? 0 : SX_SHARERS(state)); - if (spin_cnt > sleep_cnt) + if (lda.spin_cnt > sleep_cnt) LOCKSTAT_RECORD4(sx__spin, sx, all_time - sleep_time, LOCKSTAT_READER, (state & SX_LOCK_SHARED) == 0, (state & SX_LOCK_SHARED) == 0 ? 0 : SX_SHARERS(state)); Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Mon Aug 1 21:28:34 2016 (r303642) +++ head/sys/kern/subr_lock.c Mon Aug 1 21:48:37 2016 (r303643) @@ -103,6 +103,34 @@ lock_destroy(struct lock_object *lock) lock->lo_flags &= ~LO_INITIALIZED; } +void +lock_delay(struct lock_delay_arg *la) +{ + u_int i, delay, backoff, min, max; + struct lock_delay_config *lc = la->config; + + delay = la->delay; + + if (delay == 0) + delay = lc->initial; + else { + delay += lc->step; + max = lc->max; + if (delay > max) + delay = max; + } + + backoff = cpu_ticks() % delay; + min = lc->min; + if (backoff < min) + backoff = min; + for (i = 0; i < backoff; i++) + cpu_spinwait(); + + la->delay = delay; + la->spin_cnt += backoff; +} + #ifdef DDB DB_SHOW_COMMAND(lock, db_show_lock) { Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Mon Aug 1 21:28:34 2016 (r303642) +++ head/sys/sys/lock.h Mon Aug 1 21:48:37 2016 (r303643) @@ -201,9 +201,33 @@ extern struct lock_class lock_class_lock extern struct lock_class *lock_classes[]; +struct lock_delay_config { + u_int initial; + u_int step; + u_int min; + u_int max; +}; + +struct lock_delay_arg { + struct lock_delay_config *config; + u_int delay; + u_int spin_cnt; +}; + +static inline void +lock_delay_arg_init(struct lock_delay_arg *la, struct lock_delay_config *lc) { + la->config = lc; + la->delay = 0; + la->spin_cnt = 0; +} + +#define LOCK_DELAY_SYSINIT(func) \ + SYSINIT(func##_ld, SI_SUB_LOCK, SI_ORDER_ANY, func, NULL) + void lock_init(struct lock_object *, struct lock_class *, const char *, const char *, int); void lock_destroy(struct lock_object *); +void lock_delay(struct lock_delay_arg *); void spinlock_enter(void); void spinlock_exit(void); void witness_init(struct lock_object *, const char *); From owner-svn-src-head@freebsd.org Mon Aug 1 22:19:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9860ABAC047; Mon, 1 Aug 2016 22:19:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6591416A0; Mon, 1 Aug 2016 22:19:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71MJNKf014759; Mon, 1 Aug 2016 22:19:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71MJNdV014758; Mon, 1 Aug 2016 22:19:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608012219.u71MJNdV014758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 1 Aug 2016 22:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303645 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 22:19:24 -0000 Author: jhb Date: Mon Aug 1 22:19:23 2016 New Revision: 303645 URL: https://svnweb.freebsd.org/changeset/base/303645 Log: Disable PCI hotplug support for slots with power controllers. After further review of the spec, I do not think the current HotPlug code handles slots with power controllers correctly. In particular, the power state of the slot is to be inferred from other events, not from examining the state of the power control bit in SLOT_CTL. For now, disable PCI hotplug support on such slots. PR: 211081 Tested by: Jeffrey E Pieper MFC after: 3 days Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Mon Aug 1 21:49:35 2016 (r303644) +++ head/sys/dev/pci/pci_pci.c Mon Aug 1 22:19:23 2016 (r303645) @@ -932,6 +932,13 @@ pcib_probe_hotplug(struct pcib_softc *sc sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4); sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4); + /* + * XXX: Handling of slots with a power controller needs to be + * reexamined. Ignore hotplug on such slots for now. + */ + if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP) + return; + if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) sc->flags |= PCIB_HOTPLUG; } From owner-svn-src-head@freebsd.org Mon Aug 1 22:22:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB8D7BAC2CC; Mon, 1 Aug 2016 22:22:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADBE41CE1; Mon, 1 Aug 2016 22:22:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71MMBkP018483; Mon, 1 Aug 2016 22:22:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71MMB4E018482; Mon, 1 Aug 2016 22:22:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608012222.u71MMB4E018482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 1 Aug 2016 22:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303646 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 22:22:13 -0000 Author: markj Date: Mon Aug 1 22:22:11 2016 New Revision: 303646 URL: https://svnweb.freebsd.org/changeset/base/303646 Log: ipoib: Bound the number of egress mbufs buffered during pathrec lookups. In pathological situations where the master subnet manager becomes unresponsive for an extended period, we may otherwise end up queuing all of the system's mbufs while waiting for a response to a path record lookup. This addresses the same issue as commit 1e85b806f9 in Linux. Reviewed by: cem, ngie MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 1 22:19:23 2016 (r303645) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 1 22:22:11 2016 (r303646) @@ -660,7 +660,13 @@ ipoib_unicast_send(struct mbuf *mb, stru new_path = 1; } if (path) { - _IF_ENQUEUE(&path->queue, mb); + if (_IF_QLEN(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) + _IF_ENQUEUE(&path->queue, mb); + else { + if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1); + m_freem(mb); + } + if (!path->query && path_rec_start(priv, path)) { spin_unlock_irqrestore(&priv->lock, flags); if (new_path) From owner-svn-src-head@freebsd.org Mon Aug 1 22:39:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E055BAC5F0; Mon, 1 Aug 2016 22:39:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FB401741; Mon, 1 Aug 2016 22:39:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71MdqgN022812; Mon, 1 Aug 2016 22:39:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71Mdp7W022805; Mon, 1 Aug 2016 22:39:51 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608012239.u71Mdp7W022805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 1 Aug 2016 22:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303647 - in head/sys/dev/cxgbe: . iw_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 22:39:53 -0000 Author: jhb Date: Mon Aug 1 22:39:51 2016 New Revision: 303647 URL: https://svnweb.freebsd.org/changeset/base/303647 Log: Store the offset of the KDOORBELL and GTS registers in the softc. VF devices use a different register layout than PF devices. Storing the offset in a value in the softc allows code to be shared between the PF and VF drivers. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7389 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/iw_cxgbe/cq.c head/sys/dev/cxgbe/iw_cxgbe/qp.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Mon Aug 1 22:22:11 2016 (r303646) +++ head/sys/dev/cxgbe/adapter.h Mon Aug 1 22:39:51 2016 (r303647) @@ -781,6 +781,8 @@ struct adapter { struct sge_rxq *rxq; struct sge_nm_rxq *nm_rxq; } __aligned(CACHE_LINE_SIZE) *irq; + int sge_gts_reg; + int sge_kdoorbell_reg; bus_dma_tag_t dmat; /* Parent DMA tag */ Modified: head/sys/dev/cxgbe/iw_cxgbe/cq.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/cq.c Mon Aug 1 22:22:11 2016 (r303646) +++ head/sys/dev/cxgbe/iw_cxgbe/cq.c Mon Aug 1 22:39:51 2016 (r303647) @@ -172,7 +172,7 @@ create_cq(struct c4iw_rdev *rdev, struct cq->gen = 1; cq->gts = (void *)((unsigned long)rman_get_virtual(sc->regs_res) + - MYPF_REG(SGE_PF_GTS)); + sc->sge_gts_reg); cq->rdev = rdev; if (user) { Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/qp.c Mon Aug 1 22:22:11 2016 (r303646) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.c Mon Aug 1 22:39:51 2016 (r303647) @@ -182,9 +182,9 @@ static int create_qp(struct c4iw_rdev *r pci_unmap_addr_set(&wq->rq, mapping, wq->rq.dma_addr); wq->db = (void *)((unsigned long)rman_get_virtual(sc->regs_res) + - MYPF_REG(SGE_PF_KDOORBELL)); + sc->sge_kdoorbell_reg); wq->gts = (void *)((unsigned long)rman_get_virtual(rdev->adap->regs_res) - + MYPF_REG(SGE_PF_GTS)); + + sc->sge_gts_reg); if (user) { wq->sq.udb = (u64)((char*)rman_get_virtual(rdev->adap->udbs_res) + (wq->sq.qid << rdev->qpshift)); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Aug 1 22:22:11 2016 (r303646) +++ head/sys/dev/cxgbe/t4_main.c Mon Aug 1 22:39:51 2016 (r303647) @@ -697,6 +697,8 @@ t4_attach(device_t dev) sc->params.pci.mps = 128 << ((v & PCIEM_CTL_MAX_PAYLOAD) >> 5); } + sc->sge_gts_reg = MYPF_REG(A_SGE_PF_GTS); + sc->sge_kdoorbell_reg = MYPF_REG(A_SGE_PF_KDOORBELL); sc->traceq = -1; mtx_init(&sc->ifp_lock, sc->ifp_lockname, 0, MTX_DEF); snprintf(sc->ifp_lockname, sizeof(sc->ifp_lockname), "%s tracer", Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Mon Aug 1 22:22:11 2016 (r303646) +++ head/sys/dev/cxgbe/t4_netmap.c Mon Aug 1 22:39:51 2016 (r303647) @@ -204,7 +204,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, str } } - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), + t4_write_reg(sc, sc->sge_gts_reg, V_INGRESSQID(nm_rxq->iq_cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(holdoff_tmr_idx))); @@ -364,7 +364,7 @@ cxgbe_netmap_on(struct adapter *sc, stru MPASS((j & 7) == 0); j /= 8; /* driver pidx to hardware pidx */ wmb(); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(j)); atomic_cmpset_int(&irq->nm_state, NM_OFF, NM_ON); @@ -537,7 +537,7 @@ ring_nm_txq_db(struct adapter *sc, struc break; case DOORBELL_KDB: - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, V_QID(nm_txq->cntxt_id) | V_PIDX(n)); break; } @@ -818,7 +818,7 @@ cxgbe_netmap_rxsync(struct netmap_kring } if (++dbinc == 8 && n >= 32) { wmb(); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(dbinc)); dbinc = 0; } @@ -827,7 +827,7 @@ cxgbe_netmap_rxsync(struct netmap_kring if (dbinc > 0) { wmb(); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(dbinc)); } } @@ -981,14 +981,14 @@ t4_nm_intr(void *arg) fl_credits /= 8; IDXINCR(nm_rxq->fl_pidx, fl_credits * 8, nm_rxq->fl_sidx); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(fl_credits)); fl_credits = fl_cidx & 7; } else if (!black_hole) { netmap_rx_irq(ifp, nm_rxq->nid, &work); MPASS(work != 0); } - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), + t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(n) | V_INGRESSQID(nm_rxq->iq_cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX))); n = 0; @@ -999,12 +999,12 @@ t4_nm_intr(void *arg) if (black_hole) { fl_credits /= 8; IDXINCR(nm_rxq->fl_pidx, fl_credits * 8, nm_rxq->fl_sidx); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(fl_credits)); } else netmap_rx_irq(ifp, nm_rxq->nid, &work); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(n) | + t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(n) | V_INGRESSQID((u32)nm_rxq->iq_cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(holdoff_tmr_idx))); } Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon Aug 1 22:22:11 2016 (r303646) +++ head/sys/dev/cxgbe/t4_sge.c Mon Aug 1 22:39:51 2016 (r303647) @@ -1474,7 +1474,7 @@ service_iq(struct sge_iq *iq, int budget d = &iq->desc[0]; } if (__predict_false(++ndescs == limit)) { - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), + t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(ndescs) | V_INGRESSQID(iq->cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX))); @@ -1529,7 +1529,7 @@ process_iql: } #endif - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(ndescs) | + t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(ndescs) | V_INGRESSQID((u32)iq->cntxt_id) | V_SEINTARM(iq->intr_params)); if (iq->flags & IQ_HAS_FL) { @@ -2793,7 +2793,7 @@ alloc_iq_fl(struct vi_info *vi, struct s /* Enable IQ interrupts */ atomic_store_rel_int(&iq->state, IQS_IDLE); - t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_SEINTARM(iq->intr_params) | + t4_write_reg(sc, sc->sge_gts_reg, V_SEINTARM(iq->intr_params) | V_INGRESSQID(iq->cntxt_id)); return (0); @@ -3676,7 +3676,7 @@ ring_fl_db(struct adapter *sc, struct sg if (fl->udb) *fl->udb = htole32(v); else - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), v); + t4_write_reg(sc, sc->sge_kdoorbell_reg, v); IDXINCR(fl->dbidx, n, fl->sidx); } @@ -4409,7 +4409,7 @@ ring_eq_db(struct adapter *sc, struct sg break; case DOORBELL_KDB: - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), + t4_write_reg(sc, sc->sge_kdoorbell_reg, V_QID(eq->cntxt_id) | V_PIDX(n)); break; } From owner-svn-src-head@freebsd.org Mon Aug 1 22:41:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DD91BAC67B; Mon, 1 Aug 2016 22:41:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C85D1A91; Mon, 1 Aug 2016 22:41:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71Mfowk025582; Mon, 1 Aug 2016 22:41:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71Mfo0I025581; Mon, 1 Aug 2016 22:41:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201608012241.u71Mfo0I025581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Mon, 1 Aug 2016 22:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303648 - head/sys/ddb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 22:41:51 -0000 Author: cem Date: Mon Aug 1 22:41:50 2016 New Revision: 303648 URL: https://svnweb.freebsd.org/changeset/base/303648 Log: Fix ddb "show proc" to show full arguments PR: 200052 Submitted by: Chang-Hsien Tsai Modified: head/sys/ddb/db_ps.c Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Mon Aug 1 22:39:51 2016 (r303647) +++ head/sys/ddb/db_ps.c Mon Aug 1 22:41:50 2016 (r303648) @@ -440,9 +440,16 @@ DB_SHOW_COMMAND(proc, db_show_proc) p->p_leader); if (p->p_sysent != NULL) db_printf(" ABI: %s\n", p->p_sysent->sv_name); - if (p->p_args != NULL) - db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length, - p->p_args->ar_args); + if (p->p_args != NULL) { + db_printf(" arguments: "); + for (i = 0; i < (int)p->p_args->ar_length; i++) { + if (p->p_args->ar_args[i] == '\0') + db_printf(" "); + else + db_printf("%c", p->p_args->ar_args[i]); + } + db_printf("\n"); + } db_printf(" threads: %d\n", p->p_numthreads); FOREACH_THREAD_IN_PROC(p, td) { dumpthread(p, td, 1); From owner-svn-src-head@freebsd.org Mon Aug 1 22:57:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9519BBACB17; Mon, 1 Aug 2016 22:57:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 682881537; Mon, 1 Aug 2016 22:57:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71Mv3uA030077; Mon, 1 Aug 2016 22:57:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71Mv3YA030076; Mon, 1 Aug 2016 22:57:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201608012257.u71Mv3YA030076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Mon, 1 Aug 2016 22:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303650 - head/sys/opencrypto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 22:57:04 -0000 Author: cem Date: Mon Aug 1 22:57:03 2016 New Revision: 303650 URL: https://svnweb.freebsd.org/changeset/base/303650 Log: opencrypto AES-ICM: Fix heap corruption typo This error looks like it was a simple copy-paste typo in the original commit for this code (r275732). PR: 204009 Reported by: Chang-Hsien Tsai Sponsored by: EMC / Isilon Storage Division Modified: head/sys/opencrypto/xform_aes_icm.c Modified: head/sys/opencrypto/xform_aes_icm.c ============================================================================== --- head/sys/opencrypto/xform_aes_icm.c Mon Aug 1 22:53:28 2016 (r303649) +++ head/sys/opencrypto/xform_aes_icm.c Mon Aug 1 22:57:03 2016 (r303650) @@ -65,7 +65,7 @@ struct enc_xform enc_xform_aes_icm = { aes_icm_crypt, aes_icm_crypt, aes_icm_setkey, - rijndael128_zerokey, + aes_icm_zerokey, aes_icm_reinit, }; From owner-svn-src-head@freebsd.org Mon Aug 1 23:02:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 057F5BACD16; Mon, 1 Aug 2016 23:02:28 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::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 9E58A1A88; Mon, 1 Aug 2016 23:02:27 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x235.google.com with SMTP id o80so264765305wme.1; Mon, 01 Aug 2016 16:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kVkyaNsEMSKeRl2OrVXN+xfxS6mtZXZFz2YA24MWNTA=; b=Q0yajmHx/+a/ltDgV59PKeChyuK+zbou2Aqd1RwGUQ6mSmfd2l8lUaVrYFiuUjIDPv 8gxEmgI3yxyHydEyKS+cz6zjNBohXdjAxwoKyT2wbnYr2xhELpNX1W/VNMd01LT5psUo 1hNmL5ofZpsNKBBX8sFqEHAH/NvQUEsrRDk9zw56ZN4/jI9alRCkoFxjz20V+PcN+n0o IKo0C70Ez5n0dW5XR2oLDKb3jNGG9THu3E1Yhp/uyC59qwT4tAd9cWjuub1Y6/yvO9qS RG/526QVgn29Kvu5o/y4z2fKcXMLmnc+VArXwAsWpJiFFZdZSjrtP2tAfR8JVTkLXwt2 aWrQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kVkyaNsEMSKeRl2OrVXN+xfxS6mtZXZFz2YA24MWNTA=; b=ho2f14RTKIewUEJw3zbbmvM86G1aXRv72pdMQ3ZSv+I28/PW8mQjOkQ4QQOaSsot4X g8xbuHx+RSjqnx3e0wgC109esv5HX/iCbk3iSTMbAnQpyOdpS9xGZ5a8rvCKrz71jCI3 LYrIJm2SOI/aDHw+leqUZhH943Ykm+3MM0ErIcRQYmIvoznToneUyRQz2GeRrBjwtQ2r GBR53u6tZIPI3pGHyB8RpE7Xm5cA47jU2hCz96WKN4OYbxOMldZqFy/P4qhoSO+sF1EM Z4NvjiElYde8KbfzrUCCg5RzQ+jOjNmVmPXjaPX+g89rZD7j5qGQ8/jMi8pGp8FQeaC1 VGaQ== X-Gm-Message-State: AEkoout8E6sIiUB+QgZIL0M69vp2YQTHDxMkYHJ0ea5250WUbZPGby/Y3YMDO9gJF78wog== X-Received: by 10.194.148.19 with SMTP id to19mr58644087wjb.81.1470092545953; Mon, 01 Aug 2016 16:02:25 -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 yz6sm32556279wjb.35.2016.08.01.16.02.25 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 01 Aug 2016 16:02:25 -0700 (PDT) Date: Tue, 2 Aug 2016 01:02:23 +0200 From: Mateusz Guzik To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303643 - in head/sys: kern sys Message-ID: <20160801230222.GA24559@dft-labs.eu> References: <201608012148.u71LmbaA003739@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201608012148.u71LmbaA003739@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 23:02:28 -0000 On Mon, Aug 01, 2016 at 09:48:37PM +0000, Mateusz Guzik wrote: > Implement trivial backoff for locking primitives. > [..] > For simplicity, this first thouch implementation only modifies spinning > loops where the lock owner is running. spin mutexes and thread lock were > not modified. > What maybe I should have noted in the commit message. This is a perfectly MFCable and much needed band-aid, which will later be extended to cover the rest of the loops and other primitives. There are several approaches which give better results but are also significantly more complicated to implement. Until a suitable approach is worked out and tested, the work here hopefully helps enough. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Mon Aug 1 23:07:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A419BACDFD; Mon, 1 Aug 2016 23:07:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E19351CE3; Mon, 1 Aug 2016 23:07:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u71N7W08034161; Mon, 1 Aug 2016 23:07:32 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u71N7WkL034160; Mon, 1 Aug 2016 23:07:32 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201608012307.u71N7WkL034160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Mon, 1 Aug 2016 23:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303651 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 23:07:33 -0000 Author: cem Date: Mon Aug 1 23:07:31 2016 New Revision: 303651 URL: https://svnweb.freebsd.org/changeset/base/303651 Log: rtentry: Initialize rt_mtx with MTX_NEW The "rtentry" zone does not use UMA_ZONE_ZINIT, so it is invalid to assume the mutex's memory will be zero. Without MTX_NEW, garbage backing memory may trigger the "re-initializing a mutex" assertion. PR: 200991 Submitted by: Chang-Hsien Tsai Modified: head/sys/net/route.h Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Mon Aug 1 22:57:03 2016 (r303650) +++ head/sys/net/route.h Mon Aug 1 23:07:31 2016 (r303651) @@ -360,7 +360,7 @@ struct rt_addrinfo { || (ifp)->if_link_state == LINK_STATE_UP) #define RT_LOCK_INIT(_rt) \ - mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK) + mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW) #define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) #define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) #define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) From owner-svn-src-head@freebsd.org Mon Aug 1 23:15:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA383BAB0BB for ; Mon, 1 Aug 2016 23:15:59 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt0-x22f.google.com (mail-qt0-x22f.google.com [IPv6:2607:f8b0:400d:c0d::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62B1314BD for ; Mon, 1 Aug 2016 23:15:59 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt0-x22f.google.com with SMTP id u25so113609418qtb.1 for ; Mon, 01 Aug 2016 16:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:cc:message-id; bh=aNWr0X9YLXD3Qz6jDsBgvLT7Vsx/21cvYxAiSkWNlCc=; b=rnwuoG+0n4C23szojZzQ+wUlV3VtKj72KCacAVo+DVoysldemWWk1cwIxlATVp1gM+ MQgAL+gtEw6rK5+kOboBPWKNqJwHIYCaBUMR6TfSDvWdif7a79G8U1oQbaZPwMujVbSD +tmU0YRGOM867U8xBBNnQhoruQkkh2RTAG5KT9MmjHBCJ/A3pj04tDdKLAUz87eqUknV 5n+OdHrnBr+OpKjG8U6CLdT6NEsI7m0qx7yWYAwvpK8nKoU6sDwQWJc4FntROc2ySYFY enPnfhXSrwQ4hkKAtdXMYl37nazBor1zsSyFx8+4jDlyeeTADFq9REIt+7d/Tjym/Jq1 32OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:cc:message-id; bh=aNWr0X9YLXD3Qz6jDsBgvLT7Vsx/21cvYxAiSkWNlCc=; b=EFSUmyAagem26LLO+Y+x0cfMofuipJN+fJndAhXKrbrK80EUlbhPQh0//UoaQk/zo9 4Oi+pUTXEy/IQ0BjYw6wdWsXhhPqkWHXh6PJh1kAEiYY9igCALwaAHU9z8E+gGHnMZW+ Hz3dez1DtDjRtg45ziEsuOCp/FSv+PvQCon1SInuTWz7uNcF9Qs2HGXFk8bGc0ygHXGJ c/+hPt05wh+gyIvNwGpPWU0e4ConWbrzl4wTj8uoIMP8zDN4D6zXN7/LA/rGMFizk+dX 6s57fh98/vYYj6UZycMddgo5xk3q63TsCnJg1Ni82dZvlOleDCdMJ8db8YIwW2IElBmy hv1g== X-Gm-Message-State: AEkoouv4HSPbDcsZVrS/9PyL8VU1RK8frOIFFoGkligXPMmfqDs2j8oNNK9nQQQ9qVepBie3 X-Received: by 10.200.52.193 with SMTP id x1mr93039267qtb.65.1470093358477; Mon, 01 Aug 2016 16:15:58 -0700 (PDT) Received: from android-a280016dfb588d59 ([172.56.2.185]) by smtp.gmail.com with ESMTPSA id b142sm521626qkc.43.2016.08.01.16.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Aug 2016 16:15:57 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: <201608012257.u71Mv3YA030076@repo.freebsd.org> References: <201608012257.u71Mv3YA030076@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: svn commit: r303650 - head/sys/opencrypto From: Shawn Webb Date: Mon, 01 Aug 2016 19:15:44 -0400 To: "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org CC: "secteam@FreeBSD.org" Message-ID: X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 23:15:59 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer" wrote: >Author: cem >Date: Mon Aug 1 22:57:03 2016 >New Revision: 303650 >URL: https://svnweb.freebsd.org/changeset/base/303650 > >Log: > opencrypto AES-ICM: Fix heap corruption typo > >This error looks like it was a simple copy-paste typo in the original >commit > for this code (r275732). > > PR: 204009 > Reported by: Chang-Hsien Tsai > Sponsored by: EMC / Isilon Storage Since cem@ refuses to MFC even security fixes, can someone with a commit bit please MFC this within normal security-related MFC timeframe? Additionally, does a security advisory need to be sent out? CC'ing secteam@. Thanks, Shawn - -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -----BEGIN PGP SIGNATURE----- Version: APG v1.1.1 iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6 UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8 ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3 +YQ= =B3c1 -----END PGP SIGNATURE----- From owner-svn-src-head@freebsd.org Mon Aug 1 23:58:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D984BABC84 for ; Mon, 1 Aug 2016 23:58:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt0-x232.google.com (mail-qt0-x232.google.com [IPv6:2607:f8b0:400d:c0d::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 111AF1657 for ; Mon, 1 Aug 2016 23:58:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt0-x232.google.com with SMTP id w38so114460279qtb.0 for ; Mon, 01 Aug 2016 16:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ysjunms+QdS2C4p/jtg7Bt7RttApDDtzfw50mTmUvfk=; b=rdsjb+npOFgY298esnd+tYUOoi50V5w1KMrAYX5z1ydSucs7TnZDPK7oj+OJo4fCZd lW0mam8P7hpn01P7p9DBu4pieVK2WXVdXRHApdf35cEz9tpC8yhVlqkP9c8DKeKsZe2q vCdQBiR5AHTgQhCSXdD3kPVEvijBhmqDEzqFpGf6/IRbC3fuZYdQXyubBXhYxlMJ1pbd jd4awaRRxyAl3aSc2RvJGv0h6CBHoYEKXFeL5GzFXHmv1jXillMo7xRGwJbncirmCNNd 15DxoZE8xQnBP5V5dy6BV87o3iMZhXME2iK2QwUO6+joyeUmeemT+dv2Ekv1IVPyt3Dl X3KQ== 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=ysjunms+QdS2C4p/jtg7Bt7RttApDDtzfw50mTmUvfk=; b=OjEyg+E4VwGdjX9diDPfbyJ+GrpNreD+xTE4VjQyDw2oX6b3t8kqKG2j5SKC5uXssr n9p9Hme7qhuHs/B/EFSqTl62ozxsiAI2RAPpqBVixR7Z/GFQ0vqG+92dWtsdrHhIweAL kLb5ax0cNEsugbhz+xswb7YnWoDy57WuWjYVG0yRwo0g3ThfS3eGv9X1VLzwYgL+13dp Oug7WnupaZwwmI7j49FolLU0gjDN2adYUDsCG+aGEirqpaQYc1r20vPLj2hWAxK2vBgU RxFauc9Urhsi8l8eeVbMR9K87NjxHyiYOsi4gALyiyG0DIJCg+Cn1t1jaVzWK2Lc25up C0hQ== X-Gm-Message-State: AEkoouscEdpzKvd5Px47lE4fQt5dXqxMbHHJHZSTKtRjO5ZWwr9xnXqbNeprGS9Y4oG8PE54 X-Received: by 10.237.39.34 with SMTP id n31mr86912148qtd.55.1470095936179; Mon, 01 Aug 2016 16:58:56 -0700 (PDT) Received: from mutt-hardenedbsd (pool-100-16-217-171.bltmmd.fios.verizon.net. [100.16.217.171]) by smtp.gmail.com with ESMTPSA id j6sm19049725qke.26.2016.08.01.16.58.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Aug 2016 16:58:54 -0700 (PDT) Date: Mon, 1 Aug 2016 19:58:52 -0400 From: Shawn Webb To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, "secteam@FreeBSD.org" , ecturt@gmail.com Subject: Re: svn commit: r303650 - head/sys/opencrypto Message-ID: <20160801235852.GH7956@mutt-hardenedbsd> References: <201608012257.u71Mv3YA030076@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nOM8ykUjac0mNN89" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 23:58:57 -0000 --nOM8ykUjac0mNN89 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Adding CTurt to see if he wants to take a stab at writing a PoC exploit. It'd be cool for an offensive researcher to determine if it's simply a DoS. But regardless, a security fix is a security fix. All currently-supported branches really should be updated. Thanks, Shawn On Mon, Aug 01, 2016 at 04:41:02PM -0700, Conrad Meyer wrote: > Hey Shawn, >=20 > I don't think this is security-related despite being a bug in > crypto-adjacent code. At best it's a DoS, I think. >=20 > Cheers, > Conrad >=20 > On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb w= rote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA512 > > > > > > > > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer" w= rote: > >>Author: cem > >>Date: Mon Aug 1 22:57:03 2016 > >>New Revision: 303650 > >>URL: https://svnweb.freebsd.org/changeset/base/303650 > >> > >>Log: > >> opencrypto AES-ICM: Fix heap corruption typo > >> > >>This error looks like it was a simple copy-paste typo in the original > >>commit > >> for this code (r275732). > >> > >> PR: 204009 > >> Reported by: Chang-Hsien Tsai > >> Sponsored by: EMC / Isilon Storage > > > > Since cem@ refuses to MFC even security fixes, can someone with a commi= t bit please MFC this within normal security-related MFC timeframe? Additio= nally, does a security advisory need to be sent out? CC'ing secteam@. > > > > Thanks, > > > > Shawn > > > > - -- > > Sent from my Android device with K-9 Mail. Please excuse my brevity. > > -----BEGIN PGP SIGNATURE----- > > Version: APG v1.1.1 > > > > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m > > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI > > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa > > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS > > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht > > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx > > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v > > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6 > > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os > > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8 > > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk > > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3 > > +YQ=3D > > =3DB3c1 > > -----END PGP SIGNATURE----- > > > > --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --nOM8ykUjac0mNN89 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXn+I6AAoJEGqEZY9SRW7ukCQP/RWGGLZUhfOG6/nMofrpKl08 iTCIlc5pwlhHD85qSampF5PN0P2Hj7iztvo8h//YVBB/SE7SvG0UQ0K28pEAwhzo 9NK9EN0r86GxU/BAfzv1enHuWQP8bWrb5dCkBRMIHmOfHQ31971osD5QdX7EgqWs 8v+CaSzWM3d/RAEqG1jm6rnn3QjJsjx93U3bWj8l368p3dG6EfDRBoG9PjOHZ9bf YnhtoIWjRS+lpVnpIckhX/zxgtdAli/05dnjkg6XXVOu8AM/bH/xVrfbNBsdrux8 QNI0YS0oIUuEjecNj+X6FQ7dY9r31E9Q1uKmz/iGZvbIZzel5OohJkcIDkBD5S4i 2dVzH4t0W26NgY0ieoxTm8mE5rIDqJZCjBq7QHxUSK1/Ii4DM4A6nLfvckzYBwOw l1FYbW20N0meDDdzE6qzAq0qLsjzvrorxIT//nYbPmkWGWYSzr1bcFQ/ULjOhk/I t2LAdi4pKxMBxQZN45BbVPeM+UbbsRXaNj7hfWq5IaalxXd+xfDbG33VQ/Brj7cr jHm6frWPK8hh0ljKXrnMLAOc0I8NVL/+a8vsMpZhp+Hg6k06dHvkgF5kFBe/18gn MZVl4Q9rkhRXUBJi+zqt99SnJa6fjcVhaAqiG1zY8OPGQguJd8CP3d4gFaG9DKOu xGs+QFiaGxYtTorBHAMu =XoIo -----END PGP SIGNATURE----- --nOM8ykUjac0mNN89-- From owner-svn-src-head@freebsd.org Tue Aug 2 00:08:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DE48BA2097; Tue, 2 Aug 2016 00:08:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) (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 D52211BF1; Tue, 2 Aug 2016 00:08:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f171.google.com with SMTP id q83so198626497iod.1; Mon, 01 Aug 2016 17:08:30 -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=f+U+3TXmJ/4ae+m9EnE3Iqr7/5/LTfCKd4HELEQ5cDA=; b=YBRhuiAZpmE0Xr28IShpvG1RLXTJavYjia8fm32HrpY4UDjdClIx0BlCBfMxKh9zTx IeShW9vubCxkyJpnA84GRs60Dnk4tXgqCpxBi07qGJTsFJaulPe7DlwAW1+H+IBut0dK cO8J9gCmA4ALjEgUEPzD2sJdjMPwTDvHCrHQI5a1HwdniqLSmFyvYP4w8aRNRio36Kl6 TCIWtZ7GouVAyr0TNSvqBXKKKmy6wQYvOF9b8LiZOwEqmIa0+NyGLAFJ+lR5+hfp2iku 9i4m6UnyM2cL9sLglow6oprNjtcEmal+UkRfJqLcWj8mA7sHZ3D2AKeE5jNjhJGEKmwm p2Tw== X-Gm-Message-State: AEkoouuRJQKdC/dYFMPGfQrYP5PB4ysYhraFpicA1fu/0I2GYgzWd0a4emtsrPaxzzKi5Q== X-Received: by 10.107.3.221 with SMTP id e90mr60665061ioi.17.1470094862920; Mon, 01 Aug 2016 16:41:02 -0700 (PDT) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id 65sm85762itl.16.2016.08.01.16.41.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Aug 2016 16:41:02 -0700 (PDT) Received: by mail-io0-f174.google.com with SMTP id 38so197785492iol.0; Mon, 01 Aug 2016 16:41:02 -0700 (PDT) X-Received: by 10.107.147.138 with SMTP id v132mr59585356iod.27.1470094862464; Mon, 01 Aug 2016 16:41:02 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Mon, 1 Aug 2016 16:41:02 -0700 (PDT) In-Reply-To: References: <201608012257.u71Mv3YA030076@repo.freebsd.org> From: Conrad Meyer Date: Mon, 1 Aug 2016 16:41:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303650 - head/sys/opencrypto To: Shawn Webb Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, "secteam@FreeBSD.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 00:08:31 -0000 Hey Shawn, I don't think this is security-related despite being a bug in crypto-adjacent code. At best it's a DoS, I think. Cheers, Conrad On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > > > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer" wrote: >>Author: cem >>Date: Mon Aug 1 22:57:03 2016 >>New Revision: 303650 >>URL: https://svnweb.freebsd.org/changeset/base/303650 >> >>Log: >> opencrypto AES-ICM: Fix heap corruption typo >> >>This error looks like it was a simple copy-paste typo in the original >>commit >> for this code (r275732). >> >> PR: 204009 >> Reported by: Chang-Hsien Tsai >> Sponsored by: EMC / Isilon Storage > > Since cem@ refuses to MFC even security fixes, can someone with a commit bit please MFC this within normal security-related MFC timeframe? Additionally, does a security advisory need to be sent out? CC'ing secteam@. > > Thanks, > > Shawn > > - -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. > -----BEGIN PGP SIGNATURE----- > Version: APG v1.1.1 > > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6 > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8 > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3 > +YQ= > =B3c1 > -----END PGP SIGNATURE----- > > From owner-svn-src-head@freebsd.org Tue Aug 2 00:15:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DEC7BA2491; Tue, 2 Aug 2016 00:15:10 +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 C0257128E; Tue, 2 Aug 2016 00:15:09 +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 u720F8QU059816; Tue, 2 Aug 2016 00:15:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u720F89S059814; Tue, 2 Aug 2016 00:15:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201608020015.u720F89S059814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 2 Aug 2016 00:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303652 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 00:15:10 -0000 Author: mjg Date: Tue Aug 2 00:15:08 2016 New Revision: 303652 URL: https://svnweb.freebsd.org/changeset/base/303652 Log: locks: fix up ifdef guards introduced in r303643 Both sx and rwlocks had copy-pasted ADAPTIVE_MUTEXES instead of the correct define. MFC after: 1 week Modified: head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Mon Aug 1 23:07:31 2016 (r303651) +++ head/sys/kern/kern_rwlock.c Tue Aug 2 00:15:08 2016 (r303652) @@ -383,7 +383,7 @@ __rw_rlock(volatile uintptr_t *c, const int contested = 0; #endif uintptr_t v; -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS) struct lock_delay_arg lda; #endif #ifdef KDTRACE_HOOKS @@ -396,7 +396,7 @@ __rw_rlock(volatile uintptr_t *c, const if (SCHEDULER_STOPPED()) return; -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS) lock_delay_arg_init(&lda, &rw_delay); #endif rw = rwlock2rw(c); @@ -769,7 +769,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u uint64_t waittime = 0; int contested = 0; #endif -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS) struct lock_delay_arg lda; #endif #ifdef KDTRACE_HOOKS @@ -782,7 +782,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u if (SCHEDULER_STOPPED()) return; -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS) lock_delay_arg_init(&lda, &rw_delay); #endif rw = rwlock2rw(c); Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Mon Aug 1 23:07:31 2016 (r303651) +++ head/sys/kern/kern_sx.c Tue Aug 2 00:15:08 2016 (r303652) @@ -541,7 +541,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t int contested = 0; #endif int error = 0; -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS) struct lock_delay_arg lda; #endif #ifdef KDTRACE_HOOKS @@ -554,7 +554,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t if (SCHEDULER_STOPPED()) return (0); -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS) lock_delay_arg_init(&lda, &sx_delay); #endif @@ -848,7 +848,7 @@ _sx_slock_hard(struct sx *sx, int opts, #endif uintptr_t x; int error = 0; -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS) struct lock_delay_arg lda; #endif #ifdef KDTRACE_HOOKS @@ -861,7 +861,7 @@ _sx_slock_hard(struct sx *sx, int opts, if (SCHEDULER_STOPPED()) return (0); -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS) lock_delay_arg_init(&lda, &sx_delay); #endif #ifdef KDTRACE_HOOKS From owner-svn-src-head@freebsd.org Tue Aug 2 00:25:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CA52BA264B; Tue, 2 Aug 2016 00:25:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) (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 0D833176F; Tue, 2 Aug 2016 00:25:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f182.google.com with SMTP id 38so198474621iol.0; Mon, 01 Aug 2016 17:25:09 -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=PzdlotRfPq/K2f+lKHWHcZtwTm8wn1oAGNqdIDoRoik=; b=aGLv4/TwZ94G4bQXC0ETJoCk5jpegGDt2h/tcUv28k6+2H4yz2NGrbcYKh+9Cwx9dY 3SdLjT9uc6W2qHmmYOi9Z7312pA8XYih7mmT3iaM4EtM8LYyz9g1E2DlcZPvr9plaOhx gMMmdjF4pYQ0oS4miixUiu3z3RSmY5Dx9A3VxIhDmcpkxJ64vGisxmNlb3k2hDk2Zg5t C4KgzQOZpJlFw7+LSlaWOkJU0SmTt4tFKaXHgkRDEXQ2p6dfS+w7wvkx6RJjPOMa5R7p W4IroV8avyQIYmoGLu1YhKeLmtqBDOkVR/CRQM7hgyPUXBQ0BameqFSZ9G/dkZ4dypFo wVIA== X-Gm-Message-State: AEkoouuTwdRZ01mbtq+xM2EVP5c1ku4K7WSOqqvMm4EqUaY1uwddw/D9LUuz9kWi/zDclA== X-Received: by 10.107.169.40 with SMTP id s40mr57552199ioe.19.1470097508591; Mon, 01 Aug 2016 17:25:08 -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 b14sm161826itd.15.2016.08.01.17.25.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Aug 2016 17:25:08 -0700 (PDT) Received: by mail-it0-f42.google.com with SMTP id j124so188533468ith.1; Mon, 01 Aug 2016 17:25:08 -0700 (PDT) X-Received: by 10.36.76.16 with SMTP id a16mr16137854itb.86.1470097507908; Mon, 01 Aug 2016 17:25:07 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Mon, 1 Aug 2016 17:25:07 -0700 (PDT) In-Reply-To: <20160801235852.GH7956@mutt-hardenedbsd> References: <201608012257.u71Mv3YA030076@repo.freebsd.org> <20160801235852.GH7956@mutt-hardenedbsd> From: Conrad Meyer Date: Mon, 1 Aug 2016 17:25:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303650 - head/sys/opencrypto To: Shawn Webb Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, "secteam@FreeBSD.org" , ecturt@gmail.com Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 00:25:10 -0000 That would be difficult, as this is completely dead code in base. It could be accessed through the /dev/crypto device by a port, however. You haven't convinced me there is a security issue. Cheers, Conrad On Mon, Aug 1, 2016 at 4:58 PM, Shawn Webb wrote: > Adding CTurt to see if he wants to take a stab at writing a PoC exploit. > It'd be cool for an offensive researcher to determine if it's simply a > DoS. But regardless, a security fix is a security fix. All > currently-supported branches really should be updated. > > Thanks, > > Shawn > > On Mon, Aug 01, 2016 at 04:41:02PM -0700, Conrad Meyer wrote: >> Hey Shawn, >> >> I don't think this is security-related despite being a bug in >> crypto-adjacent code. At best it's a DoS, I think. >> >> Cheers, >> Conrad >> >> On Mon, Aug 1, 2016 at 4:15 PM, Shawn Webb wrote: >> > -----BEGIN PGP SIGNED MESSAGE----- >> > Hash: SHA512 >> > >> > >> > >> > On August 1, 2016 6:57:03 PM EDT, "Conrad E. Meyer" wrote: >> >>Author: cem >> >>Date: Mon Aug 1 22:57:03 2016 >> >>New Revision: 303650 >> >>URL: https://svnweb.freebsd.org/changeset/base/303650 >> >> >> >>Log: >> >> opencrypto AES-ICM: Fix heap corruption typo >> >> >> >>This error looks like it was a simple copy-paste typo in the original >> >>commit >> >> for this code (r275732). >> >> >> >> PR: 204009 >> >> Reported by: Chang-Hsien Tsai >> >> Sponsored by: EMC / Isilon Storage >> > >> > Since cem@ refuses to MFC even security fixes, can someone with a commit bit please MFC this within normal security-related MFC timeframe? Additionally, does a security advisory need to be sent out? CC'ing secteam@. >> > >> > Thanks, >> > >> > Shawn >> > >> > - -- >> > Sent from my Android device with K-9 Mail. Please excuse my brevity. >> > -----BEGIN PGP SIGNATURE----- >> > Version: APG v1.1.1 >> > >> > iQI/BAEBCgApBQJXn9ggIhxTaGF3biBXZWJiIDxzaGF3bkBzaGF3bndlYmIuaW5m >> > bz4ACgkQaoRlj1JFbu4Ypg//XLLOHX3y5ULHSEqEQ6tgUjQiR+9ADYKX1Zza3ghI >> > FsHEr7O8yi31jb8EJ9+oOiZOHxjAfLP+ezwNoa9xRUQu0IoTcCLU6PzCzHv2viaa >> > UZ+ae5xbB48i89o2ZshGTKgtwAzkCOhNkvPaAmS2yu14Xg+2CbhY2mCR+qdnAnMS >> > cUU4dTsqTI+cHQoE2ehzDst/ABSaBZa2XZKxFp3EeTb3r2bNAvh72zMv6ethU8Ht >> > 5VE7ZyRfQBpObZVcmSy6Sg8+vyjTRE4pdiajSqs3kIitPvxljwukMQ6DcdHCnJPx >> > IlOTXnM1wd7iHSwNTP8jniemOR4QrrQ3fEwglsnjp2t45ZnWi46LhfoekOinX42v >> > x7f+XWhcw0/oCF34q0rQ/YxFr0OcammmPMqjYKy7dlk2H6FSk9jnqh19lXu+qZP6 >> > UzlUS+IHHn7o0OaV9Tflsey7/24hFjEVAHFKZxsG7VzKaSjri6aJ8p2Mr2D1o1os >> > rEMF15pV2d9l7tIFN0FigqmffZswpTbk+uNNHc8rg+Tq7QV1fhceTgLLXRfqlpq8 >> > ES/Y3Epr22KCCEhftQw3fqC1XpOpn5CUc3svJx7llXWYc/c7RdxGDNSujFF3IARk >> > 741mx0N/ZkrcXZ/u/zk5+gMmS7NxhQXNk3QueRTIlqZv7e9GdlaYAPMZxQZKQKm3 >> > +YQ= >> > =B3c1 >> > -----END PGP SIGNATURE----- >> > >> > > > -- > Shawn Webb > Cofounder and Security Engineer > HardenedBSD > > GPG Key ID: 0x6A84658F52456EEE > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE From owner-svn-src-head@freebsd.org Tue Aug 2 00:38:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C347BA2847 for ; Tue, 2 Aug 2016 00:38:24 +0000 (UTC) (envelope-from callandy@alpha9.inftekhosting.com) Received: from alpha9.inftekhosting.com (alpha9.inftekhosting.com [208.52.148.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 0C8B01C30 for ; Tue, 2 Aug 2016 00:38:23 +0000 (UTC) (envelope-from callandy@alpha9.inftekhosting.com) Received: from callandy by alpha9.inftekhosting.com with local (Exim 4.87) (envelope-from ) id 1bUNHI-00227l-Dv for svn-src-head@freebsd.org; Mon, 01 Aug 2016 20:09:48 -0400 To: svn-src-head@freebsd.org Subject: Shipment delivery problem #000578325 X-PHP-Script: callandy.com/post.php for 91.121.207.122 Date: Mon, 1 Aug 2016 19:09:48 -0500 From: "FedEx 2Day" Reply-To: "FedEx 2Day" Message-ID: <94f59806c3299f1901031060e4fdba57@callandy.com> X-Priority: 3 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - alpha9.inftekhosting.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [805 500] / [47 12] X-AntiAbuse: Sender Address Domain - alpha9.inftekhosting.com X-Get-Message-Sender-Via: alpha9.inftekhosting.com: authenticated_id: callandy/from_h X-Authenticated-Sender: alpha9.inftekhosting.com: johnny.lloyd@callandy.com X-Source: X-Source-Args: X-Source-Dir: Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 00:38:24 -0000 Dear Customer, Courier was unable to deliver the parcel to you. Delivery Label is attached to this email. Yours faithfully, Johnny Lloyd, Sr. Station Manager. From owner-svn-src-head@freebsd.org Tue Aug 2 03:06:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B61ABABE5D; Tue, 2 Aug 2016 03:06:00 +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 42F1411EC; Tue, 2 Aug 2016 03:06:00 +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 u7235xaM023563; Tue, 2 Aug 2016 03:05:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7235xiX023560; Tue, 2 Aug 2016 03:05:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201608020305.u7235xiX023560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 2 Aug 2016 03:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303655 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 03:06:00 -0000 Author: mjg Date: Tue Aug 2 03:05:59 2016 New Revision: 303655 URL: https://svnweb.freebsd.org/changeset/base/303655 Log: locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case Reported by: Michael Butler Modified: head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Tue Aug 2 02:32:00 2016 (r303654) +++ head/sys/kern/kern_mutex.c Tue Aug 2 03:05:59 2016 (r303655) @@ -452,8 +452,10 @@ __mtx_lock_sleep(volatile uintptr_t *c, if (SCHEDULER_STOPPED()) return; -#if defined(ADAPTIVE_MUTEXES) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_MUTEXES) lock_delay_arg_init(&lda, &mtx_delay); +#elif defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, NULL); #endif m = mtxlock2mtx(c); Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Tue Aug 2 02:32:00 2016 (r303654) +++ head/sys/kern/kern_rwlock.c Tue Aug 2 03:05:59 2016 (r303655) @@ -396,8 +396,10 @@ __rw_rlock(volatile uintptr_t *c, const if (SCHEDULER_STOPPED()) return; -#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_RWLOCKS) lock_delay_arg_init(&lda, &rw_delay); +#elif defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, NULL); #endif rw = rwlock2rw(c); @@ -782,8 +784,10 @@ __rw_wlock_hard(volatile uintptr_t *c, u if (SCHEDULER_STOPPED()) return; -#if defined(ADAPTIVE_RWLOCKS) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_RWLOCKS) lock_delay_arg_init(&lda, &rw_delay); +#elif defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, NULL); #endif rw = rwlock2rw(c); Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Tue Aug 2 02:32:00 2016 (r303654) +++ head/sys/kern/kern_sx.c Tue Aug 2 03:05:59 2016 (r303655) @@ -554,8 +554,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t if (SCHEDULER_STOPPED()) return (0); -#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_SX) lock_delay_arg_init(&lda, &sx_delay); +#elif defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, NULL); #endif /* If we already hold an exclusive lock, then recurse. */ @@ -861,8 +863,10 @@ _sx_slock_hard(struct sx *sx, int opts, if (SCHEDULER_STOPPED()) return (0); -#if defined(ADAPTIVE_SX) || defined(KDTRACE_HOOKS) +#if defined(ADAPTIVE_SX) lock_delay_arg_init(&lda, &sx_delay); +#elif defined(KDTRACE_HOOKS) + lock_delay_arg_init(&lda, NULL); #endif #ifdef KDTRACE_HOOKS state = sx->sx_lock; From owner-svn-src-head@freebsd.org Tue Aug 2 06:36:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DF1CBAA6EF; Tue, 2 Aug 2016 06:36:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BD8D18A5; Tue, 2 Aug 2016 06:36:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u726altk000177; Tue, 2 Aug 2016 06:36:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u726alY8000175; Tue, 2 Aug 2016 06:36:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608020636.u726alY8000175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 2 Aug 2016 06:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303656 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 06:36:48 -0000 Author: sephe Date: Tue Aug 2 06:36:47 2016 New Revision: 303656 URL: https://svnweb.freebsd.org/changeset/base/303656 Log: tcp/lro: Implement hash table for LRO entries. This significantly improves HTTP workload performance and reduces HTTP workload latency. Reviewed by: rrs, gallatin, hps Obtained from: rrs, gallatin Sponsored by: Netflix (rrs, gallatin) , Microsoft (sephe) Differential Revision: https://reviews.freebsd.org/D6689 Modified: head/sys/netinet/tcp_lro.c head/sys/netinet/tcp_lro.h Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Tue Aug 2 03:05:59 2016 (r303655) +++ head/sys/netinet/tcp_lro.c Tue Aug 2 06:36:47 2016 (r303656) @@ -68,19 +68,24 @@ static MALLOC_DEFINE(M_LRO, "LRO", "LRO #endif static void tcp_lro_rx_done(struct lro_ctrl *lc); +static int tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, + uint32_t csum, int use_hash); static __inline void -tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_entry *le) +tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_head *bucket, + struct lro_entry *le) { LIST_INSERT_HEAD(&lc->lro_active, le, next); + LIST_INSERT_HEAD(bucket, le, hash_next); } static __inline void tcp_lro_active_remove(struct lro_entry *le) { - LIST_REMOVE(le, next); + LIST_REMOVE(le, next); /* active list */ + LIST_REMOVE(le, hash_next); /* hash bucket */ } int @@ -95,7 +100,7 @@ tcp_lro_init_args(struct lro_ctrl *lc, s { struct lro_entry *le; size_t size; - unsigned i; + unsigned i, elements; lc->lro_bad_csum = 0; lc->lro_queued = 0; @@ -110,6 +115,18 @@ tcp_lro_init_args(struct lro_ctrl *lc, s LIST_INIT(&lc->lro_free); LIST_INIT(&lc->lro_active); + /* create hash table to accelerate entry lookup */ + if (lro_entries > lro_mbufs) + elements = lro_entries; + else + elements = lro_mbufs; + lc->lro_hash = phashinit_flags(elements, M_LRO, &lc->lro_hashsz, + HASH_NOWAIT); + if (lc->lro_hash == NULL) { + memset(lc, 0, sizeof(*lc)); + return (ENOMEM); + } + /* compute size to allocate */ size = (lro_mbufs * sizeof(struct lro_mbuf_sort)) + (lro_entries * sizeof(*le)); @@ -147,6 +164,13 @@ tcp_lro_free(struct lro_ctrl *lc) m_freem(le->m_head); } + /* free hash table */ + if (lc->lro_hash != NULL) { + free(lc->lro_hash, M_LRO); + lc->lro_hash = NULL; + } + lc->lro_hashsz = 0; + /* free mbuf array, if any */ for (x = 0; x != lc->lro_mbuf_count; x++) m_freem(lc->lro_mbuf_data[x].mb); @@ -487,7 +511,7 @@ tcp_lro_flush_all(struct lro_ctrl *lc) } /* add packet to LRO engine */ - if (tcp_lro_rx(lc, mb, 0) != 0) { + if (tcp_lro_rx2(lc, mb, 0, 0) != 0) { /* input packet to network layer */ (*lc->ifp->if_input)(lc->ifp, mb); lc->lro_queued++; @@ -561,8 +585,8 @@ tcp_lro_rx_ipv4(struct lro_ctrl *lc, str } #endif -int -tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum) +static int +tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) { struct lro_entry *le; struct ether_header *eh; @@ -578,6 +602,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m tcp_seq seq; int error, ip_len, l; uint16_t eh_type, tcp_data_len; + struct lro_head *bucket; /* We expect a contiguous header [eh, ip, tcp]. */ @@ -670,8 +695,41 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m seq = ntohl(th->th_seq); + if (!use_hash) { + bucket = &lc->lro_hash[0]; + } else if (M_HASHTYPE_ISHASH(m)) { + bucket = &lc->lro_hash[m->m_pkthdr.flowid % lc->lro_hashsz]; + } else { + uint32_t hash; + + switch (eh_type) { +#ifdef INET + case ETHERTYPE_IP: + hash = ip4->ip_src.s_addr + ip4->ip_dst.s_addr; + break; +#endif +#ifdef INET6 + case ETHERTYPE_IPV6: + hash = ip6->ip6_src.s6_addr32[0] + + ip6->ip6_dst.s6_addr32[0]; + hash += ip6->ip6_src.s6_addr32[1] + + ip6->ip6_dst.s6_addr32[1]; + hash += ip6->ip6_src.s6_addr32[2] + + ip6->ip6_dst.s6_addr32[2]; + hash += ip6->ip6_src.s6_addr32[3] + + ip6->ip6_dst.s6_addr32[3]; + break; +#endif + default: + hash = 0; + break; + } + hash += th->th_sport + th->th_dport; + bucket = &lc->lro_hash[hash % lc->lro_hashsz]; + } + /* Try to find a matching previous segment. */ - LIST_FOREACH(le, &lc->lro_active, next) { + LIST_FOREACH(le, bucket, hash_next) { if (le->eh_type != eh_type) continue; if (le->source_port != th->th_sport || @@ -779,7 +837,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m /* Start a new segment chain. */ le = LIST_FIRST(&lc->lro_free); LIST_REMOVE(le, next); - tcp_lro_active_insert(lc, le); + tcp_lro_active_insert(lc, bucket, le); getmicrotime(&le->mtime); /* Start filling in details. */ @@ -837,6 +895,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m return (0); } +int +tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum) +{ + + return tcp_lro_rx2(lc, m, csum, 1); +} + void tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb) { Modified: head/sys/netinet/tcp_lro.h ============================================================================== --- head/sys/netinet/tcp_lro.h Tue Aug 2 03:05:59 2016 (r303655) +++ head/sys/netinet/tcp_lro.h Tue Aug 2 06:36:47 2016 (r303656) @@ -40,6 +40,7 @@ struct lro_entry { LIST_ENTRY(lro_entry) next; + LIST_ENTRY(lro_entry) hash_next; struct mbuf *m_head; struct mbuf *m_tail; union { @@ -95,6 +96,8 @@ struct lro_ctrl { unsigned short lro_ackcnt_lim; /* max # of aggregated ACKs */ unsigned lro_length_lim; /* max len of aggregated data */ + u_long lro_hashsz; + struct lro_head *lro_hash; struct lro_head lro_active; struct lro_head lro_free; }; From owner-svn-src-head@freebsd.org Tue Aug 2 09:26:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55D70BAC4CC; Tue, 2 Aug 2016 09:26:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D7A9182C; Tue, 2 Aug 2016 09:26:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u729QO4U095327 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 Aug 2016 02:26:25 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u729QOwS095326; Tue, 2 Aug 2016 02:26:24 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 2 Aug 2016 02:26:24 -0700 From: Gleb Smirnoff To: Michael Zhilin Cc: Andrey Chernov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303264 - head/usr.bin/calendar/calendars/ru_RU.UTF-8 Message-ID: <20160802092624.GJ1076@FreeBSD.org> References: <201607241035.u6OAZijR023467@repo.freebsd.org> <76ecf576-3b05-9a58-9c58-6b45f49b7286@freebsd.org> <20160724204431.GM1076@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 09:26:26 -0000 On Mon, Jul 25, 2016 at 02:42:43PM +0300, Michael Zhilin wrote: M> Hi Gleb, Andrey, M> M> Could you please fix one more line in M> usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common: M> >> 7 нояб. День окт.ябрьской революции 1917 года Thanks to Andrey, he fixed. M> BTW, the line of "usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military" M> probably has incorrect date: M> >> 7 нояб. День освобождения Москвы силами народного ополчения под M> руководством Кузьмы Минина и Дмитрия Пожарского от польских интервентов M> (1612 год) M> M> I suppose it should be 4th of November :) You got your own commit access now, so please do it yourself if you are confident enough about the change. I am not :) -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Tue Aug 2 12:18:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60777BAC80F; Tue, 2 Aug 2016 12:18:07 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DC9D1CA8; Tue, 2 Aug 2016 12:18:07 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72CI69N024426; Tue, 2 Aug 2016 12:18:06 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72CI67O024425; Tue, 2 Aug 2016 12:18:06 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201608021218.u72CI67O024425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 2 Aug 2016 12:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303657 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 12:18:07 -0000 Author: ae Date: Tue Aug 2 12:18:06 2016 New Revision: 303657 URL: https://svnweb.freebsd.org/changeset/base/303657 Log: Fix NULL pointer dereference. ro pointer can be NULL when IPSec consumes mbuf. PR: 211486 MFC after: 3 days Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Tue Aug 2 06:36:47 2016 (r303656) +++ head/sys/netinet6/ip6_output.c Tue Aug 2 12:18:06 2016 (r303657) @@ -1058,7 +1058,8 @@ done: * Release the route if using our private route, or if * (with flowtable) we don't have our own reference. */ - if (ro == &ip6route || ro->ro_flags & RT_NORTREF) + if (ro == &ip6route || + (ro != NULL && ro->ro_flags & RT_NORTREF)) RO_RTFREE(ro); return (error); From owner-svn-src-head@freebsd.org Tue Aug 2 12:39:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AA9BAC099 for ; Tue, 2 Aug 2016 12:39:47 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13DC51EEB for ; Tue, 2 Aug 2016 12:39:46 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f51.google.com with SMTP id g62so137275637lfe.3 for ; Tue, 02 Aug 2016 05:39:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=aCKuswvWL3sOXVLO2sfR3Pk7FT5e0i9Ovzj4fsdwoQM=; b=h0vhDPoTWJMoOIKn4WXI5RYXW9SLeWsNmltJlasnaejnHudXTlT1F86k26UNTRQfsT I5GxBodZpXzoBUGoLM5Jns6BDBaAZeGQITnC5ByU3qn5cfFqRgu/i1Awd99lpF+0FlKV yWWHTzoDEcZg43ajhOhbUZcO9UC2mp+50v661+A1xts8nObs3ccBksXPAL9qv2CasovS tN+AWraOcbaYzP+YQxI9+lpQoKGffOlfi31KcCB7WaNXXqZ+kQg+ccXqD2chef79Ursf 19TC7JS7Qi1Er4rAbjZI+D4iS6KJxXV0WyqovC7pIdgbq/LUViQzAvIw+01QMSaRpRCB nOIA== X-Gm-Message-State: AEkoousAbhMUQWRnz/B4WG4EYZEDLlsJB2UMZgS4NkhdX2f6MxFiQlGQAtAjaxoxP/Sfjw== X-Received: by 10.25.147.197 with SMTP id v188mr21666756lfd.9.1470141130260; Tue, 02 Aug 2016 05:32:10 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id 62sm471675ljj.3.2016.08.02.05.32.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Aug 2016 05:32:09 -0700 (PDT) Subject: Re: svn commit: r303264 - head/usr.bin/calendar/calendars/ru_RU.UTF-8 To: Gleb Smirnoff , Michael Zhilin References: <201607241035.u6OAZijR023467@repo.freebsd.org> <76ecf576-3b05-9a58-9c58-6b45f49b7286@freebsd.org> <20160724204431.GM1076@FreeBSD.org> <20160802092624.GJ1076@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: Date: Tue, 2 Aug 2016 15:32:08 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160802092624.GJ1076@FreeBSD.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 12:39:47 -0000 On 02.08.2016 12:26, Gleb Smirnoff wrote: > You got your own commit access now, so please do it yourself if you > are confident enough about the change. I am not :) Really this date is in the middle, see http://bibliopskov.ru/4november.htm From owner-svn-src-head@freebsd.org Tue Aug 2 13:14:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28DD7BACD69; Tue, 2 Aug 2016 13:14:18 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id DE1A41AAD; Tue, 2 Aug 2016 13:14:17 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 08030263C; Tue, 2 Aug 2016 13:14:11 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id 3B1AB476B; Tue, 2 Aug 2016 15:14:17 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Conrad Meyer Cc: Shawn Webb , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, "secteam\@FreeBSD.org" Subject: Re: svn commit: r303650 - head/sys/opencrypto References: <201608012257.u71Mv3YA030076@repo.freebsd.org> Date: Tue, 02 Aug 2016 15:14:17 +0200 In-Reply-To: (Conrad Meyer's message of "Mon, 1 Aug 2016 16:41:02 -0700") Message-ID: <86wpjzqpna.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 13:14:18 -0000 Conrad Meyer writes: > I don't think this is security-related despite being a bug in > crypto-adjacent code. At best it's a DoS, I think. If it can be triggered remotely, it's a security issue. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@freebsd.org Tue Aug 2 14:17:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C5ABBAC3A2; Tue, 2 Aug 2016 14:17:39 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 121C5137A; Tue, 2 Aug 2016 14:17:39 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 114DA1FFF; Tue, 2 Aug 2016 14:17:39 +0000 (UTC) Date: Tue, 2 Aug 2016 14:17:39 +0000 From: Alexey Dokuchaev To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Mikhail Teterin Subject: Re: svn commit: r303047 - head/usr.bin/sed Message-ID: <20160802141738.GA84154@FreeBSD.org> References: <201607192256.u6JMuewv007503@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607192256.u6JMuewv007503@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 14:17:39 -0000 On Tue, Jul 19, 2016 at 10:56:40PM +0000, Pedro F. Giffuni wrote: > New Revision: 303047 > URL: https://svnweb.freebsd.org/changeset/base/303047 > > Log: > sed(1): Assorted cleanups and simplifications. > > Const-ify several variables, make it build cleanly with WARNS level 5. > > Submitted by: mi > PR: 195929 > MFC after: 1 month Hi Pedro, This change causes `games/openttd' to fail now, because the generated `$wrkdir/openttd-1.6.1/objs/release/Makefile' file is broken (SRCS var is set to bogus value, search for ^SRCS). Reverting usr.bin/sed back to r303046 fixes it. The latest revision (with ngie@'s fix) exhibits the same problem. Now the port uses somewhat obscure build system, but the sed(1) magic happens inside generate_foo() functions using SRC_REPLACE variable set in make_sed() inside `config.lib' file; these functions are called by the configure script. Would you or Mikhail mind taking a look? Thanks, ./danfe From owner-svn-src-head@freebsd.org Tue Aug 2 14:50:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A245BACD76; Tue, 2 Aug 2016 14:50:17 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33C95167D; Tue, 2 Aug 2016 14:50:17 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72EoGok080859; Tue, 2 Aug 2016 14:50:16 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72EoE5j080841; Tue, 2 Aug 2016 14:50:14 GMT (envelope-from br@FreeBSD.org) Message-Id: <201608021450.u72EoE5j080841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 2 Aug 2016 14:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303660 - in head/sys: boot/fdt/dts/riscv cddl/contrib/opensolaris/uts/common/sys cddl/dev/dtrace/riscv conf riscv/conf riscv/htif riscv/include riscv/riscv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 14:50:17 -0000 Author: br Date: Tue Aug 2 14:50:14 2016 New Revision: 303660 URL: https://svnweb.freebsd.org/changeset/base/303660 Log: Update RISC-V port to Privileged Architecture Version 1.9. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/sys/boot/fdt/dts/riscv/spike.dts head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c head/sys/conf/ldscript.riscv head/sys/riscv/conf/GENERIC head/sys/riscv/htif/htif.c head/sys/riscv/htif/htif_block.c head/sys/riscv/htif/htif_console.c head/sys/riscv/include/cpu.h head/sys/riscv/include/cpufunc.h head/sys/riscv/include/db_machdep.h head/sys/riscv/include/intr.h head/sys/riscv/include/pte.h head/sys/riscv/include/riscvreg.h head/sys/riscv/include/vmparam.h head/sys/riscv/riscv/exception.S head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/identcpu.c head/sys/riscv/riscv/intr_machdep.c head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c head/sys/riscv/riscv/pmap.c head/sys/riscv/riscv/swtch.S head/sys/riscv/riscv/timer.c head/sys/riscv/riscv/trap.c head/sys/riscv/riscv/vm_machdep.c Modified: head/sys/boot/fdt/dts/riscv/spike.dts ============================================================================== --- head/sys/boot/fdt/dts/riscv/spike.dts Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/boot/fdt/dts/riscv/spike.dts Tue Aug 2 14:50:14 2016 (r303660) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -37,8 +37,8 @@ /dts-v1/; / { - model = "UC Berkeley Spike Simulator RV64I"; - compatible = "riscv,rv64i"; + model = "UC Berkeley Spike Simulator RV64"; + compatible = "riscv,rv64"; #address-cells = <1>; #size-cells = <1>; #interrupt-cells = <1>; @@ -49,14 +49,14 @@ cpu@0 { device_type = "cpu"; - compatible = "riscv,rv64i"; - reg = <0x40002000>; + compatible = "riscv,rv64"; + reg = <0x40001000>; }; cpu@1 { device_type = "cpu"; - compatible = "riscv,rv64i"; - reg = <0x4000a000>; + compatible = "riscv,rv64"; + reg = <0x40002000>; }; }; @@ -66,12 +66,12 @@ memory { device_type = "memory"; - reg = <0x0 0x40000000>; /* 1GB at 0x0 */ + reg = <0x80000000 0x40000000>; /* 1GB at 0x80000000 */ }; soc { - #address-cells = <2>; - #size-cells = <2>; + #address-cells = <1>; + #size-cells = <1>; #interrupt-cells = <1>; compatible = "simple-bus"; @@ -84,14 +84,15 @@ timer0: timer@0 { compatible = "riscv,timer"; - interrupts = < 1 >; + reg = < 0x40000000 0x100 >; + interrupts = < 5 >; interrupt-parent = < &pic0 >; clock-frequency = < 1000000 >; }; htif0: htif@0 { compatible = "riscv,htif"; - interrupts = < 0 >; + interrupts = < 1 >; interrupt-parent = < &pic0 >; console0: console@0 { Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Aug 2 14:50:14 2016 (r303660) @@ -2498,8 +2498,8 @@ extern void dtrace_helpers_destroy(proc_ #elif defined(__riscv__) -#define SD_RA_SP_MASK 0x1fff07f -#define SD_RA_SP 0x0113023 +#define SD_RA_SP_MASK 0x01fff07f +#define SD_RA_SP 0x00113023 #define DTRACE_INVOP_SD 1 #define DTRACE_INVOP_RET 2 Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_asm.S Tue Aug 2 14:50:14 2016 (r303660) @@ -57,8 +57,8 @@ END(dtrace_membar_consumer) dtrace_icookie_t dtrace_interrupt_disable(void) */ ENTRY(dtrace_interrupt_disable) - csrrci a0, sstatus, SSTATUS_IE - andi a0, a0, SSTATUS_IE + csrrci a0, sstatus, (SSTATUS_SIE) + andi a0, a0, (SSTATUS_SIE) RET END(dtrace_interrupt_disable) Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Tue Aug 2 14:50:14 2016 (r303660) @@ -203,9 +203,9 @@ dtrace_trap(struct trapframe *frame, u_i * All the rest will be handled in the usual way. */ switch (type) { - case EXCP_LOAD_ACCESS_FAULT: - case EXCP_STORE_ACCESS_FAULT: - case EXCP_INSTR_ACCESS_FAULT: + case EXCP_FAULT_LOAD: + case EXCP_FAULT_STORE: + case EXCP_FAULT_FETCH: /* Flag a bad address. */ cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR; cpu_core[curcpu].cpuc_dtrace_illval = 0; Modified: head/sys/conf/ldscript.riscv ============================================================================== --- head/sys/conf/ldscript.riscv Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/conf/ldscript.riscv Tue Aug 2 14:50:14 2016 (r303660) @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); SECTIONS { /* Read-only sections, merged into text segment: */ - . = kernbase + 0x100; + . = kernbase + 0x80000000 /* KERNENTRY */; .text : AT(ADDR(.text) - kernbase) { *(.text) Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/conf/GENERIC Tue Aug 2 14:50:14 2016 (r303660) @@ -26,6 +26,7 @@ makeoptions DEBUG=-g # Build kernel wit # FIXME: linker error. "--relax and -r may not be used together" makeoptions WITHOUT_MODULES="usb otusfw mwlfw ispfw mwlfw ralfw rtwnfw urtwnfw" +# makeoptions NO_MODULES options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption @@ -40,7 +41,6 @@ options UFS_ACL # Support for access options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling options QUOTA # Enable disk quotas for UFS -options MD_ROOT # MD is a potential root device options NFSCL # Network Filesystem Client options NFSD # Network Filesystem Server options NFSLOCKD # Network Lock Manager @@ -93,6 +93,7 @@ options INVARIANT_SUPPORT # Extra sanit # options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # options EARLY_PRINTF +# options VERBOSE_SYSINIT # Pseudo devices. device loop # Network loopback Modified: head/sys/riscv/htif/htif.c ============================================================================== --- head/sys/riscv/htif/htif.c Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/htif/htif.c Tue Aug 2 14:50:14 2016 (r303660) @@ -177,11 +177,6 @@ htif_enumerate(struct htif_softc *sc) htif_command(cmd); - /* Do poll as interrupts are disabled yet */ - while (sc->identify_done == 0) { - htif_handle_entry(sc); - } - len = strnlen(id, sizeof(id)); if (len <= 0) break; Modified: head/sys/riscv/htif/htif_block.c ============================================================================== --- head/sys/riscv/htif/htif_block.c Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/htif/htif_block.c Tue Aug 2 14:50:14 2016 (r303660) @@ -202,6 +202,7 @@ htif_blk_task(void *arg) uint64_t req_paddr; struct bio *bp; uint64_t paddr; + uint64_t resp; uint64_t cmd; int i; @@ -239,7 +240,8 @@ htif_blk_task(void *arg) cmd |= req_paddr; sc->cmd_done = 0; - htif_command(cmd); + resp = htif_command(cmd); + htif_blk_intr(sc, resp); /* Wait for interrupt */ i = 0; Modified: head/sys/riscv/htif/htif_console.c ============================================================================== --- head/sys/riscv/htif/htif_console.c Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/htif/htif_console.c Tue Aug 2 14:50:14 2016 (r303660) @@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$"); #include -extern uint64_t console_intr; - static tsw_outwakeup_t riscvtty_outwakeup; static struct ttydevsw riscv_ttydevsw = { @@ -102,7 +100,7 @@ struct queue_entry *entry_last; struct queue_entry *entry_served; static void -htif_putc(int c) +riscv_putc(int c) { uint64_t cmd; @@ -110,57 +108,7 @@ htif_putc(int c) cmd |= (CONSOLE_DEFAULT_ID << HTIF_DEV_ID_SHIFT); cmd |= c; -#ifdef SPIN_IN_MACHINE_MODE - machine_command(ECALL_HTIF_LOWPUTC, cmd); -#else - htif_command(cmd); -#endif - -} - -static uint8_t -htif_getc(void) -{ - uint64_t cmd; - uint8_t res; - - cmd = (HTIF_CMD_READ << HTIF_CMD_SHIFT); - cmd |= (CONSOLE_DEFAULT_ID << HTIF_DEV_ID_SHIFT); - - res = htif_command(cmd); - - return (res); -} - -static void -riscv_putc(int c) -{ - uint64_t counter; - uint64_t *cc; - uint64_t val; - - val = 0; - counter = 0; - - cc = (uint64_t*)&console_intr; - *cc = 0; - - htif_putc(c); - -#ifndef SPIN_IN_MACHINE_MODE - /* Wait for an interrupt */ - __asm __volatile( - "li %0, 1\n" /* counter = 1 */ - "slli %0, %0, 12\n" /* counter <<= 12 */ - "1:" - "addi %0, %0, -1\n" /* counter -= 1 */ - "beqz %0, 2f\n" /* counter == 0 ? finish */ - "ld %1, 0(%2)\n" /* val = *cc */ - "beqz %1, 1b\n" /* val == 0 ? repeat */ - "2:" - : "=&r"(counter), "=&r"(val) : "r"(cc) - ); -#endif + machine_command(ECALL_HTIF_CMD, cmd); } #ifdef EARLY_PRINTF @@ -272,14 +220,19 @@ riscv_cngetc(struct consdev *cp) uint64_t entry; uint64_t devid; #endif + uint64_t cmd; uint8_t data; int ch; - htif_getc(); + cmd = (HTIF_CMD_READ << HTIF_CMD_SHIFT); + cmd |= (CONSOLE_DEFAULT_ID << HTIF_DEV_ID_SHIFT); + + machine_command(ECALL_HTIF_CMD_REQ, cmd); #if defined(KDB) if (kdb_active) { - entry = machine_command(ECALL_HTIF_GET_ENTRY, 0); + + entry = machine_command(ECALL_HTIF_CMD_RESP, 0); while (entry) { devid = HTIF_DEV_ID(entry); devcmd = HTIF_DEV_CMD(entry); @@ -294,7 +247,7 @@ riscv_cngetc(struct consdev *cp) devid); } - entry = machine_command(ECALL_HTIF_GET_ENTRY, 0); + entry = machine_command(ECALL_HTIF_CMD_RESP, 0); } } #endif Modified: head/sys/riscv/include/cpu.h ============================================================================== --- head/sys/riscv/include/cpu.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/cpu.h Tue Aug 2 14:50:14 2016 (r303660) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -67,11 +67,10 @@ #define CPU_PART_SHIFT 62 #define CPU_PART_MASK (0x3ul << CPU_PART_SHIFT) -#define CPU_PART(mcpuid) ((mcpuid & CPU_PART_MASK) >> CPU_PART_SHIFT) -#define CPU_PART_RV32I 0x0 -#define CPU_PART_RV32E 0x1 -#define CPU_PART_RV64I 0x2 -#define CPU_PART_RV128I 0x3 +#define CPU_PART(misa) ((misa & CPU_PART_MASK) >> CPU_PART_SHIFT) +#define CPU_PART_RV32 0x1 +#define CPU_PART_RV64 0x2 +#define CPU_PART_RV128 0x3 extern char btext[]; extern char etext[]; Modified: head/sys/riscv/include/cpufunc.h ============================================================================== --- head/sys/riscv/include/cpufunc.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/cpufunc.h Tue Aug 2 14:50:14 2016 (r303660) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -54,11 +54,11 @@ intr_disable(void) uint64_t ret; __asm __volatile( - "csrrci %0, sstatus, 1" - : "=&r" (ret) + "csrrci %0, sstatus, %1" + : "=&r" (ret) : "i" (SSTATUS_SIE) ); - return (ret & SSTATUS_IE); + return (ret & (SSTATUS_SIE)); } static __inline void @@ -76,7 +76,8 @@ intr_enable(void) { __asm __volatile( - "csrsi sstatus, 1" + "csrsi sstatus, %0" + :: "i" (SSTATUS_SIE) ); } Modified: head/sys/riscv/include/db_machdep.h ============================================================================== --- head/sys/riscv/include/db_machdep.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/db_machdep.h Tue Aug 2 14:50:14 2016 (r303660) @@ -41,7 +41,7 @@ #include #include -#define T_BREAKPOINT (EXCP_INSTR_BREAKPOINT) +#define T_BREAKPOINT (EXCP_BREAKPOINT) #define T_WATCHPOINT (0) typedef vm_offset_t db_addr_t; Modified: head/sys/riscv/include/intr.h ============================================================================== --- head/sys/riscv/include/intr.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/intr.h Tue Aug 2 14:50:14 2016 (r303660) @@ -57,11 +57,23 @@ void riscv_unmask_ipi(void); #endif enum { - IRQ_SOFTWARE, - IRQ_TIMER, - IRQ_HTIF, + IRQ_SOFTWARE_USER, + IRQ_SOFTWARE_SUPERVISOR, + IRQ_SOFTWARE_HYPERVISOR, + IRQ_SOFTWARE_MACHINE, + IRQ_TIMER_USER, + IRQ_TIMER_SUPERVISOR, + IRQ_TIMER_HYPERVISOR, + IRQ_TIMER_MACHINE, + IRQ_EXTERNAL_USER, + IRQ_EXTERNAL_SUPERVISOR, + IRQ_EXTERNAL_HYPERVISOR, + IRQ_EXTERNAL_MACHINE, +#if 0 + /* lowRISC TODO */ IRQ_COP, /* lowRISC only */ IRQ_UART, /* lowRISC only */ +#endif NIRQS }; Modified: head/sys/riscv/include/pte.h ============================================================================== --- head/sys/riscv/include/pte.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/pte.h Tue Aug 2 14:50:14 2016 (r303660) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Andrew Turner - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -66,29 +66,18 @@ typedef uint64_t pn_t; /* page number #define Ln_ADDR_MASK (Ln_ENTRIES - 1) /* Bits 9:7 are reserved for software */ -#define PTE_SW_MANAGED (1 << 8) -#define PTE_SW_WIRED (1 << 7) -#define PTE_DIRTY (1 << 6) /* Virtual page is written */ -#define PTE_REF (1 << 5) /* Virtual page is referenced */ -#define PTE_VALID (1 << 0) /* Virtual page is valid */ -#define PTE_TYPE_S 1 -#define PTE_TYPE_M (0xf << PTE_TYPE_S) -#define PTE_TYPE_PTR 0 -#define PTE_TYPE_PTR_G 1 -#define PTE_TYPE_SROURX 2 /* Supervisor read-only, user read-execute page. */ -#define PTE_TYPE_SRWURWX 3 /* Supervisor read-write, user read-write-execute page. */ -#define PTE_TYPE_SURO 4 /* Supervisor and user read-only page. */ -#define PTE_TYPE_SURW 5 /* Supervisor and user read-write page. */ -#define PTE_TYPE_SURX 6 /* Supervisor and user read-execute page. */ -#define PTE_TYPE_SURWX 7 /* Supervisor and User Read Write Execute */ -#define PTE_TYPE_SRO 8 /* Supervisor read-only page. */ -#define PTE_TYPE_SRW 9 /* Supervisor read-write page. */ -#define PTE_TYPE_SRX 10 /* Supervisor read-execute page. */ -#define PTE_TYPE_SRWX 11 /* Supervisor read-write-execute page. */ -#define PTE_TYPE_SRO_G 12 /* Supervisor read-only page--global mapping. */ -#define PTE_TYPE_SRW_G 13 /* Supervisor read-write page--global mapping. */ -#define PTE_TYPE_SRX_G 14 /* Supervisor read-execute page--global mapping. */ -#define PTE_TYPE_SRWX_G 15 /* Supervisor Read Write Execute Global */ +#define PTE_SW_MANAGED (1 << 9) +#define PTE_SW_WIRED (1 << 8) +#define PTE_D (1 << 7) /* Dirty */ +#define PTE_A (1 << 6) /* Accessed */ +#define PTE_G (1 << 5) /* Global */ +#define PTE_U (1 << 4) /* User */ +#define PTE_X (1 << 3) /* Execute */ +#define PTE_W (1 << 2) /* Write */ +#define PTE_R (1 << 1) /* Read */ +#define PTE_V (1 << 0) /* Valid */ +#define PTE_RWX (PTE_R | PTE_W | PTE_X) +#define PTE_RX (PTE_R | PTE_X) #define PTE_PPN0_S 10 #define PTE_PPN1_S 19 Modified: head/sys/riscv/include/riscvreg.h ============================================================================== --- head/sys/riscv/include/riscvreg.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/riscvreg.h Tue Aug 2 14:50:14 2016 (r303660) @@ -39,88 +39,127 @@ /* Machine mode requests */ #define ECALL_MTIMECMP 0x01 -#define ECALL_CLEAR_PENDING 0x02 -#define ECALL_HTIF_CMD 0x03 -#define ECALL_HTIF_GET_ENTRY 0x04 -#define ECALL_MCPUID_GET 0x05 -#define ECALL_MIMPID_GET 0x06 -#define ECALL_SEND_IPI 0x07 -#define ECALL_CLEAR_IPI 0x08 -#define ECALL_HTIF_LOWPUTC 0x09 -#define ECALL_MIE_SET 0x0a -#define ECALL_IO_IRQ_MASK 0x0b +#define ECALL_HTIF_GET_ENTRY 0x02 +#define ECALL_MCPUID_GET 0x03 +#define ECALL_MIMPID_GET 0x04 +#define ECALL_SEND_IPI 0x05 +#define ECALL_CLEAR_IPI 0x06 +#define ECALL_MIE_SET 0x07 +#define ECALL_IO_IRQ_MASK 0x08 +#define ECALL_HTIF_CMD 0x09 +#define ECALL_HTIF_CMD_REQ 0x0a +#define ECALL_HTIF_CMD_RESP 0x0b #define EXCP_SHIFT 0 #define EXCP_MASK (0xf << EXCP_SHIFT) -#define EXCP_INSTR_ADDR_MISALIGNED 0 -#define EXCP_INSTR_ACCESS_FAULT 1 -#define EXCP_INSTR_ILLEGAL 2 -#define EXCP_INSTR_BREAKPOINT 3 -#define EXCP_LOAD_ADDR_MISALIGNED 4 -#define EXCP_LOAD_ACCESS_FAULT 5 -#define EXCP_STORE_ADDR_MISALIGNED 6 -#define EXCP_STORE_ACCESS_FAULT 7 -#define EXCP_UMODE_ENV_CALL 8 -#define EXCP_SMODE_ENV_CALL 9 -#define EXCP_HMODE_ENV_CALL 10 -#define EXCP_MMODE_ENV_CALL 11 -#define EXCP_INTR (1 << 31) +#define EXCP_MISALIGNED_FETCH 0 +#define EXCP_FAULT_FETCH 1 +#define EXCP_ILLEGAL_INSTRUCTION 2 +#define EXCP_BREAKPOINT 3 +#define EXCP_MISALIGNED_LOAD 4 +#define EXCP_FAULT_LOAD 5 +#define EXCP_MISALIGNED_STORE 6 +#define EXCP_FAULT_STORE 7 +#define EXCP_USER_ECALL 8 +#define EXCP_SUPERVISOR_ECALL 9 +#define EXCP_HYPERVISOR_ECALL 10 +#define EXCP_MACHINE_ECALL 11 +#define EXCP_INTR (1ul << 63) #define EXCP_INTR_SOFTWARE 0 #define EXCP_INTR_TIMER 1 #define EXCP_INTR_HTIF 2 -#define SSTATUS_IE (1 << 0) -#define SSTATUS_PIE (1 << 3) -#define SSTATUS_PS (1 << 4) - -#define MSTATUS_MPRV (1 << 16) -#define MSTATUS_PRV_SHIFT 1 -#define MSTATUS_PRV1_SHIFT 4 -#define MSTATUS_PRV2_SHIFT 7 -#define MSTATUS_PRV_MASK (0x3 << MSTATUS_PRV_SHIFT) -#define MSTATUS_PRV_U 0 /* user */ -#define MSTATUS_PRV_S 1 /* supervisor */ -#define MSTATUS_PRV_H 2 /* hypervisor */ -#define MSTATUS_PRV_M 3 /* machine */ - -#define MSTATUS_VM_SHIFT 17 -#define MSTATUS_VM_MASK 0x1f -#define MSTATUS_VM_MBARE 0 -#define MSTATUS_VM_MBB 1 -#define MSTATUS_VM_MBBID 2 -#define MSTATUS_VM_SV32 8 -#define MSTATUS_VM_SV39 9 -#define MSTATUS_VM_SV48 10 +#define SSTATUS_UIE (1 << 0) +#define SSTATUS_SIE (1 << 1) +#define SSTATUS_UPIE (1 << 4) +#define SSTATUS_SPIE (1 << 5) +#define SSTATUS_SPIE_SHIFT 5 +#define SSTATUS_SPP (1 << 8) +#define SSTATUS_SPP_SHIFT 8 +#define SSTATUS_FS_MASK 0x3 +#define SSTATUS_FS_SHIFT 13 +#define SSTATUS_XS_MASK 0x3 +#define SSTATUS_XS_SHIFT 15 +#define SSTATUS_PUM (1 << 18) +#define SSTATUS32_SD (1 << 63) +#define SSTATUS64_SD (1 << 31) + +#define MSTATUS_UIE (1 << 0) +#define MSTATUS_SIE (1 << 1) +#define MSTATUS_HIE (1 << 2) +#define MSTATUS_MIE (1 << 3) +#define MSTATUS_UPIE (1 << 4) +#define MSTATUS_SPIE (1 << 5) +#define MSTATUS_SPIE_SHIFT 5 +#define MSTATUS_HPIE (1 << 6) +#define MSTATUS_MPIE (1 << 7) +#define MSTATUS_MPIE_SHIFT 7 +#define MSTATUS_SPP (1 << 8) +#define MSTATUS_SPP_SHIFT 8 +#define MSTATUS_HPP_MASK 0x3 +#define MSTATUS_HPP_SHIFT 9 +#define MSTATUS_MPP_MASK 0x3 +#define MSTATUS_MPP_SHIFT 11 +#define MSTATUS_FS_MASK 0x3 +#define MSTATUS_FS_SHIFT 13 +#define MSTATUS_XS_MASK 0x3 +#define MSTATUS_XS_SHIFT 15 +#define MSTATUS_MPRV (1 << 17) +#define MSTATUS_PUM (1 << 18) +#define MSTATUS_VM_MASK 0x1f +#define MSTATUS_VM_SHIFT 24 +#define MSTATUS_VM_MBARE 0 +#define MSTATUS_VM_MBB 1 +#define MSTATUS_VM_MBBID 2 +#define MSTATUS_VM_SV32 8 +#define MSTATUS_VM_SV39 9 +#define MSTATUS_VM_SV48 10 +#define MSTATUS_VM_SV57 11 +#define MSTATUS_VM_SV64 12 +#define MSTATUS32_SD (1 << 63) +#define MSTATUS64_SD (1 << 31) + +#define MSTATUS_PRV_U 0 /* user */ +#define MSTATUS_PRV_S 1 /* supervisor */ +#define MSTATUS_PRV_H 2 /* hypervisor */ +#define MSTATUS_PRV_M 3 /* machine */ +#define MIE_USIE (1 << 0) #define MIE_SSIE (1 << 1) #define MIE_HSIE (1 << 2) #define MIE_MSIE (1 << 3) +#define MIE_UTIE (1 << 4) #define MIE_STIE (1 << 5) #define MIE_HTIE (1 << 6) #define MIE_MTIE (1 << 7) +#define MIP_USIP (1 << 0) #define MIP_SSIP (1 << 1) #define MIP_HSIP (1 << 2) #define MIP_MSIP (1 << 3) +#define MIP_UTIP (1 << 4) #define MIP_STIP (1 << 5) #define MIP_HTIP (1 << 6) #define MIP_MTIP (1 << 7) -#define SR_IE (1 << 0) -#define SR_IE1 (1 << 3) -#define SR_IE2 (1 << 6) -#define SR_IE3 (1 << 9) - +#define SIE_USIE (1 << 0) #define SIE_SSIE (1 << 1) +#define SIE_UTIE (1 << 4) #define SIE_STIE (1 << 5) +#define MIP_SEIP (1 << 9) + /* Note: sip register has no SIP_STIP bit in Spike simulator */ #define SIP_SSIP (1 << 1) #define SIP_STIP (1 << 5) +#if 0 +/* lowRISC TODO */ #define NCSRS 4096 #define CSR_IPI 0x783 #define CSR_IO_IRQ 0x7c0 /* lowRISC only? */ +#endif + #define XLEN 8 #define INSN_SIZE 4 Modified: head/sys/riscv/include/vmparam.h ============================================================================== --- head/sys/riscv/include/vmparam.h Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/include/vmparam.h Tue Aug 2 14:50:14 2016 (r303660) @@ -196,7 +196,7 @@ #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) #define USRSTACK SHAREDPAGE -#define KERNENTRY (0x200) +#define KERNENTRY (0x80000000) /* * How many physical pages per kmem arena virtual page. Modified: head/sys/riscv/riscv/exception.S ============================================================================== --- head/sys/riscv/riscv/exception.S Tue Aug 2 14:14:36 2016 (r303659) +++ head/sys/riscv/riscv/exception.S Tue Aug 2 14:50:14 2016 (r303660) @@ -117,14 +117,15 @@ __FBSDID("$FreeBSD$"); ld t0, (TF_SSTATUS)(sp) .if \el == 0 /* Ensure user interrupts will be enabled on eret. */ - ori t0, t0, SSTATUS_PIE + li t1, SSTATUS_SPIE + or t0, t0, t1 .else /* * Disable interrupts for supervisor mode exceptions. * For user mode exceptions we have already done this * in do_ast. */ - li t1, ~SSTATUS_IE + li t1, ~SSTATUS_SIE and t0, t0, t1 .endif csrw sstatus, t0 @@ -182,7 +183,7 @@ __FBSDID("$FreeBSD$"); /* Disable interrupts */ csrr a4, sstatus 1: - csrci sstatus, SSTATUS_IE + csrci sstatus, (SSTATUS_SIE) ld a1, PC_CURTHREAD(gp) lw a2, TD_FLAGS(a1) @@ -192,7 +193,7 @@ __FBSDID("$FreeBSD$"); beqz a2, 2f /* Restore interrupts */ - andi a4, a4, SSTATUS_IE + andi a4, a4, (SSTATUS_SIE) csrs sstatus, a4 /* Handle the ast */ @@ -204,12 +205,24 @@ __FBSDID("$FreeBSD$"); 2: .endm +ENTRY(cpu_exception_handler) + csrrw sp, sscratch, sp + beqz sp, 1f + /* User mode detected */ + csrrw sp, sscratch, sp + j cpu_exception_handler_user +1: + /* Supervisor mode detected */ + csrrw sp, sscratch, sp + j cpu_exception_handler_supervisor +END(cpu_exception_handler) + ENTRY(cpu_exception_handler_supervisor) save_registers 1 mv a0, sp call _C_LABEL(do_trap_supervisor) load_registers 1 - eret + sret END(cpu_exception_handler_supervisor) ENTRY(cpu_exception_handler_user) @@ -220,7 +233,7 @@ ENTRY(cpu_exception_handler_user) do_ast load_registers 0 csrrw sp, sscratch, sp - eret + sret END(cpu_exception_handler_user) /* @@ -230,7 +243,7 @@ END(cpu_exception_handler_user) bad_trap: j bad_trap -user_trap: +machine_trap: /* Save state */ csrrw sp, mscratch, sp addi sp, sp, -64 @@ -242,91 +255,84 @@ user_trap: sd t5, (8 * 5)(sp) sd a0, (8 * 7)(sp) - la t2, _C_LABEL(cpu_exception_handler_user) - - csrr t0, mcause - bltz t0, machine_interrupt - j exit_mrts - -supervisor_trap: - /* Save state */ - csrrw sp, mscratch, sp - addi sp, sp, -64 - sd t0, (8 * 0)(sp) - sd t1, (8 * 1)(sp) - sd t2, (8 * 2)(sp) - sd t3, (8 * 3)(sp) - sd t4, (8 * 4)(sp) - sd t5, (8 * 5)(sp) - sd a0, (8 * 7)(sp) - - la t2, _C_LABEL(cpu_exception_handler_supervisor) - + csrr t3, mstatus /* Required for debug */ csrr t0, mcause bltz t0, machine_interrupt - li t1, EXCP_SMODE_ENV_CALL + li t1, EXCP_SUPERVISOR_ECALL beq t0, t1, supervisor_call - j exit_mrts +4: + /* NOT REACHED */ + j 4b machine_interrupt: /* Type of interrupt ? */ csrr t0, mcause andi t0, t0, EXCP_MASK - li t1, 0 - beq t1, t0, software_interrupt - li t1, 1 - beq t1, t0, timer_interrupt - li t1, 2 - beq t1, t0, htif_interrupt +#if 0 + /* lowRISC TODO */ li t1, 4 beq t1, t0, io_interrupt /* lowRISC only */ +#endif + li t1, 1 + beq t1, t0, supervisor_software_interrupt + li t1, 3 + beq t1, t0, machine_software_interrupt + li t1, 5 + beq t1, t0, supervisor_timer_interrupt + li t1, 7 + beq t1, t0, machine_timer_interrupt - /* not reached */ + /* NOT REACHED */ 1: j 1b +#if 0 + /* lowRISC TODO */ io_interrupt: /* Disable IO interrupts so we can go to supervisor mode */ csrwi CSR_IO_IRQ, 0 /* Handle the trap in supervisor mode */ j exit_mrts +#endif + +supervisor_software_interrupt: +1: + /* Nothing here as we are using mideleg feature */ + j 1b + +machine_software_interrupt: + /* Clear IPI */ + li t0, 0x40001000 + csrr t2, mhartid + li t3, 0x1000 + mul t2, t2, t3 + add t0, t0, t2 + li t2, 0 + sd t2, 0(t0) -software_interrupt: + /* Clear machine software pending bit */ li t0, MIP_MSIP csrc mip, t0 + + /* Post supervisor software interrupt */ li t0, MIP_SSIP csrs mip, t0 - /* If PRV1 is PRV_U (user) then serve the trap */ - csrr t0, mstatus - li t1, (MSTATUS_PRV_M << MSTATUS_PRV1_SHIFT) - and t0, t0, t1 - beqz t0, 1f - - /* - * If PRV1 is supervisor and interrupts were enabled, - * then serve the trap. - */ - csrr t0, mstatus - li t1, (SR_IE1 | (MSTATUS_PRV_M << MSTATUS_PRV1_SHIFT)) - and t0, t0, t1 - li t1, (SR_IE1 | (MSTATUS_PRV_S << MSTATUS_PRV1_SHIFT)) - beq t0, t1, 1f - j exit +supervisor_timer_interrupt: 1: - /* Handle the trap in supervisor mode */ - j exit_mrts + /* Nothing here as we are using mideleg feature */ + j 1b -timer_interrupt: +machine_timer_interrupt: /* Disable machine timer interrupts */ li t0, MIE_MTIE csrc mie, t0 - /* Clear machine pending */ + /* Clear machine timer interrupt pending */ li t0, MIP_MTIP csrc mip, t0 @@ -334,54 +340,32 @@ timer_interrupt: li t0, MIP_STIP csrs mip, t0 - /* If PRV1 is PRV_U (user) then serve the trap */ - csrr t0, mstatus - li t1, (MSTATUS_PRV_M << MSTATUS_PRV1_SHIFT) - and t0, t0, t1 - beqz t0, 1f - /* - * If PRV1 is supervisor and interrupts were enabled, - * then serve the trap. + * Check for HTIF interrupts. + * The only interrupt expected here is key press. */ - csrr t0, mstatus - li t1, (SR_IE1 | (MSTATUS_PRV_M << MSTATUS_PRV1_SHIFT)) - and t0, t0, t1 - li t1, (SR_IE1 | (MSTATUS_PRV_S << MSTATUS_PRV1_SHIFT)) - beq t0, t1, 1f - - j exit - -1: - /* Serve a trap in supervisor mode */ - j exit_mrts + la t0, htif_lock + li t2, 1 + amoswap.d t3, t2, 0(t0) + bnez t3, 5f /* Another operation in progress, give up */ -htif_interrupt: -1: - li t5, 0 - csrrw t5, mfromhost, t5 - beqz t5, 3f + /* We have lock */ + la t1, fromhost + ld t5, 0(t1) + beqz t5, 4f - /* Console PUT intr ? */ + /* Console GET intr ? */ mv t1, t5 - li t0, 0x101 + li t0, 0x100 srli t1, t1, 48 - bne t1, t0, 2f - /* Yes */ - la t0, console_intr - li t1, 1 - sd t1, 0(t0) - - /* Check if there is any other pending event */ + beq t1, t0, 2f +1: + /* There is no interrupts except keypress */ j 1b 2: /* Save entry */ la t0, htif_ring - csrr t1, mhartid - li t4, (HTIF_RING_SIZE + 16) - mulw t4, t4, t1 - add t0, t0, t4 li t4, (HTIF_RING_SIZE) add t0, t0, t4 /* t0 == htif_ring_cursor */ @@ -397,10 +381,18 @@ htif_interrupt: li t0, MIP_SSIP csrs mip, t0 - /* Check if there is any other pending event */ - j 1b - 3: + la t1, fromhost + li t5, 0 + sd t5, 0(t1) + +4: + /* Release lock */ + la t0, htif_lock + li t2, 0 + amoswap.d t3, t2, 0(t0) + +5: j exit supervisor_call: @@ -408,12 +400,14 @@ supervisor_call: addi t1, t1, 4 /* Next instruction in t1 */ li t4, ECALL_HTIF_CMD beq t5, t4, htif_cmd + li t4, ECALL_HTIF_CMD_REQ + beq t5, t4, htif_cmd_req + li t4, ECALL_HTIF_CMD_RESP + beq t5, t4, htif_cmd_resp li t4, ECALL_HTIF_GET_ENTRY beq t5, t4, htif_get_entry li t4, ECALL_MTIMECMP beq t5, t4, set_mtimecmp - li t4, ECALL_CLEAR_PENDING - beq t5, t4, clear_pending li t4, ECALL_MCPUID_GET beq t5, t4, mcpuid_get li t4, ECALL_MIMPID_GET @@ -422,24 +416,28 @@ supervisor_call: beq t5, t4, send_ipi li t4, ECALL_CLEAR_IPI beq t5, t4, clear_ipi - li t4, ECALL_HTIF_LOWPUTC - beq t5, t4, htif_lowputc li t4, ECALL_MIE_SET beq t5, t4, mie_set +#if 0 + /* lowRISC TODO */ li t4, ECALL_IO_IRQ_MASK beq t5, t4, io_irq_mask +#endif j exit_next_instr +#if 0 + /* lowRISC TODO */ io_irq_mask: csrw CSR_IO_IRQ, t6 j exit_next_instr +#endif mie_set: csrs mie, t6 j exit_next_instr mcpuid_get: - csrr t6, mcpuid + csrr t6, misa j exit_next_instr mimpid_get: @@ -447,10 +445,8 @@ mimpid_get: j exit_next_instr send_ipi: - /* CPU mmio base in t6 */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Aug 2 14:55:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55677BACFD7; Tue, 2 Aug 2016 14:55:04 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail.madpilot.net (grunt.madpilot.net [78.47.145.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 174971C12; Tue, 2 Aug 2016 14:55:03 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail (mail [192.168.254.3]) by mail.madpilot.net (Postfix) with ESMTP id 3s3fPd4wTzzZrR; Tue, 2 Aug 2016 16:55:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=madpilot.net; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:subject:subject:received:received; s=mail; t= 1470149699; x=1471964100; bh=+nGnlChNcxOaI64i9cfzNH55KSmQwILCQCG ORPIAy18=; b=hk8asQLCIBhFkN2qOmowd7aDcjpJOozJG9tTrmvINRDCXIxE4A1 Hn1pa88bJkQR65ubQo++Mnh2HsdNfeoMB6XTYpVm4L8LZf+erhR5OYXEB+CSHV4C IOsw/4QzC8A2Rk2ynt9wghpDmRa7QXPpGvftuoW3o3IxC7UCSQ/xL5yM= Received: from mail.madpilot.net ([192.168.254.3]) by mail (mail.madpilot.net [192.168.254.3]) (amavisd-new, port 10024) with ESMTP id 2w9Om8ovk565; Tue, 2 Aug 2016 16:54:59 +0200 (CEST) Received: from marvin.madpilot.net (micro.madpilot.net [88.149.173.206]) by mail.madpilot.net (Postfix) with ESMTPSA; Tue, 2 Aug 2016 16:54:59 +0200 (CEST) Subject: Re: svn commit: r303047 - head/usr.bin/sed To: Alexey Dokuchaev , "Pedro F. Giffuni" References: <201607192256.u6JMuewv007503@repo.freebsd.org> <20160802141738.GA84154@FreeBSD.org> Cc: svn-src-head@freebsd.org, Mikhail Teterin , svn-src-all@freebsd.org, src-committers@freebsd.org From: Guido Falsi Message-ID: <51d8013e-bc4b-a511-306d-0e362a8c3e86@madpilot.net> Date: Tue, 2 Aug 2016 16:54:59 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160802141738.GA84154@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 14:55:04 -0000 On 08/02/16 16:17, Alexey Dokuchaev wrote: > On Tue, Jul 19, 2016 at 10:56:40PM +0000, Pedro F. Giffuni wrote: >> New Revision: 303047 >> URL: https://svnweb.freebsd.org/changeset/base/303047 >> >> Log: >> sed(1): Assorted cleanups and simplifications. >> >> Const-ify several variables, make it build cleanly with WARNS level 5. >> >> Submitted by: mi >> PR: 195929 >> MFC after: 1 month > > Hi Pedro, > > This change causes `games/openttd' to fail now, because the generated > `$wrkdir/openttd-1.6.1/objs/release/Makefile' file is broken (SRCS var > is set to bogus value, search for ^SRCS). Reverting usr.bin/sed back > to r303046 fixes it. > > The latest revision (with ngie@'s fix) exhibits the same problem. > > Now the port uses somewhat obscure build system, but the sed(1) magic > happens inside generate_foo() functions using SRC_REPLACE variable set > in make_sed() inside `config.lib' file; these functions are called by > the configure script. > > Would you or Mikhail mind taking a look? Thanks, By chance I had a look at this, thinking it was a local problem on my machine, and noticed that the substitutions get truncated at exactly 5120 characters. Looks like some hardcoded 5KiB buffer. -- Guido Falsi From owner-svn-src-head@freebsd.org Tue Aug 2 15:05:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84EFCBAC268 for ; Tue, 2 Aug 2016 15:05:45 +0000 (UTC) (envelope-from saybette@host.joeincorporated.com) Received: from host.joeincorporated.com (host.joeincorporated.com [69.167.170.198]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BAB612D5 for ; Tue, 2 Aug 2016 15:05:45 +0000 (UTC) (envelope-from saybette@host.joeincorporated.com) Received: from saybette by host.joeincorporated.com with local (Exim 4.87) (envelope-from ) id 1bUbGD-0001je-Nc for svn-src-head@freebsd.org; Tue, 02 Aug 2016 11:05:37 -0400 To: svn-src-head@freebsd.org Subject: Unable to deliver your item, #0000844116 Date: Tue, 2 Aug 2016 11:05:37 -0400 From: "FedEx 2Day A.M." Reply-To: "FedEx 2Day A.M." Message-ID: X-Priority: 3 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.joeincorporated.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [545 545] / [47 12] X-AntiAbuse: Sender Address Domain - host.joeincorporated.com X-Get-Message-Sender-Via: host.joeincorporated.com: authenticated_id: saybette/from_h X-Authenticated-Sender: host.joeincorporated.com: kevin.perez@saybetter.com Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 15:05:45 -0000 Dear Customer, We could not deliver your parcel. Please, open email attachment to print shipment label. Yours sincerely, Kevin Perez, Sr. Operation Manager. From owner-svn-src-head@freebsd.org Tue Aug 2 15:17:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18678BAC579 for ; Tue, 2 Aug 2016 15:17:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm41-vm9.bullet.mail.bf1.yahoo.com (nm41-vm9.bullet.mail.bf1.yahoo.com [216.109.114.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4909180F for ; Tue, 2 Aug 2016 15:17:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1470150187; bh=C9OeyIU5TU5mqMBtnsNx+PuMRyYmT1UEnnegUvm6OhM=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=Ba/f2phAWoz4VbNtcASuegVSYsVQoUCJPx/yFXo998PTV/XTwOoX556d3/cwc3kTUb2c41kKiihzSG+a4/Rs6g0PLbakyi28m1bzBa3642VV1ZWrX9WG3dy+UTGQjVQRe6nIy5PQBidfGzS/xab0J27g1yt5U4eIA0C9JKv09riinUEUvTarE8RrX7BgV8HLwYv7pdjtM01OhJVkROlMHym3Y6bUY+y8+iR0WXAwLpvi+fa0q/oc5BWHLiHCMa4BRZdw7HUTNRd6Pj2Wie+I+mYfx30ye+xstiWYeNp9bLQx+a7z8B5IWhv1ykk8RN6Y3o4QYOZOc4p6wnkq6k/Vcw== Received: from [66.196.81.172] by nm41.bullet.mail.bf1.yahoo.com with NNFMP; 02 Aug 2016 15:03:07 -0000 Received: from [98.139.211.160] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 02 Aug 2016 15:03:07 -0000 Received: from [127.0.0.1] by smtp217.mail.bf1.yahoo.com with NNFMP; 02 Aug 2016 15:03:07 -0000 X-Yahoo-Newman-Id: 387660.93581.bm@smtp217.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: oX9878UVM1kz9E0Hw2Af42s1ZJEEcVF.uBpYkAzJQLmD26b 0eN2.6pu_OMYDGnWMykqQYfqEkH1C38ZqGccgfFv4JD.Dox_FM0DXmmatV1o cejNszVmY7PjoD7c4k0kOgw3K9bouYGZ21eDFHBqr8OrRYseHsWzvyPJC8hV Za4g0ejaOP8DQgxNP1Gb9lkrlnwXQQVMjRTjXQeLp7WCJWTgdz3_ZYzO8XcC QTvlvwSNInHHnkBC7alka4Dp.kRcE1TttZRaFGVgqhoKWDttGAGWbUtfY3Kv t9UZlO57Ihqxwm3903gY5HAl_bP0endqBspgTRQNd7iadlg6RhkC0GpnCqhC KY59ulUbGmX52gkNrmQf4NwfZFmv_C.q0_4yTljbf0RkRInT9pbjw8hE4wNP ..240AEVuYeMdPOWUrhlQS6gCw80Q0l6F4vnCuYiFFtTWKfZyaQSBdcvdMvH O4MbjMGU7ka5X3NG.lQWNMOGxfQB._jGsvTbR5AXsckAfPoDxco_u5hhmkiL YVS._XuFhR6Rarz6x3_SAxYjrmdlO9IGPO16DuDG_NkEbOA-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303047 - head/usr.bin/sed To: Guido Falsi , Alexey Dokuchaev References: <201607192256.u6JMuewv007503@repo.freebsd.org> <20160802141738.GA84154@FreeBSD.org> <51d8013e-bc4b-a511-306d-0e362a8c3e86@madpilot.net> Cc: svn-src-head@freebsd.org, Mikhail Teterin , svn-src-all@freebsd.org, src-committers@freebsd.org From: Pedro Giffuni Message-ID: <7f8c5c42-7d2f-ffcf-70dd-dbc9d3202ee7@FreeBSD.org> Date: Tue, 2 Aug 2016 10:03:20 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <51d8013e-bc4b-a511-306d-0e362a8c3e86@madpilot.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 15:17:18 -0000 Hello; On 08/02/16 09:54, Guido Falsi wrote: > On 08/02/16 16:17, Alexey Dokuchaev wrote: >> On Tue, Jul 19, 2016 at 10:56:40PM +0000, Pedro F. Giffuni wrote: >>> New Revision: 303047 >>> URL: https://svnweb.freebsd.org/changeset/base/303047 >>> >>> Log: >>> sed(1): Assorted cleanups and simplifications. >>> >>> Const-ify several variables, make it build cleanly with WARNS level 5. >>> >>> Submitted by: mi >>> PR: 195929 >>> MFC after: 1 month >> >> Hi Pedro, >> >> This change causes `games/openttd' to fail now, because the generated >> `$wrkdir/openttd-1.6.1/objs/release/Makefile' file is broken (SRCS var >> is set to bogus value, search for ^SRCS). Reverting usr.bin/sed back >> to r303046 fixes it. >> >> The latest revision (with ngie@'s fix) exhibits the same problem. >> >> Now the port uses somewhat obscure build system, but the sed(1) magic >> happens inside generate_foo() functions using SRC_REPLACE variable set >> in make_sed() inside `config.lib' file; these functions are called by >> the configure script. >> >> Would you or Mikhail mind taking a look? Thanks, > > By chance I had a look at this, thinking it was a local problem on my > machine, and noticed that the substitutions get truncated at exactly > 5120 characters. Looks like some hardcoded 5KiB buffer. > Thank you for the reports, this type of things make nice cases for the test suite. There were good reasons this patch was not meant for 11.0-RELEASE. Given it's the second regression and I am not satisfied with the patch for the first one, I will be reverting the change so we can look at the problems integrally. Pedro. From owner-svn-src-head@freebsd.org Tue Aug 2 15:26:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53A35BAC9C9; Tue, 2 Aug 2016 15:26:47 +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 315B2123E; Tue, 2 Aug 2016 15:26:47 +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 u72FQkkw095284; Tue, 2 Aug 2016 15:26:46 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72FQkvQ095283; Tue, 2 Aug 2016 15:26:46 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201608021526.u72FQkvQ095283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 2 Aug 2016 15:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303661 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 15:26:47 -0000 Author: andrew Date: Tue Aug 2 15:26:46 2016 New Revision: 303661 URL: https://svnweb.freebsd.org/changeset/base/303661 Log: Remove trailing whitespace from the arm64 pmap Obtained from: ABT Systems Ltd MFC after: 3 weeks 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 Tue Aug 2 14:50:14 2016 (r303660) +++ head/sys/arm64/arm64/pmap.c Tue Aug 2 15:26:46 2016 (r303661) @@ -782,7 +782,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offs virtual_avail = roundup2(freemempos, L1_SIZE); virtual_end = VM_MAX_KERNEL_ADDRESS - L2_SIZE; kernel_vm_end = virtual_avail; - + pa = pmap_early_vtophys(l1pt, freemempos); /* Finish initialising physmap */ @@ -908,7 +908,7 @@ pmap_invalidate_all(pmap_t pmap) * Extract the physical page address associated * with the given map/virtual_address pair. */ -vm_paddr_t +vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va) { pt_entry_t *pte, tpte; @@ -1243,7 +1243,7 @@ pmap_add_delayed_free_list(vm_page_t m, m->flags &= ~PG_ZERO; SLIST_INSERT_HEAD(free, m, plinks.s.ss); } - + /* * Decrements a page table page's wire count, which is used to record the * number of valid page table entries within the page. If the wire count @@ -1321,7 +1321,7 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t */ atomic_subtract_rel_int(&vm_cnt.v_wire_count, 1); - /* + /* * Put page on a list so that it is released after * *ALL* TLB shootdown is done */ @@ -1591,7 +1591,7 @@ kvm_size(SYSCTL_HANDLER_ARGS) return sysctl_handle_long(oidp, &ksize, 0, req); } -SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD, +SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD, 0, 0, kvm_size, "LU", "Size of KVM"); static int @@ -1601,7 +1601,7 @@ kvm_free(SYSCTL_HANDLER_ARGS) return sysctl_handle_long(oidp, &kfree, 0, req); } -SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, +SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, 0, 0, kvm_free, "LU", "Amount of KVM free"); #endif /* 0 */ @@ -1645,7 +1645,7 @@ pmap_growkernel(vm_offset_t addr) kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; - break; + break; } continue; } @@ -1665,7 +1665,7 @@ pmap_growkernel(vm_offset_t addr) kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; - break; + break; } } } @@ -1926,7 +1926,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm * pmap_remove_l3: do the things to unmap a page in a process */ static int -pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, +pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) { pt_entry_t old_l3; @@ -2057,7 +2057,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva rw_wunlock(lock); if (anyvalid) pmap_invalidate_all(pmap); - rw_runlock(&pvh_global_lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(&free); } @@ -2724,7 +2724,7 @@ pmap_zero_page(vm_page_t m) } /* - * pmap_zero_page_area zeros the specified hardware page by mapping + * pmap_zero_page_area zeros the specified hardware page by mapping * the page into KVM and using bzero to clear its contents. * * off and size may not cover an area beyond a single hardware page. @@ -2741,7 +2741,7 @@ pmap_zero_page_area(vm_page_t m, int off } /* - * pmap_zero_page_idle zeros the specified hardware page by mapping + * pmap_zero_page_idle zeros the specified hardware page by mapping * the page into KVM and using bzero to clear its contents. This * is intended to be called from the vm_pagezero process only and * outside of Giant. @@ -2902,7 +2902,7 @@ restart: * Destroy all managed, non-wired mappings in the given user-space * pmap. This pmap cannot be active on any processor besides the * caller. - * + * * This function cannot be applied to the kernel pmap. Moreover, it * is not intended for general use. It is only to be used during * process termination. Consequently, it can be implemented in ways From owner-svn-src-head@freebsd.org Tue Aug 2 15:35:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B1EEBACC60; Tue, 2 Aug 2016 15:35:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28CAB1897; Tue, 2 Aug 2016 15:35:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72FZsuK099183; Tue, 2 Aug 2016 15:35:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72FZrJm099176; Tue, 2 Aug 2016 15:35:53 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608021535.u72FZrJm099176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 2 Aug 2016 15:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303662 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 15:35:55 -0000 Author: pfg Date: Tue Aug 2 15:35:53 2016 New Revision: 303662 URL: https://svnweb.freebsd.org/changeset/base/303662 Log: sed(1): Revert r303047 "cleanup" and therefore r303572. While big, the change was meant to have no effect on behavior and instead so far we have found two regressions: one in the etcupdate tests and another one in the games/openttd port[1]. Revert to a known working state. We will likely have to split the patch in functional parts before bringing back the changes. PR: 195929 Reported by: danfe, madpilot [1] Modified: head/usr.bin/sed/Makefile head/usr.bin/sed/compile.c head/usr.bin/sed/defs.h head/usr.bin/sed/extern.h head/usr.bin/sed/main.c head/usr.bin/sed/misc.c head/usr.bin/sed/process.c Modified: head/usr.bin/sed/Makefile ============================================================================== --- head/usr.bin/sed/Makefile Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/Makefile Tue Aug 2 15:35:53 2016 (r303662) @@ -6,7 +6,7 @@ PROG= sed SRCS= compile.c main.c misc.c process.c -WARNS?= 5 +WARNS?= 2 .if ${MK_TESTS} != "no" SUBDIR+= tests Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/compile.c Tue Aug 2 15:35:53 2016 (r303662) @@ -64,21 +64,21 @@ static struct labhash { int lh_ref; } *labels[LHSZ]; -static const char *compile_addr(const char *, struct s_addr *); -static char *compile_ccl(const char **, char *); -static const char *compile_delimited(const char *, char *, int); -static const char *compile_flags(const char *, struct s_subst *); -static const regex_t *compile_re(const char *, int); -static const char *compile_subst(const char *, struct s_subst *); -static char *compile_text(size_t *); -static const char *compile_tr(const char *, struct s_tr **); +static char *compile_addr(char *, struct s_addr *); +static char *compile_ccl(char **, char *); +static char *compile_delimited(char *, char *, int); +static char *compile_flags(char *, struct s_subst *); +static regex_t *compile_re(char *, int); +static char *compile_subst(char *, struct s_subst *); +static char *compile_text(void); +static char *compile_tr(char *, struct s_tr **); static struct s_command **compile_stream(struct s_command **); -static char *duptoeol(const char *, const char *, size_t *); +static char *duptoeol(char *, const char *); static void enterlabel(struct s_command *); static struct s_command - *findlabel(const char *); -static void fixuplabel(struct s_command *, const struct s_command *); + *findlabel(char *); +static void fixuplabel(struct s_command *, struct s_command *); static void uselabel(void); /* @@ -144,20 +144,17 @@ compile(void) err(1, "malloc"); } -#define EATSPACE() do { \ - while (*p && isspace((unsigned char)*p)) \ - p++; \ - } while (0) - -#define EATSPACEN() do { \ - while (*p && *p != '\n' && isspace((unsigned char)*p)) \ - p++; \ +#define EATSPACE() do { \ + if (p) \ + while (*p && isspace((unsigned char)*p)) \ + p++; \ } while (0) static struct s_command ** compile_stream(struct s_command **link) { - const char *p; + char *p; + static char lbuf[_POSIX2_LINE_MAX + 1]; /* To save stack */ struct s_command *cmd, *cmd2, *stack; struct s_format *fp; char re[_POSIX2_LINE_MAX + 1]; @@ -165,22 +162,22 @@ compile_stream(struct s_command **link) stack = NULL; for (;;) { - if ((p = cu_fgets(NULL)) == NULL) { + if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) { if (stack != NULL) errx(1, "%lu: %s: unexpected EOF (pending }'s)", linenum, fname); return (link); } -semicolon: EATSPACEN(); - switch (*p) { - case '#': case '\0': case '\n': - continue; /* to next command-unit */ - case ';': - p++; - goto semicolon; +semicolon: EATSPACE(); + if (p) { + if (*p == '#' || *p == '\0') + continue; + else if (*p == ';') { + p++; + goto semicolon; + } } - if ((*link = cmd = malloc(sizeof(struct s_command))) == NULL) err(1, "malloc"); link = &cmd->next; @@ -211,14 +208,14 @@ semicolon: EATSPACEN(); cmd->a1 = cmd->a2 = NULL; nonsel: /* Now parse the command */ - if (*p == '\0' || *p == '\n') + if (!*p) errx(1, "%lu: %s: command expected", linenum, fname); cmd->code = *p; for (fp = cmd_fmts; fp->code; fp++) if (fp->code == *p) break; if (!fp->code) - errx(1, "%lu: %s: invalid command code %c (%s)", linenum, fname, *p, p); + errx(1, "%lu: %s: invalid command code %c", linenum, fname, *p); if (naddr > fp->naddr) errx(1, "%lu: %s: command %c expects up to %d address(es), found %d", @@ -231,11 +228,11 @@ nonsel: /* Now parse the command */ goto nonsel; case GROUP: /* { */ p++; - EATSPACEN(); + EATSPACE(); cmd->next = stack; stack = cmd; link = &cmd->u.c; - if (*p != '\0' && *p != '\n') + if (*p) goto semicolon; break; case ENDGROUP: @@ -252,13 +249,13 @@ nonsel: /* Now parse the command */ /*FALLTHROUGH*/ case EMPTY: /* d D g G h H l n N p P q x = \0 */ p++; - EATSPACEN(); + EATSPACE(); if (*p == ';') { p++; link = &cmd->next; goto semicolon; } - if (*p != '\0' && *p != '\n') + if (*p) errx(1, "%lu: %s: extra characters at the end of %c command", linenum, fname, cmd->code); break; @@ -269,12 +266,12 @@ nonsel: /* Now parse the command */ errx(1, "%lu: %s: command %c expects \\ followed by text", linenum, fname, cmd->code); p++; - EATSPACEN(); - if (*p != '\n') + EATSPACE(); + if (*p) errx(1, - "%lu: %s: extra characters (%c) after \\ at the end of %c command", - linenum, fname, *p, cmd->code); - cmd->t = compile_text(&cmd->tlen); + "%lu: %s: extra characters after \\ at the end of %c command", + linenum, fname, cmd->code); + cmd->t = compile_text(); break; case COMMENT: /* \0 # */ break; @@ -283,10 +280,10 @@ nonsel: /* Now parse the command */ EATSPACE(); if (*p == '\0') errx(1, "%lu: %s: filename expected", linenum, fname); - cmd->t = duptoeol(p, "w command", &cmd->tlen); + cmd->t = duptoeol(p, "w command"); if (aflag) cmd->u.fd = -1; - else if ((cmd->u.fd = open(cmd->t, + else if ((cmd->u.fd = open(p, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) err(1, "%s", p); @@ -297,27 +294,27 @@ nonsel: /* Now parse the command */ if (*p == '\0') errx(1, "%lu: %s: filename expected", linenum, fname); else - cmd->t = duptoeol(p, "read command", &cmd->tlen); + cmd->t = duptoeol(p, "read command"); break; case BRANCH: /* b t */ p++; - EATSPACEN(); - if (*p == '\0' || *p == '\n') + EATSPACE(); + if (*p == '\0') cmd->t = NULL; else - cmd->t = duptoeol(p, "branch", &cmd->tlen); + cmd->t = duptoeol(p, "branch"); break; case LABEL: /* : */ p++; EATSPACE(); - cmd->t = duptoeol(p, "label", &cmd->tlen); - if (cmd->t[0] == '\0') + cmd->t = duptoeol(p, "label"); + if (strlen(p) == 0) errx(1, "%lu: %s: empty label", linenum, fname); enterlabel(cmd); break; case SUBST: /* s */ p++; - if (*p == '\0' || *p == '\\' || *p == '\n') + if (*p == '\0' || *p == '\\') errx(1, "%lu: %s: substitute pattern can not be delimited by newline or backslash", linenum, fname); @@ -328,15 +325,21 @@ nonsel: /* Now parse the command */ errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); + /* Compile RE with no case sensitivity temporarily */ + if (*re == '\0') + cmd->u.s->re = NULL; + else + cmd->u.s->re = compile_re(re, 0); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); - if (*re != '\0') + /* Recompile RE with case sensitivity from "I" flag if any */ + if (*re == '\0') + cmd->u.s->re = NULL; + else cmd->u.s->re = compile_re(re, cmd->u.s->icase); - EATSPACE(); - if (*p == ';') { p++; link = &cmd->next; @@ -369,8 +372,8 @@ nonsel: /* Now parse the command */ * in the case of a non-terminated string. The character array d is filled * with the processed string. */ -static const char * -compile_delimited(const char *p, char *d, int is_tr) +static char * +compile_delimited(char *p, char *d, int is_tr) { char c; @@ -413,10 +416,10 @@ compile_delimited(const char *p, char *d /* compile_ccl: expand a POSIX character class */ static char * -compile_ccl(const char **sp, char *t) +compile_ccl(char **sp, char *t) { int c, d; - const char *s = *sp; + char *s = *sp; *t++ = *s++; if (*s == '^') @@ -438,8 +441,8 @@ compile_ccl(const char **sp, char *t) * regular expression. * Cflags are passed to regcomp. */ -static const regex_t * -compile_re(const char *re, int case_insensitive) +static regex_t * +compile_re(char *re, int case_insensitive) { regex_t *rep; int eval, flags; @@ -463,13 +466,14 @@ compile_re(const char *re, int case_inse * point to a saved copy of it. Nsub is the number of parenthesized regular * expressions. */ -static const char * -compile_subst(const char *p, struct s_subst *s) +static char * +compile_subst(char *p, struct s_subst *s) { + static char lbuf[_POSIX2_LINE_MAX + 1]; int asize, size; u_char ref; char c, *text, *op, *sp; - int more = 0, sawesc = 0; + int more = 1, sawesc = 0; c = *p++; /* Terminator character */ if (c == '\0') @@ -483,7 +487,7 @@ compile_subst(const char *p, struct s_su size = 0; do { op = sp = text + size; - for (; *p != '\0' && *p != '\n'; p++) { + for (; *p; p++) { if (*p == '\\' || sawesc) { /* * If this is a continuation from the last @@ -505,10 +509,7 @@ compile_subst(const char *p, struct s_su */ sawesc = 1; p--; - break; - } else if (*p == '\n') { - *sp++ = '\n'; - break; + continue; } else if (strchr("123456789", *p) != NULL) { *sp++ = '\\'; ref = *p - '0'; @@ -522,11 +523,8 @@ compile_subst(const char *p, struct s_su *sp++ = '\\'; } else if (*p == c) { if (*++p == '\0' && more) { - const char *nextp; - - nextp = cu_fgets(&more); - if (nextp != NULL) - p = nextp; + if (cu_fgets(lbuf, sizeof(lbuf), &more)) + p = lbuf; } *sp++ = '\0'; size += sp - op; @@ -546,7 +544,7 @@ compile_subst(const char *p, struct s_su if ((text = realloc(text, asize)) == NULL) err(1, "realloc"); } - } while ((p = cu_fgets(&more)) != NULL); + } while (cu_fgets(p = lbuf, sizeof(lbuf), &more) != NULL); errx(1, "%lu: %s: unterminated substitute in regular expression", linenum, fname); /* NOTREACHED */ @@ -555,12 +553,12 @@ compile_subst(const char *p, struct s_su /* * Compile the flags of the s command */ -static const char * -compile_flags(const char *p, struct s_subst *s) +static char * +compile_flags(char *p, struct s_subst *s) { int gn; /* True if we have seen g or n */ unsigned long nval; - char *q; + char wfile[_POSIX2_LINE_MAX + 1], *q, *eq; s->n = 1; /* Default */ s->p = 0; @@ -568,7 +566,7 @@ compile_flags(const char *p, struct s_su s->wfd = -1; s->icase = 0; for (gn = 0;;) { - EATSPACEN(); /* EXTENSION */ + EATSPACE(); /* EXTENSION */ switch (*p) { case 'g': if (gn) @@ -596,13 +594,13 @@ compile_flags(const char *p, struct s_su "%lu: %s: more than one number or 'g' in substitute flags", linenum, fname); gn = 1; errno = 0; - nval = strtol(p, &q, 10); + nval = strtol(p, &p, 10); if (errno == ERANGE || nval > INT_MAX) errx(1, "%lu: %s: overflow in the 'N' substitute flag", linenum, fname); s->n = nval; - p = q; - continue; + p--; + break; case 'w': p++; #ifdef HISTORIC_PRACTICE @@ -612,15 +610,27 @@ compile_flags(const char *p, struct s_su } #endif EATSPACE(); - s->wfile = duptoeol(p, "w flag", NULL); - if (!aflag && (s->wfd = open(s->wfile, + q = wfile; + eq = wfile + sizeof(wfile) - 1; + while (*p) { + if (*p == '\n') + break; + if (q >= eq) + err(1, "wfile too long"); + *q++ = *p++; + } + *q = '\0'; + if (q == wfile) + errx(1, "%lu: %s: no wfile specified", linenum, fname); + s->wfile = strdup(wfile); + if (!aflag && (s->wfd = open(wfile, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) - err(1, "%s", s->wfile); + err(1, "%s", wfile); return (p); default: - errx(1, "%lu: %s: bad flag in substitute command: '%c' (%.10s)", - linenum, fname, *p, p); + errx(1, "%lu: %s: bad flag in substitute command: '%c'", + linenum, fname, *p); break; } p++; @@ -630,8 +640,8 @@ compile_flags(const char *p, struct s_su /* * Compile a translation set of strings into a lookup table. */ -static const char * -compile_tr(const char *p, struct s_tr **py) +static char * +compile_tr(char *p, struct s_tr **py) { struct s_tr *y; int i; @@ -642,7 +652,7 @@ compile_tr(const char *p, struct s_tr ** mbstate_t mbs1, mbs2; if ((*py = y = malloc(sizeof(*y))) == NULL) - err(1, "malloc"); + err(1, NULL); y->multis = NULL; y->nmultis = 0; @@ -662,11 +672,11 @@ compile_tr(const char *p, struct s_tr ** op = old; oldlen = mbsrtowcs(NULL, &op, 0, NULL); if (oldlen == (size_t)-1) - err(1, "mbsrtowcs"); + err(1, NULL); np = new; newlen = mbsrtowcs(NULL, &np, 0, NULL); if (newlen == (size_t)-1) - err(1, "mbsrtowcs"); + err(1, NULL); if (newlen != oldlen) errx(1, "%lu: %s: transform strings are not the same length", linenum, fname); @@ -705,7 +715,7 @@ compile_tr(const char *p, struct s_tr ** y->multis = realloc(y->multis, (y->nmultis + 1) * sizeof(*y->multis)); if (y->multis == NULL) - err(1, "realloc"); + err(1, NULL); i = y->nmultis++; y->multis[i].fromlen = oclen; memcpy(y->multis[i].from, op, oclen); @@ -723,24 +733,23 @@ compile_tr(const char *p, struct s_tr ** * Compile the text following an a, c, or i command. */ static char * -compile_text(size_t *ptlen) +compile_text(void) { int asize, esc_nl, size; - char *text, *s; - const char *p, *op; + char *text, *p, *op, *s; + char lbuf[_POSIX2_LINE_MAX + 1]; asize = 2 * _POSIX2_LINE_MAX + 1; if ((text = malloc(asize)) == NULL) err(1, "malloc"); size = 0; - while ((p = cu_fgets(NULL)) != NULL) { + while (cu_fgets(lbuf, sizeof(lbuf), NULL) != NULL) { op = s = text + size; + p = lbuf; for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n') esc_nl = 1; *s++ = *p; - if (*p == '\n') - break; } size += s - op; if (!esc_nl) { @@ -754,18 +763,17 @@ compile_text(size_t *ptlen) } } text[size] = '\0'; - if ((text = realloc(text, size + 1)) == NULL) + if ((p = realloc(text, size + 1)) == NULL) err(1, "realloc"); - *ptlen = size; - return (text); + return (p); } /* * Get an address and return a pointer to the first character after * it. Fill the structure pointed to according to the address. */ -static const char * -compile_addr(const char *p, struct s_addr *a) +static char * +compile_addr(char *p, struct s_addr *a) { char *end, re[_POSIX2_LINE_MAX + 1]; int icase; @@ -819,26 +827,22 @@ compile_addr(const char *p, struct s_add * Return a copy of all the characters up to \n or \0. */ static char * -duptoeol(const char *s, const char *ctype, size_t *ptlen) +duptoeol(char *s, const char *ctype) { size_t len; int ws; - char *p; - const char *start; + char *p, *start; ws = 0; for (start = s; *s != '\0' && *s != '\n'; ++s) ws = isspace((unsigned char)*s); + *s = '\0'; if (ws) warnx("%lu: %s: whitespace after %s", linenum, fname, ctype); - len = s - start; - if ((p = malloc(len + 1)) == NULL) + len = s - start + 1; + if ((p = malloc(len)) == NULL) err(1, "malloc"); - memmove(p, start, len); - p[len] = '\0'; - if (ptlen != NULL) - *ptlen = len; - return p; + return (memmove(p, start, len)); } /* @@ -849,7 +853,7 @@ duptoeol(const char *s, const char *ctyp * TODO: Remove } nodes */ static void -fixuplabel(struct s_command *cp, const struct s_command *end) +fixuplabel(struct s_command *cp, struct s_command *end) { for (; cp != end; cp = cp->next) @@ -866,7 +870,7 @@ fixuplabel(struct s_command *cp, const s break; } if ((cp->u.c = findlabel(cp->t)) == NULL) - errx(1, "%lu: %s: %c: undefined label '%s'", linenum, fname, cp->code, cp->t); + errx(1, "%lu: %s: undefined label '%s'", linenum, fname, cp->t); free(cp->t); break; case '{': @@ -906,13 +910,13 @@ enterlabel(struct s_command *cp) * list cp. L is excluded from the search. Return NULL if not found. */ static struct s_command * -findlabel(const char *name) +findlabel(char *name) { struct labhash *lh; - const u_char *p; + u_char *p; u_int h, c; - for (h = 0, p = (const u_char *)name; (c = *p) != 0; p++) + for (h = 0, p = (u_char *)name; (c = *p) != 0; p++) h = (h << 5) + h + c; for (lh = labels[h & LHMASK]; lh != NULL; lh = lh->lh_next) { if (lh->lh_hash == h && strcmp(name, lh->lh_cmd->t) == 0) { Modified: head/usr.bin/sed/defs.h ============================================================================== --- head/usr.bin/sed/defs.h Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/defs.h Tue Aug 2 15:35:53 2016 (r303662) @@ -51,7 +51,7 @@ struct s_addr { enum e_atype type; /* Address type */ union { u_long l; /* Line number */ - const regex_t *r; /* Regular expression */ + regex_t *r; /* Regular expression */ } u; }; @@ -64,7 +64,7 @@ struct s_subst { int icase; /* True if I flag */ char *wfile; /* NULL if no wfile */ int wfd; /* Cached file descriptor */ - const regex_t *re; /* Regular expression */ + regex_t *re; /* Regular expression */ unsigned int maxbref; /* Largest backreference. */ u_long linenum; /* Line number. */ char *new; /* Replacement text */ @@ -94,7 +94,6 @@ struct s_command { struct s_addr *a1, *a2; /* Start and end address */ u_long startline; /* Start line number or zero */ char *t; /* Text for : a c i r w */ - size_t tlen; union { struct s_command *c; /* Command(s) for b t { */ struct s_subst *s; /* Substitute command */ Modified: head/usr.bin/sed/extern.h ============================================================================== --- head/usr.bin/sed/extern.h Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/extern.h Tue Aug 2 15:35:53 2016 (r303662) @@ -45,12 +45,12 @@ extern const char *fname, *outfname; extern FILE *infile, *outfile; extern int rflags; /* regex flags to use */ -void cfclose(struct s_command *, const struct s_command *); +void cfclose(struct s_command *, struct s_command *); void compile(void); void cspace(SPACE *, const char *, size_t, enum e_spflag); -const char *cu_fgets(int *); +char *cu_fgets(char *, int, int *); int mf_fgets(SPACE *, enum e_spflag); int lastline(void); void process(void); void resetstate(void); -char *strregerror(int, const regex_t *); +char *strregerror(int, regex_t *); Modified: head/usr.bin/sed/main.c ============================================================================== --- head/usr.bin/sed/main.c Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/main.c Tue Aug 2 15:35:53 2016 (r303662) @@ -72,7 +72,7 @@ static const char sccsid[] = "@(#)main.c struct s_compunit { struct s_compunit *next; enum e_cut {CU_FILE, CU_STRING} type; - const char *s; /* Pointer to string or fname */ + char *s; /* Pointer to string or fname */ }; /* @@ -85,7 +85,7 @@ static struct s_compunit *script, **cu_n * Linked list of files to be processed */ struct s_flist { - const char *fname; + char *fname; struct s_flist *next; }; @@ -116,15 +116,15 @@ static char tmpfname[PATH_MAX]; /* Tempo static const char *inplace; /* Inplace edit file extension. */ u_long linenum; -static void add_compunit(enum e_cut, const char *); -static void add_file(const char *); +static void add_compunit(enum e_cut, char *); +static void add_file(char *); static void usage(void); int main(int argc, char *argv[]) { - char *temp_arg; int c, fflag; + char *temp_arg; (void) setlocale(LC_ALL, ""); @@ -146,9 +146,10 @@ main(int argc, char *argv[]) break; case 'e': eflag = 1; - asprintf(&temp_arg, "%s\n", optarg); - if (temp_arg == NULL) - errx(1, "Couldn't allocate temporary buffer"); + if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL) + err(1, "malloc"); + strcpy(temp_arg, optarg); + strcat(temp_arg, "\n"); add_compunit(CU_STRING, temp_arg); break; case 'f': @@ -212,16 +213,14 @@ usage(void) * Like fgets, but go through the chain of compilation units chaining them * together. Empty strings and files are ignored. */ -const char * -cu_fgets(int *more) +char * +cu_fgets(char *buf, int n, int *more) { static enum {ST_EOF, ST_FILE, ST_STRING} state = ST_EOF; static FILE *f; /* Current open file */ - static const char *s; /* Current pointer inside string */ - static char string_ident[30], *lastresult; - static size_t lastsize; + static char *s; /* Current pointer inside string */ + static char string_ident[30]; char *p; - const char *start; again: switch (state) { @@ -251,16 +250,14 @@ again: goto again; } case ST_FILE: - p = lastresult; - if (getline(&p, &lastsize, f) != -1) { + if ((p = fgets(buf, n, f)) != NULL) { linenum++; - if (linenum == 1 && p[0] == '#' && p[1] == 'n') + if (linenum == 1 && buf[0] == '#' && buf[1] == 'n') nflag = 1; if (more != NULL) *more = !feof(f); - return (lastresult = p); - } else if (ferror(f)) - err(1, "%s", script->s); + return (p); + } script = script->next; (void)fclose(f); state = ST_EOF; @@ -268,26 +265,39 @@ again: case ST_STRING: if (linenum == 0 && s[0] == '#' && s[1] == 'n') nflag = 1; - else if (s[0] == '\0') { - state = ST_EOF; - script = script->next; - goto again; - } - start = s; + p = buf; for (;;) { + if (n-- <= 1) { + *p = '\0'; + linenum++; + if (more != NULL) + *more = 1; + return (buf); + } switch (*s) { case '\0': state = ST_EOF; - script = script->next; - /* FALLTHROUGH */ + if (s == script->s) { + script = script->next; + goto again; + } else { + script = script->next; + *p = '\0'; + linenum++; + if (more != NULL) + *more = 0; + return (buf); + } case '\n': + *p++ = '\n'; + *p = '\0'; s++; linenum++; if (more != NULL) *more = 0; - return (start); + return (buf); default: - s++; + *p++ = *s++; } } } @@ -390,7 +400,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag sizeof(oldfname)); len = strlcat(oldfname, inplace, sizeof(oldfname)); - if ((size_t)len > sizeof(oldfname)) + if (len > (ssize_t)sizeof(oldfname)) errx(1, "%s: name too long", fname); } if ((dirbuf = strdup(fname)) == NULL || @@ -401,7 +411,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag basename(basebuf)); free(dirbuf); free(basebuf); - if ((size_t)len >= sizeof(tmpfname)) + if (len >= (ssize_t)sizeof(tmpfname)) errx(1, "%s: name too long", fname); unlink(tmpfname); if (outfile != NULL && outfile != stdout) @@ -455,7 +465,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag * Add a compilation unit to the linked list */ static void -add_compunit(enum e_cut type, const char *s) +add_compunit(enum e_cut type, char *s) { struct s_compunit *cu; @@ -472,7 +482,7 @@ add_compunit(enum e_cut type, const char * Add a file to the linked list */ static void -add_file(const char *s) +add_file(char *s) { struct s_flist *fp; Modified: head/usr.bin/sed/misc.c ============================================================================== --- head/usr.bin/sed/misc.c Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/misc.c Tue Aug 2 15:35:53 2016 (r303662) @@ -56,14 +56,16 @@ static const char sccsid[] = "@(#)misc.c * the buffer). */ char * -strregerror(int errcode, const regex_t *preg) +strregerror(int errcode, regex_t *preg) { static char *oe; size_t s; + if (oe != NULL) + free(oe); s = regerror(errcode, preg, NULL, 0); - if ((oe = realloc(oe, s)) == NULL) - err(1, "realloc"); + if ((oe = malloc(s)) == NULL) + err(1, "malloc"); (void)regerror(errcode, preg, oe, s); return (oe); } Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Tue Aug 2 15:26:46 2016 (r303661) +++ head/usr.bin/sed/process.c Tue Aug 2 15:35:53 2016 (r303662) @@ -67,14 +67,14 @@ static SPACE HS, PS, SS, YS; #define hs HS.space #define hsl HS.len -static inline int applies(struct s_command *); -static void do_tr(const struct s_tr *); -static void flush_appends(void); -static void lputs(const char *, size_t); -static int regexec_e(const regex_t *, const char *, int, int, - size_t, size_t); -static void regsub(SPACE *, const char *, const char *); -static int substitute(const struct s_command *); +static inline int applies(struct s_command *); +static void do_tr(struct s_tr *); +static void flush_appends(void); +static void lputs(char *, size_t); +static int regexec_e(regex_t *, const char *, int, int, size_t, + size_t); +static void regsub(SPACE *, char *, char *); +static int substitute(struct s_command *); struct s_appends *appends; /* Array of pointers to strings to append. */ static int appendx; /* Index into appends array. */ @@ -83,7 +83,7 @@ int appendnum; /* Size of appends arra static int lastaddr; /* Set by applies if last address of a range. */ static int sdone; /* If any substitutes since last line input. */ /* Iov structure for 'w' commands. */ -static const regex_t *defpreg; +static regex_t *defpreg; size_t maxnsub; regmatch_t *match; @@ -377,13 +377,13 @@ resetstate(void) * and then swap them. */ static int -substitute(const struct s_command *cp) +substitute(struct s_command *cp) { SPACE tspace; - const regex_t *re; + regex_t *re; regoff_t slen; int lastempty, n; - regoff_t le = 0; + size_t le = 0; char *s; s = ps; @@ -489,7 +489,7 @@ substitute(const struct s_command *cp) * Perform translation ('y' command) in the pattern space. */ static void -do_tr(const struct s_tr *y) +do_tr(struct s_tr *y) { SPACE tmp; char c, *p; @@ -579,7 +579,7 @@ flush_appends(void) } static void -lputs(const char *s, size_t len) +lputs(char *s, size_t len) { static const char escapes[] = "\\\a\b\f\r\t\v"; int c, col, width; @@ -659,7 +659,7 @@ lputs(const char *s, size_t len) } static int -regexec_e(const regex_t *preg, const char *string, int eflags, int nomatch, +regexec_e(regex_t *preg, const char *string, int eflags, int nomatch, size_t start, size_t stop) { int eval; @@ -691,7 +691,7 @@ regexec_e(const regex_t *preg, const cha * Based on a routine by Henry Spencer */ static void -regsub(SPACE *sp, const char *string, const char *src) +regsub(SPACE *sp, char *string, char *src) { int len, no; char c, *dst; @@ -763,7 +763,7 @@ cspace(SPACE *sp, const char *p, size_t * Close all cached opened files and report any errors */ void -cfclose(struct s_command *cp, const struct s_command *end) +cfclose(struct s_command *cp, struct s_command *end) { for (; cp != end; cp = cp->next) From owner-svn-src-head@freebsd.org Tue Aug 2 15:41:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11E44BACCF6; Tue, 2 Aug 2016 15:41:11 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id E58071B3E; Tue, 2 Aug 2016 15:41:10 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id E4B2818A1; Tue, 2 Aug 2016 15:41:10 +0000 (UTC) Date: Tue, 2 Aug 2016 15:41:10 +0000 From: Alexey Dokuchaev To: Pedro Giffuni Cc: Guido Falsi , svn-src-head@freebsd.org, Mikhail Teterin , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r303047 - head/usr.bin/sed Message-ID: <20160802154110.GA22737@FreeBSD.org> References: <201607192256.u6JMuewv007503@repo.freebsd.org> <20160802141738.GA84154@FreeBSD.org> <51d8013e-bc4b-a511-306d-0e362a8c3e86@madpilot.net> <7f8c5c42-7d2f-ffcf-70dd-dbc9d3202ee7@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f8c5c42-7d2f-ffcf-70dd-dbc9d3202ee7@FreeBSD.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 15:41:11 -0000 On Tue, Aug 02, 2016 at 10:03:20AM -0500, Pedro Giffuni wrote: > Hello; > > [...] > Thank you for the reports, this type of things make nice cases for the > test suite. > > There were good reasons this patch was not meant for 11.0-RELEASE. Given > it's the second regression and I am not satisfied with the patch for the > first one, I will be reverting the change so we can look at the problems > integrally. >From a software engineer point, I fully support this decision. sed(1) is very important part of FreeBSD's repertoire, and any changes to it must not be committed unless fully understood and well tested (on a personal note, not being satisfied with the patch for the first [regression] is already a good enough reason for a backout -- merely IMHO). Thank you. ./danfe From owner-svn-src-head@freebsd.org Tue Aug 2 15:41:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E19EBBACDB9; Tue, 2 Aug 2016 15:41:43 +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 B27B01D7A; Tue, 2 Aug 2016 15:41:43 +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 u72FfgZB000774; Tue, 2 Aug 2016 15:41:42 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72FfgtB000773; Tue, 2 Aug 2016 15:41:42 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201608021541.u72FfgtB000773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 2 Aug 2016 15:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303663 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 15:41:44 -0000 Author: kp Date: Tue Aug 2 15:41:42 2016 New Revision: 303663 URL: https://svnweb.freebsd.org/changeset/base/303663 Log: pfctl: Allow TOS bits to be cleared TOS value 0 is valid, so use 256 as an invalid value rather than zero. This allows users to enforce TOS == 0 with pf. Reported by: Radek Krejča Modified: head/sbin/pfctl/parse.y Modified: head/sbin/pfctl/parse.y ============================================================================== --- head/sbin/pfctl/parse.y Tue Aug 2 15:35:53 2016 (r303662) +++ head/sbin/pfctl/parse.y Tue Aug 2 15:41:42 2016 (r303663) @@ -3593,8 +3593,8 @@ tos : STRING { else if ($1[0] == '0' && $1[1] == 'x') $$ = strtoul($1, NULL, 16); else - $$ = 0; /* flag bad argument */ - if (!$$ || $$ > 255) { + $$ = 256; /* flag bad argument */ + if ($$ < 0 || $$ > 255) { yyerror("illegal tos value %s", $1); free($1); YYERROR; @@ -3603,7 +3603,7 @@ tos : STRING { } | NUMBER { $$ = $1; - if (!$$ || $$ > 255) { + if ($$ < 0 || $$ > 255) { yyerror("illegal tos value %s", $1); YYERROR; } From owner-svn-src-head@freebsd.org Tue Aug 2 18:13:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3648ABAC200; Tue, 2 Aug 2016 18:13:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 059D11D4E; Tue, 2 Aug 2016 18:13:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72IDoKA058572; Tue, 2 Aug 2016 18:13:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72IDoDv058571; Tue, 2 Aug 2016 18:13:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201608021813.u72IDoDv058571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 2 Aug 2016 18:13:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303669 - head/lib/libproc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 18:13:51 -0000 Author: cem Date: Tue Aug 2 18:13:50 2016 New Revision: 303669 URL: https://svnweb.freebsd.org/changeset/base/303669 Log: proc_init: Fix a few memory leaks of 'phdl' In the normal case and correct failure cases, the 'phdl' pointer is passed to callers to use or clean up as needed. However, some failure cases returned early, failing to export the phdl pointer. This was introduced in the restructuring of r303533. Reported by: Coverity CID: 1361070 Reviewed by: markj Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libproc/proc_create.c Modified: head/lib/libproc/proc_create.c ============================================================================== --- head/lib/libproc/proc_create.c Tue Aug 2 17:23:45 2016 (r303668) +++ head/lib/libproc/proc_create.c Tue Aug 2 18:13:50 2016 (r303669) @@ -73,9 +73,9 @@ proc_init(pid_t pid, int flags, int stat struct proc_handle *phdl; int error, class, count, fd; - *pphdl = NULL; + error = ENOMEM; if ((phdl = malloc(sizeof(*phdl))) == NULL) - return (ENOMEM); + goto out; memset(phdl, 0, sizeof(*phdl)); phdl->pid = pid; @@ -83,17 +83,17 @@ proc_init(pid_t pid, int flags, int stat phdl->status = status; phdl->procstat = procstat_open_sysctl(); if (phdl->procstat == NULL) - return (ENOMEM); + goto out; /* Obtain a path to the executable. */ if ((kp = procstat_getprocs(phdl->procstat, KERN_PROC_PID, pid, &count)) == NULL) - return (ENOMEM); + goto out; error = procstat_getpathname(phdl->procstat, kp, phdl->execpath, sizeof(phdl->execpath)); procstat_freeprocs(phdl->procstat, kp); if (error != 0) - return (error); + goto out; /* Use it to determine the data model for the process. */ if ((fd = open(phdl->execpath, O_RDONLY)) < 0) { From owner-svn-src-head@freebsd.org Tue Aug 2 18:42:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C898BAC996; Tue, 2 Aug 2016 18:42:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D0441E9D; Tue, 2 Aug 2016 18:42:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72IgWQK070107; Tue, 2 Aug 2016 18:42:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72IgWsb070106; Tue, 2 Aug 2016 18:42:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201608021842.u72IgWsb070106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 Aug 2016 18:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303670 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 18:42:33 -0000 Author: emaste Date: Tue Aug 2 18:42:32 2016 New Revision: 303670 URL: https://svnweb.freebsd.org/changeset/base/303670 Log: Add ELFOSABI_ARM_AEABI ELF OSABI constant Reported by: andrew Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Tue Aug 2 18:13:50 2016 (r303669) +++ head/sys/sys/elf_common.h Tue Aug 2 18:42:32 2016 (r303670) @@ -171,6 +171,7 @@ typedef struct { #define ELFOSABI_AROS 15 /* Amiga Research OS */ #define ELFOSABI_FENIXOS 16 /* FenixOS */ #define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */ +#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ From owner-svn-src-head@freebsd.org Tue Aug 2 19:54:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB5D8BAD14D; Tue, 2 Aug 2016 19:54:41 +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 7DC541A58; Tue, 2 Aug 2016 19:54:41 +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 u72Jsem4095660; Tue, 2 Aug 2016 19:54:40 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72Jsefv095659; Tue, 2 Aug 2016 19:54:40 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201608021954.u72Jsefv095659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 2 Aug 2016 19:54:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303673 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 19:54:41 -0000 Author: kp Date: Tue Aug 2 19:54:40 2016 New Revision: 303673 URL: https://svnweb.freebsd.org/changeset/base/303673 Log: pfctl: Match prototype of pfctl_load_hostid. The prototype and the implementation of the pfctl_load_hostid used a different data type for one of the parameters. Submitted by: Christian Mauderer Modified: head/sbin/pfctl/pfctl.c Modified: head/sbin/pfctl/pfctl.c ============================================================================== --- head/sbin/pfctl/pfctl.c Tue Aug 2 19:41:54 2016 (r303672) +++ head/sbin/pfctl/pfctl.c Tue Aug 2 19:54:40 2016 (r303673) @@ -82,7 +82,7 @@ int pfctl_load_limit(struct pfctl *, un int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); -int pfctl_load_hostid(struct pfctl *, unsigned int); +int pfctl_load_hostid(struct pfctl *, u_int32_t); int pfctl_get_pool(int, struct pf_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pf_rule *, int); From owner-svn-src-head@freebsd.org Tue Aug 2 20:11:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74039BAD77D; Tue, 2 Aug 2016 20:11:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CD5E1785; Tue, 2 Aug 2016 20:11:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72KB4bb099655; Tue, 2 Aug 2016 20:11:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72KB4lB099654; Tue, 2 Aug 2016 20:11:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201608022011.u72KB4lB099654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 Aug 2016 20:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303674 - head/contrib/elftoolchain/readelf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 20:11:05 -0000 Author: emaste Date: Tue Aug 2 20:11:04 2016 New Revision: 303674 URL: https://svnweb.freebsd.org/changeset/base/303674 Log: readelf: report ARM program and section header types Reviewed by: andrew Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7390 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Tue Aug 2 19:54:40 2016 (r303673) +++ head/contrib/elftoolchain/readelf/readelf.c Tue Aug 2 20:11:04 2016 (r303674) @@ -343,7 +343,7 @@ static const char *note_type_openbsd(uns static const char *note_type_unknown(unsigned int nt); static const char *note_type_xen(unsigned int nt); static const char *option_kind(uint8_t kind); -static const char *phdr_type(unsigned int ptype); +static const char *phdr_type(unsigned int mach, unsigned int ptype); static const char *ppc_abi_fp(uint64_t fp); static const char *ppc_abi_vector(uint64_t vec); static void readelf_usage(int status); @@ -622,10 +622,24 @@ elf_ver(unsigned int ver) } static const char * -phdr_type(unsigned int ptype) +phdr_type(unsigned int mach, unsigned int ptype) { static char s_ptype[32]; + if (ptype >= PT_LOPROC && ptype <= PT_HIPROC) { + switch (mach) { + case EM_ARM: + switch (ptype) { + case PT_ARM_ARCHEXT: return "ARM_ARCHEXT"; + case PT_ARM_EXIDX: return "ARM_EXIDX"; + } + break; + } + snprintf(s_ptype, sizeof(s_ptype), "LOPROC+%#x", + ptype - PT_LOPROC); + return (s_ptype); + } + switch (ptype) { case PT_NULL: return "NULL"; case PT_LOAD: return "LOAD"; @@ -639,10 +653,7 @@ phdr_type(unsigned int ptype) case PT_GNU_STACK: return "GNU_STACK"; case PT_GNU_RELRO: return "GNU_RELRO"; default: - if (ptype >= PT_LOPROC && ptype <= PT_HIPROC) - snprintf(s_ptype, sizeof(s_ptype), "LOPROC+%#x", - ptype - PT_LOPROC); - else if (ptype >= PT_LOOS && ptype <= PT_HIOS) + if (ptype >= PT_LOOS && ptype <= PT_HIOS) snprintf(s_ptype, sizeof(s_ptype), "LOOS+%#x", ptype - PT_LOOS); else @@ -659,6 +670,15 @@ section_type(unsigned int mach, unsigned if (stype >= SHT_LOPROC && stype <= SHT_HIPROC) { switch (mach) { + case EM_ARM: + switch (stype) { + case SHT_ARM_EXIDX: return "ARM_EXIDX"; + case SHT_ARM_PREEMPTMAP: return "ARM_PREEMPTMAP"; + case SHT_ARM_ATTRIBUTES: return "ARM_ATTRIBUTES"; + case SHT_ARM_DEBUGOVERLAY: return "ARM_DEBUGOVERLAY"; + case SHT_ARM_OVERLAYSECTION: return "ARM_OVERLAYSECTION"; + } + break; case EM_X86_64: switch (stype) { case SHT_X86_64_UNWIND: return "X86_64_UNWIND"; @@ -2273,9 +2293,10 @@ dump_phdr(struct readelf *re) #define PH_HDR "Type", "Offset", "VirtAddr", "PhysAddr", "FileSiz", \ "MemSiz", "Flg", "Align" -#define PH_CT phdr_type(phdr.p_type), (uintmax_t)phdr.p_offset, \ - (uintmax_t)phdr.p_vaddr, (uintmax_t)phdr.p_paddr, \ - (uintmax_t)phdr.p_filesz, (uintmax_t)phdr.p_memsz, \ +#define PH_CT phdr_type(re->ehdr.e_machine, phdr.p_type), \ + (uintmax_t)phdr.p_offset, (uintmax_t)phdr.p_vaddr, \ + (uintmax_t)phdr.p_paddr, (uintmax_t)phdr.p_filesz, \ + (uintmax_t)phdr.p_memsz, \ phdr.p_flags & PF_R ? 'R' : ' ', \ phdr.p_flags & PF_W ? 'W' : ' ', \ phdr.p_flags & PF_X ? 'E' : ' ', \ From owner-svn-src-head@freebsd.org Tue Aug 2 20:25:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94ACCBADB45; Tue, 2 Aug 2016 20:25: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 6520C14D9; Tue, 2 Aug 2016 20:25:23 +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 u72KPMH5006770; Tue, 2 Aug 2016 20:25:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72KPMku006769; Tue, 2 Aug 2016 20:25:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201608022025.u72KPMku006769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 2 Aug 2016 20:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303676 - head/usr.bin/grep/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 20:25:23 -0000 Author: dim Date: Tue Aug 2 20:25:22 2016 New Revision: 303676 URL: https://svnweb.freebsd.org/changeset/base/303676 Log: Fix a segfault in bsdgrep when parsing the invalid extended regexps "?" or "+" (these are invalid, because there is no preceding operand). When bsdgrep attempts to emulate GNU grep in discarding and ignoring the invalid ? or + operators, some later logic in tre_compile_fast() goes beyond the end of the buffer, leading to a crash. Fix this by bailing out, and reporting a bad pattern instead. Reported by: Steve Kargl MFC after: 1 week Modified: head/usr.bin/grep/regex/tre-fastmatch.c Modified: head/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- head/usr.bin/grep/regex/tre-fastmatch.c Tue Aug 2 20:18:43 2016 (r303675) +++ head/usr.bin/grep/regex/tre-fastmatch.c Tue Aug 2 20:25:22 2016 (r303676) @@ -621,7 +621,7 @@ tre_compile_fast(fastmatch_t *fg, const case TRE_CHAR('+'): case TRE_CHAR('?'): if ((cflags & REG_EXTENDED) && (i == 0)) - continue; + goto badpat; else if ((cflags & REG_EXTENDED) ^ !escaped) STORE_CHAR; else From owner-svn-src-head@freebsd.org Tue Aug 2 20:26:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA4C2BADB9B; Tue, 2 Aug 2016 20:26:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A839167F; Tue, 2 Aug 2016 20:26:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72KQ4QL006846; Tue, 2 Aug 2016 20:26:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72KQ4Bh006844; Tue, 2 Aug 2016 20:26:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201608022026.u72KQ4Bh006844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 Aug 2016 20:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303677 - in head/sys: arm/include sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 20:26:05 -0000 Author: emaste Date: Tue Aug 2 20:26:04 2016 New Revision: 303677 URL: https://svnweb.freebsd.org/changeset/base/303677 Log: Move/add ARM ELF PHDR types to elf_common.h Accidentally missed in r303674 Modified: head/sys/arm/include/elf.h head/sys/sys/elf_common.h Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Tue Aug 2 20:25:22 2016 (r303676) +++ head/sys/arm/include/elf.h Tue Aug 2 20:26:04 2016 (r303677) @@ -55,9 +55,6 @@ __ElfType(Auxinfo); #define ELF_MACHINE_OK(x) ((x) == EM_ARM) -/* Unwind info section type */ -#define PT_ARM_EXIDX (PT_LOPROC + 1) - /* * Relocation types. */ Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Tue Aug 2 20:25:22 2016 (r303676) +++ head/sys/sys/elf_common.h Tue Aug 2 20:26:04 2016 (r303677) @@ -511,6 +511,8 @@ typedef struct { #define PT_HISUNW 0x6fffffff #define PT_HIOS 0x6fffffff /* Last OS-specific. */ #define PT_LOPROC 0x70000000 /* First processor-specific type. */ +#define PT_ARM_ARCHEXT 0x70000000 /* ARM arch compat information. */ +#define PT_ARM_EXIDX 0x70000001 /* ARM exception unwind tables. */ #define PT_HIPROC 0x7fffffff /* Last processor-specific type. */ /* Values for p_flags. */ From owner-svn-src-head@freebsd.org Tue Aug 2 20:32:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 533A0BADE6C; Tue, 2 Aug 2016 20:32:03 +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 314C21C8A; Tue, 2 Aug 2016 20:32:03 +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 u72KW2fV010694; Tue, 2 Aug 2016 20:32:02 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72KW2fO010691; Tue, 2 Aug 2016 20:32:02 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201608022032.u72KW2fO010691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 2 Aug 2016 20:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303678 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 20:32:03 -0000 Author: kp Date: Tue Aug 2 20:32:02 2016 New Revision: 303678 URL: https://svnweb.freebsd.org/changeset/base/303678 Log: pfctl: Use const where possible. This adds const qualifiers where it is possible. Submitted by: Christian Mauderer Modified: head/sbin/pfctl/pfctl.c head/sbin/pfctl/pfctl_parser.c head/sbin/pfctl/pfctl_radix.c Modified: head/sbin/pfctl/pfctl.c ============================================================================== --- head/sbin/pfctl/pfctl.c Tue Aug 2 20:26:04 2016 (r303677) +++ head/sbin/pfctl/pfctl.c Tue Aug 2 20:32:02 2016 (r303678) @@ -100,7 +100,7 @@ int pfctl_ruleset_trans(struct pfctl *, int pfctl_load_ruleset(struct pfctl *, char *, struct pf_ruleset *, int, int); int pfctl_load_rule(struct pfctl *, char *, struct pf_rule *, int); -const char *pfctl_lookup_option(char *, const char **); +const char *pfctl_lookup_option(char *, const char * const *); struct pf_anchor_global pf_anchors; struct pf_anchor pf_main_anchor; @@ -111,7 +111,7 @@ const char *showopt; const char *debugopt; char *anchoropt; const char *optiopt = NULL; -char *pf_device = "/dev/pf"; +const char *pf_device = "/dev/pf"; char *ifaceopt; char *tableopt; const char *tblcmdopt; @@ -203,27 +203,27 @@ static const struct { { NULL, NULL } }; -static const char *clearopt_list[] = { +static const char * const clearopt_list[] = { "nat", "queue", "rules", "Sources", "states", "info", "Tables", "osfp", "all", NULL }; -static const char *showopt_list[] = { +static const char * const showopt_list[] = { "nat", "queue", "rules", "Anchors", "Sources", "states", "info", "Interfaces", "labels", "timeouts", "memory", "Tables", "osfp", "all", NULL }; -static const char *tblcmdopt_list[] = { +static const char * const tblcmdopt_list[] = { "kill", "flush", "add", "delete", "load", "replace", "show", "test", "zero", "expire", NULL }; -static const char *debugopt_list[] = { +static const char * const debugopt_list[] = { "none", "urgent", "misc", "loud", NULL }; -static const char *optiopt_list[] = { +static const char * const optiopt_list[] = { "none", "basic", "profile", NULL }; @@ -1975,7 +1975,7 @@ pfctl_show_anchors(int dev, int opts, ch } const char * -pfctl_lookup_option(char *cmd, const char **list) +pfctl_lookup_option(char *cmd, const char * const *list) { if (cmd != NULL && *cmd) for (; *list; list++) Modified: head/sbin/pfctl/pfctl_parser.c ============================================================================== --- head/sbin/pfctl/pfctl_parser.c Tue Aug 2 20:26:04 2016 (r303677) +++ head/sbin/pfctl/pfctl_parser.c Tue Aug 2 20:32:02 2016 (r303678) @@ -76,7 +76,7 @@ struct node_host *host_v4(const char *, struct node_host *host_v6(const char *, int); struct node_host *host_dns(const char *, int, int); -const char *tcpflags = "FSRPAUEW"; +const char * const tcpflags = "FSRPAUEW"; static const struct icmptypeent icmp_type[] = { { "echoreq", ICMP_ECHO }, @@ -473,10 +473,10 @@ print_pool(struct pf_pool *pool, u_int16 printf(" static-port"); } -const char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES; -const char *pf_lcounters[LCNT_MAX+1] = LCNT_NAMES; -const char *pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; -const char *pf_scounters[FCNT_MAX+1] = FCNT_NAMES; +const char * const pf_reasons[PFRES_MAX+1] = PFRES_NAMES; +const char * const pf_lcounters[LCNT_MAX+1] = LCNT_NAMES; +const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; +const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void print_status(struct pf_status *s, int opts) Modified: head/sbin/pfctl/pfctl_radix.c ============================================================================== --- head/sbin/pfctl/pfctl_radix.c Tue Aug 2 20:26:04 2016 (r303677) +++ head/sbin/pfctl/pfctl_radix.c Tue Aug 2 20:32:02 2016 (r303678) @@ -401,7 +401,7 @@ pfi_get_ifaces(const char *filter, struc /* buffer management code */ -size_t buf_esize[PFRB_MAX] = { 0, +const size_t buf_esize[PFRB_MAX] = { 0, sizeof(struct pfr_table), sizeof(struct pfr_tstats), sizeof(struct pfr_addr), sizeof(struct pfr_astats), sizeof(struct pfi_kif), sizeof(struct pfioc_trans_e) From owner-svn-src-head@freebsd.org Tue Aug 2 21:48:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F666BA8916; Tue, 2 Aug 2016 21:48:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FA6D1F6B; Tue, 2 Aug 2016 21:48:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72LmQD3037027; Tue, 2 Aug 2016 21:48:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72LmQkZ037026; Tue, 2 Aug 2016 21:48:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201608022148.u72LmQkZ037026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 Aug 2016 21:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303682 - head/usr.sbin/kgzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 21:48:27 -0000 Author: emaste Date: Tue Aug 2 21:48:26 2016 New Revision: 303682 URL: https://svnweb.freebsd.org/changeset/base/303682 Log: kgzip.8: note that it is deprecated and clarify BUGS section kgzip is only useful on i386 and has a number of other limitations. We're better served by officially deprecating it and encouraging users to use loader(8) instead. Reviewed by: dteske, wblock Differential Revision: https://reviews.freebsd.org/D7098 Modified: head/usr.sbin/kgzip/kgzip.8 Modified: head/usr.sbin/kgzip/kgzip.8 ============================================================================== --- head/usr.sbin/kgzip/kgzip.8 Tue Aug 2 21:17:59 2016 (r303681) +++ head/usr.sbin/kgzip/kgzip.8 Tue Aug 2 21:48:26 2016 (r303682) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 1999 +.Dd August 2, 2016 .Dt KGZIP 8 .Os .Sh NAME @@ -38,6 +38,14 @@ .Op Fl o Ar output .Ar file .Sh DESCRIPTION +.Bf -symbolic +This utility is deprecated. +Users are advised to use +.Xr loader 8 +and compress the kernel with +.Xr gzip 1 . +.Ef +.Pp The .Nm utility compresses a kernel or some other bootable binary. @@ -137,7 +145,12 @@ The default loader As symbols are lost, the usefulness of this utility for compressing kernels is limited to situations where .Xr loader 8 -cannot be used; otherwise the preferred method of compressing a kernel +cannot be used. +.Pp +.Pa kgzldr.o +is only available for the i386 and pc98 architectures. +.Pp +The preferred method of compressing a kernel is simply to .Xr gzip 1 it. From owner-svn-src-head@freebsd.org Tue Aug 2 21:55:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B78D4BA8FE6; Tue, 2 Aug 2016 21:55:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A101D97; Tue, 2 Aug 2016 21:55:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72LtNg9040601; Tue, 2 Aug 2016 21:55:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72LtNaD040600; Tue, 2 Aug 2016 21:55:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201608022155.u72LtNaD040600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 2 Aug 2016 21:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303683 - head/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 21:55:24 -0000 Author: imp Date: Tue Aug 2 21:55:23 2016 New Revision: 303683 URL: https://svnweb.freebsd.org/changeset/base/303683 Log: tools/build looks for _WITH_GETLINE in /usr/include/stdio.h to see if we need to include it in -legacy or not. Since the ifdef was removed, this broke building 10.x and older source trees on -current. Restore just enough of _WITH_GETLINE to allow these older source trees to still build and properly omit getline() from their -legacy library. Modified: head/include/stdio.h Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Tue Aug 2 21:48:26 2016 (r303682) +++ head/include/stdio.h Tue Aug 2 21:55:23 2016 (r303683) @@ -357,6 +357,7 @@ ssize_t getdelim(char ** __restrict, si FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); +/* _WITH_GETLINE to allow pre 11 sources to build on 11+ systems */ ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); int dprintf(int, const char * __restrict, ...); #endif /* __POSIX_VISIBLE >= 200809 */ From owner-svn-src-head@freebsd.org Tue Aug 2 22:47:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10818BABEA1; Tue, 2 Aug 2016 22:47:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D19581CF2; Tue, 2 Aug 2016 22:47:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72Ml66F058943; Tue, 2 Aug 2016 22:47:06 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72Ml6TG058942; Tue, 2 Aug 2016 22:47:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608022247.u72Ml6TG058942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 2 Aug 2016 22:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303685 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 22:47:08 -0000 Author: bapt Date: Tue Aug 2 22:47:06 2016 New Revision: 303685 URL: https://svnweb.freebsd.org/changeset/base/303685 Log: truss: fix uninitialized trussinfo->curthread in add_threads()/enter_syscall trussinfo->curthread must be initialized before calling enter_syscall(), it is used by t->proc->abi->fetch_args(). Without that truss is segfaulting and the attached program also crash. Submitted by: Nikita Kozlov (nikita@gandi.net) Reviewed by: jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7399 Modified: head/usr.bin/truss/setup.c Modified: head/usr.bin/truss/setup.c ============================================================================== --- head/usr.bin/truss/setup.c Tue Aug 2 22:33:29 2016 (r303684) +++ head/usr.bin/truss/setup.c Tue Aug 2 22:47:06 2016 (r303685) @@ -223,8 +223,10 @@ add_threads(struct trussinfo *info, stru t = new_thread(p, lwps[i]); if (ptrace(PT_LWPINFO, lwps[i], (caddr_t)&pl, sizeof(pl)) == -1) err(1, "ptrace(PT_LWPINFO)"); - if (pl.pl_flags & PL_FLAG_SCE) + if (pl.pl_flags & PL_FLAG_SCE) { + info->curthread = t; enter_syscall(info, t, &pl); + } } free(lwps); } From owner-svn-src-head@freebsd.org Tue Aug 2 23:46:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BB76BAD0C0; Tue, 2 Aug 2016 23:46:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BF1A1CE1; Tue, 2 Aug 2016 23:46:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72NkWFU081369; Tue, 2 Aug 2016 23:46:32 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72NkWKR081368; Tue, 2 Aug 2016 23:46:32 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608022346.u72NkWKR081368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 2 Aug 2016 23:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303687 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 23:46:33 -0000 Author: bdrewery Date: Tue Aug 2 23:46:32 2016 New Revision: 303687 URL: https://svnweb.freebsd.org/changeset/base/303687 Log: Add link for getnetgrent_r(3). MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/gen/Makefile.inc Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Aug 2 23:34:59 2016 (r303686) +++ head/lib/libc/gen/Makefile.inc Tue Aug 2 23:46:32 2016 (r303687) @@ -390,6 +390,7 @@ MLINKS+=getgrent.3 endgrent.3 \ getgrent.3 getgrgid_r.3 MLINKS+=gethostname.3 sethostname.3 MLINKS+=getnetgrent.3 endnetgrent.3 \ + getnetgrent.3 getnetgrent_r.3 \ getnetgrent.3 innetgr.3 \ getnetgrent.3 setnetgrent.3 MLINKS+=getprogname.3 setprogname.3 From owner-svn-src-head@freebsd.org Tue Aug 2 23:54:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6D66BAD2DC; Tue, 2 Aug 2016 23:54:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2E2813AF; Tue, 2 Aug 2016 23:54:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u72NsLke084900; Tue, 2 Aug 2016 23:54:21 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u72NsLf9084898; Tue, 2 Aug 2016 23:54:21 GMT (envelope-from np@FreeBSD.org) Message-Id: <201608022354.u72NsLf9084898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 2 Aug 2016 23:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303688 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 23:54:22 -0000 Author: np Date: Tue Aug 2 23:54:21 2016 New Revision: 303688 URL: https://svnweb.freebsd.org/changeset/base/303688 Log: cxgbe/t4_tom: Read the chip's DDP page sizes and save them in a per-adapter data structure. This replaces a global array with hardcoded page sizes. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Aug 2 23:46:32 2016 (r303687) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Aug 2 23:54:21 2016 (r303688) @@ -88,9 +88,6 @@ static void t4_aio_cancel_queued(struct #define PPOD_SZ(n) ((n) * sizeof(struct pagepod)) #define PPOD_SIZE (PPOD_SZ(1)) -/* XXX: must match A_ULP_RX_TDDP_PSZ */ -static int t4_ddp_pgsz[] = {4096, 4096 << 2, 4096 << 4, 4096 << 6}; - static TAILQ_HEAD(, pageset) ddp_orphan_pagesets; static struct mtx ddp_orphan_pagesets_lock; static struct task ddp_orphan_task; @@ -908,13 +905,13 @@ alloc_page_pods(struct tom_data *td, str } hcf = calculate_hcf(hcf, seglen); - if (hcf < t4_ddp_pgsz[1]) { + if (hcf < td->ddp_pgsz[1]) { idx = 0; goto have_pgsz; /* give up, short circuit */ } } - if (hcf % t4_ddp_pgsz[0] != 0) { + if (hcf % td->ddp_pgsz[0] != 0) { /* hmmm. This could only happen when PAGE_SIZE < 4K */ KASSERT(PAGE_SIZE < 4096, ("%s: PAGE_SIZE %d, hcf %d", __func__, PAGE_SIZE, hcf)); @@ -923,17 +920,17 @@ alloc_page_pods(struct tom_data *td, str return (0); } - for (idx = nitems(t4_ddp_pgsz) - 1; idx > 0; idx--) { - if (hcf % t4_ddp_pgsz[idx] == 0) + for (idx = nitems(td->ddp_pgsz) - 1; idx > 0; idx--) { + if (hcf % td->ddp_pgsz[idx] == 0) break; } have_pgsz: MPASS(idx <= M_PPOD_PGSZ); - nppods = pages_to_nppods(ps->npages, t4_ddp_pgsz[idx]); + nppods = pages_to_nppods(ps->npages, td->ddp_pgsz[idx]); if (alloc_ppods(td, nppods, &ppod_addr) != 0) { CTR4(KTR_CXGBE, "%s: no pods, nppods %d, npages %d, pgsz %d", - __func__, nppods, ps->npages, t4_ddp_pgsz[idx]); + __func__, nppods, ps->npages, td->ddp_pgsz[idx]); return (0); } @@ -944,7 +941,7 @@ have_pgsz: CTR5(KTR_CXGBE, "New page pods. " "ps %p, ddp_pgsz %d, ppod 0x%x, npages %d, nppods %d", - ps, t4_ddp_pgsz[idx], ppod, ps->npages, ps->nppods); + ps, td->ddp_pgsz[idx], ppod, ps->npages, ps->nppods); return (1); } @@ -958,6 +955,7 @@ write_page_pods(struct adapter *sc, stru struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; + struct tom_data *td = sc->tom_softc; int i, j, k, n, chunk, len, ddp_pgsz, idx; u_int ppod_addr; uint32_t cmd; @@ -970,7 +968,7 @@ write_page_pods(struct adapter *sc, stru cmd |= htobe32(F_ULP_MEMIO_ORDER); else cmd |= htobe32(F_T5_ULP_MEMIO_IMM); - ddp_pgsz = t4_ddp_pgsz[G_PPOD_PGSZ(ps->tag)]; + ddp_pgsz = td->ddp_pgsz[G_PPOD_PGSZ(ps->tag)]; ppod_addr = ps->ppod_addr; for (i = 0; i < ps->nppods; ppod_addr += chunk) { @@ -1069,6 +1067,23 @@ prep_pageset(struct adapter *sc, struct void t4_init_ddp(struct adapter *sc, struct tom_data *td) { + int i; + uint32_t r; + + r = t4_read_reg(sc, A_ULP_RX_TDDP_PSZ); + td->ddp_pgsz[0] = 4096 << G_HPZ0(r); + td->ddp_pgsz[1] = 4096 << G_HPZ1(r); + td->ddp_pgsz[2] = 4096 << G_HPZ2(r); + td->ddp_pgsz[3] = 4096 << G_HPZ3(r); + + /* + * The SGL -> page pod algorithm requires the sizes to be in increasing + * order. + */ + for (i = 1; i < nitems(td->ddp_pgsz); i++) { + if (td->ddp_pgsz[i] <= td->ddp_pgsz[i - 1]) + return; + } td->ppod_start = sc->vres.ddp.start; td->ppod_arena = vmem_create("DDP page pods", sc->vres.ddp.start, Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Tue Aug 2 23:46:32 2016 (r303687) +++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Aug 2 23:54:21 2016 (r303688) @@ -240,6 +240,7 @@ struct tom_data { int lctx_count; /* # of lctx in the hash table */ u_int ppod_start; + u_int ddp_pgsz[4]; vmem_t *ppod_arena; struct mtx clip_table_lock; From owner-svn-src-head@freebsd.org Wed Aug 3 01:22:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDCB5BA5FC7; Wed, 3 Aug 2016 01:22:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CB691F76; Wed, 3 Aug 2016 01:22:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u731MB6X017123; Wed, 3 Aug 2016 01:22:11 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u731MBVd017115; Wed, 3 Aug 2016 01:22:11 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201608030122.u731MBVd017115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 3 Aug 2016 01:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303693 - in head/sys: conf powerpc/conf powerpc/conf/dpaa powerpc/mpc85xx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 01:22:12 -0000 Author: jhibbits Date: Wed Aug 3 01:22:11 2016 New Revision: 303693 URL: https://svnweb.freebsd.org/changeset/base/303693 Log: Merge MPC85XX and QorIQ config options Summary: MPC85XX and QorIQ are very similar. When the DPAA dTSEC driver was added, QORIQ_DPAA was brought in as a config option to support the differences in hardware register settings between QorIQ (e500mc-, e5500- based) SoCs and QUICC (e500v1/e500v2-based) SoCs, particularly in the Local Access Window (LAW) target settings. Unify these settings using macros to hide details and ease porting, and use a new function (mpc85xx_is_qoriq()) to distinguish between QorIQ and QUICC SoCs at runtime. An alternative to using the function could be to use a variable initialized at platform attach time, which may incur less overhead at runtime. Since it's not in the critical path once booted, this optimization doesn't seem necessary at first pass. Reviewed by: nwhitehorn MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7294 Modified: head/sys/conf/files.powerpc head/sys/conf/options.powerpc head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/dpaa/DPAA head/sys/powerpc/mpc85xx/mpc85xx.c head/sys/powerpc/mpc85xx/mpc85xx.h head/sys/powerpc/mpc85xx/pci_mpc85xx.c head/sys/powerpc/mpc85xx/platform_mpc85xx.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/conf/files.powerpc Wed Aug 3 01:22:11 2016 (r303693) @@ -76,7 +76,7 @@ dev/syscons/scvtb.c optional sc dev/tsec/if_tsec.c optional tsec dev/tsec/if_tsec_fdt.c optional tsec fdt dev/uart/uart_cpu_powerpc.c optional uart -dev/usb/controller/ehci_fsl.c optional ehci mpc85xx | ehci qoriq_dpaa +dev/usb/controller/ehci_fsl.c optional ehci mpc85xx dev/vt/hw/ofwfb/ofwfb.c optional vt aim kern/kern_clocksource.c standard kern/subr_dummy_vdso_tc.c standard @@ -135,16 +135,16 @@ powerpc/mikrotik/platform_rb.c optional powerpc/mpc85xx/atpic.c optional mpc85xx isa powerpc/mpc85xx/ds1553_bus_fdt.c optional ds1553 fdt powerpc/mpc85xx/ds1553_core.c optional ds1553 -powerpc/mpc85xx/fsl_sdhc.c optional mpc85xx sdhc | qoriq_dpaa sdhc +powerpc/mpc85xx/fsl_sdhc.c optional mpc85xx sdhc powerpc/mpc85xx/i2c.c optional iicbus fdt powerpc/mpc85xx/isa.c optional mpc85xx isa -powerpc/mpc85xx/lbc.c optional mpc85xx | qoriq_dpaa -powerpc/mpc85xx/mpc85xx.c optional mpc85xx | qoriq_dpaa +powerpc/mpc85xx/lbc.c optional mpc85xx +powerpc/mpc85xx/mpc85xx.c optional mpc85xx powerpc/mpc85xx/mpc85xx_gpio.c optional mpc85xx gpio -powerpc/mpc85xx/platform_mpc85xx.c optional mpc85xx | qoriq_dpaa -powerpc/mpc85xx/pci_mpc85xx.c optional pci mpc85xx | pci qoriq_dpaa -powerpc/mpc85xx/pci_mpc85xx_pcib.c optional pci mpc85xx | pci qoriq_dpaa -powerpc/mpc85xx/qoriq_gpio.c optional mpc85xx gpio | qoriq_dpaa gpio +powerpc/mpc85xx/platform_mpc85xx.c optional mpc85xx +powerpc/mpc85xx/pci_mpc85xx.c optional pci mpc85xx +powerpc/mpc85xx/pci_mpc85xx_pcib.c optional pci mpc85xx +powerpc/mpc85xx/qoriq_gpio.c optional mpc85xx gpio powerpc/ofw/ofw_machdep.c standard powerpc/ofw/ofw_pcibus.c optional pci powerpc/ofw/ofw_pcib_pci.c optional pci Modified: head/sys/conf/options.powerpc ============================================================================== --- head/sys/conf/options.powerpc Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/conf/options.powerpc Wed Aug 3 01:22:11 2016 (r303693) @@ -21,7 +21,6 @@ GFB_NO_MODE_CHANGE opt_gfb.h MPC85XX opt_platform.h POWERMAC opt_platform.h PS3 opt_platform.h -QORIQ_DPAA opt_platform.h MAMBO PSERIES PSIM Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/powerpc/conf/MPC85XX Wed Aug 3 01:22:11 2016 (r303693) @@ -10,7 +10,9 @@ ident MPC85XX machine powerpc powerpc +include "dpaa/config.dpaa" makeoptions DEBUG="-Wa,-me500 -g" +makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" makeoptions NO_MODULES=yes options FPU_EMU @@ -21,7 +23,6 @@ options BREAK_TO_DEBUGGER options BOOTP options BOOTP_NFSROOT #options BOOTP_NFSV3 -options BOOTP_WIRED_TO=tsec0 options CD9660 options COMPAT_43 options DDB @@ -29,7 +30,6 @@ options DDB options DEVICE_POLLING #options DIAGNOSTIC options FDT -makeoptions FDT_DTS_FILE=mpc8572ds.dts #makeoptions FDT_DTS_FILE=mpc8555cds.dts options FFS options GDB @@ -69,6 +69,7 @@ device em device alc device ether device fxp +device gpio device iic device iicbus #device isa Modified: head/sys/powerpc/conf/dpaa/DPAA ============================================================================== --- head/sys/powerpc/conf/dpaa/DPAA Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/powerpc/conf/dpaa/DPAA Wed Aug 3 01:22:11 2016 (r303693) @@ -16,7 +16,7 @@ makeoptions WERROR="-Werror -Wno-format makeoptions NO_MODULES=yes # Platform support -options QORIQ_DPAA #Freescale SoC family +options MPC85XX #Freescale SoC family options SMP #Symmetric Multi Processing Modified: head/sys/powerpc/mpc85xx/mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.c Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/powerpc/mpc85xx/mpc85xx.c Wed Aug 3 01:22:11 2016 (r303693) @@ -108,13 +108,17 @@ law_getmax(void) static inline void law_write(uint32_t n, uint64_t bar, uint32_t sr) { -#if defined(QORIQ_DPAA) - ccsr_write4(OCP85XX_LAWBARH(n), bar >> 32); - ccsr_write4(OCP85XX_LAWBARL(n), bar); -#else - ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12); -#endif - ccsr_write4(OCP85XX_LAWSR(n), sr); + + if (mpc85xx_is_qoriq()) { + ccsr_write4(OCP85XX_LAWBARH(n), bar >> 32); + ccsr_write4(OCP85XX_LAWBARL(n), bar); + ccsr_write4(OCP85XX_LAWSR_QORIQ(n), sr); + ccsr_read4(OCP85XX_LAWSR_QORIQ(n)); + } else { + ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12); + ccsr_write4(OCP85XX_LAWSR_85XX(n), sr); + ccsr_read4(OCP85XX_LAWSR_85XX(n)); + } /* * The last write to LAWAR should be followed by a read @@ -123,20 +127,21 @@ law_write(uint32_t n, uint64_t bar, uint * instruction. */ - ccsr_read4(OCP85XX_LAWSR(n)); isync(); } static inline void law_read(uint32_t n, uint64_t *bar, uint32_t *sr) { -#if defined(QORIQ_DPAA) - *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 | - ccsr_read4(OCP85XX_LAWBARL(n)); -#else - *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12; -#endif - *sr = ccsr_read4(OCP85XX_LAWSR(n)); + + if (mpc85xx_is_qoriq()) { + *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 | + ccsr_read4(OCP85XX_LAWBARL(n)); + *sr = ccsr_read4(OCP85XX_LAWSR_QORIQ(n)); + } else { + *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12; + *sr = ccsr_read4(OCP85XX_LAWSR_85XX(n)); + } } static int @@ -306,6 +311,18 @@ mpc85xx_enable_l3_cache(void) } } +int +mpc85xx_is_qoriq(void) +{ + uint16_t pvr = mfpvr() >> 16; + + /* QorIQ register set is only in e500mc and derivative core based SoCs. */ + if (pvr == FSL_E500mc || pvr == FSL_E5500 || pvr == FSL_E6500) + return (1); + + return (0); +} + static void mpc85xx_dataloss_erratum_spr976(void) { @@ -352,9 +369,7 @@ moveon: if (err != 0) return (err); -#ifdef QORIQ_DPAA law_enable(OCP85XX_TGTIF_DCSR, b, 0x400000); -#endif return pmap_early_io_map(b, 0x400000); } Modified: head/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.h Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/powerpc/mpc85xx/mpc85xx.h Wed Aug 3 01:22:11 2016 (r303693) @@ -67,36 +67,44 @@ extern vm_offset_t ccsrbar_va; /* * Local access registers */ -#if defined(QORIQ_DPAA) /* Write order: OCP_LAWBARH -> OCP_LAWBARL -> OCP_LAWSR */ #define OCP85XX_LAWBARH(n) (CCSRBAR_VA + 0xc00 + 0x10 * (n)) #define OCP85XX_LAWBARL(n) (CCSRBAR_VA + 0xc04 + 0x10 * (n)) -#define OCP85XX_LAWSR(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) -#else +#define OCP85XX_LAWSR_QORIQ(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) #define OCP85XX_LAWBAR(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) -#define OCP85XX_LAWSR(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n)) -#endif +#define OCP85XX_LAWSR_85XX(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n)) +#define OCP85XX_LAWSR(n) (mpc85xx_is_qoriq() ? OCP85XX_LAWSR_QORIQ(n) : \ + OCP85XX_LAWSR_85XX(n)) /* Attribute register */ #define OCP85XX_ENA_MASK 0x80000000 #define OCP85XX_DIS_MASK 0x7fffffff -#if defined(QORIQ_DPAA) -#define OCP85XX_TGTIF_LBC 0x1f -#define OCP85XX_TGTIF_RAM_INTL 0x14 -#define OCP85XX_TGTIF_RAM1 0x10 -#define OCP85XX_TGTIF_RAM2 0x11 -#define OCP85XX_TGTIF_BMAN 0x18 -#define OCP85XX_TGTIF_DCSR 0x1D -#define OCP85XX_TGTIF_QMAN 0x3C -#define OCP85XX_TRGT_SHIFT 20 -#else -#define OCP85XX_TGTIF_LBC 0x04 -#define OCP85XX_TGTIF_RAM_INTL 0x0b -#define OCP85XX_TGTIF_RIO 0x0c -#define OCP85XX_TGTIF_RAM1 0x0f -#define OCP85XX_TGTIF_RAM2 0x16 -#endif +#define OCP85XX_TGTIF_LBC_QORIQ 0x1f +#define OCP85XX_TGTIF_RAM_INTL_QORIQ 0x14 +#define OCP85XX_TGTIF_RAM1_QORIQ 0x10 +#define OCP85XX_TGTIF_RAM2_QORIQ 0x11 +#define OCP85XX_TGTIF_BMAN 0x18 +#define OCP85XX_TGTIF_DCSR 0x1D +#define OCP85XX_TGTIF_QMAN 0x3C +#define OCP85XX_TRGT_SHIFT_QORIQ 20 + +#define OCP85XX_TGTIF_LBC_85XX 0x04 +#define OCP85XX_TGTIF_RAM_INTL_85XX 0x0b +#define OCP85XX_TGTIF_RIO_85XX 0x0c +#define OCP85XX_TGTIF_RAM1_85XX 0x0f +#define OCP85XX_TGTIF_RAM2_85XX 0x16 + +#define OCP85XX_TGTIF_LBC \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_LBC_QORIQ : OCP85XX_TGTIF_LBC_85XX) +#define OCP85XX_TGTIF_RAM_INTL \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM_INTL_QORIQ : OCP85XX_TGTIF_RAM_INTL_85XX) +#define OCP85XX_TGTIF_RIO \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RIO_QORIQ : OCP85XX_TGTIF_RIO_85XX) +#define OCP85XX_TGTIF_RAM1 \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM1_QORIQ : OCP85XX_TGTIF_RAM1_85XX) +#define OCP85XX_TGTIF_RAM2 \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM2_QORIQ : OCP85XX_TGTIF_RAM2_85XX) /* * L2 cache registers @@ -153,5 +161,6 @@ int mpc85xx_attach(platform_t); void mpc85xx_enable_l3_cache(void); void mpc85xx_fix_errata(vm_offset_t); void dataloss_erratum_access(vm_offset_t, uint32_t); +int mpc85xx_is_qoriq(void); #endif /* _MPC85XX_H_ */ Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Wed Aug 3 01:22:11 2016 (r303693) @@ -655,7 +655,8 @@ fsl_pcib_inbound(struct fsl_pcib_softc * switch (tgt) { /* XXX OCP85XX_TGTIF_RAM2, OCP85XX_TGTIF_RAM_INTL should be handled */ - case OCP85XX_TGTIF_RAM1: + case OCP85XX_TGTIF_RAM1_85XX: + case OCP85XX_TGTIF_RAM1_QORIQ: attr = 0xa0f55000 | (ffsl(size) - 2); break; default: Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Aug 3 01:19:10 2016 (r303692) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Wed Aug 3 01:22:11 2016 (r303693) @@ -258,16 +258,17 @@ mpc85xx_timebase_freq(platform_t plat, s sizeof(freq)) <= 0) goto out; + if (freq == 0) + goto out; + /* * Time Base and Decrementer are updated every 8 CCB bus clocks. * HID0[SEL_TBCLK] = 0 */ - if (freq != 0) -#ifdef QORIQ_DPAA + if (mpc85xx_is_qoriq()) ticks = freq / 32; -#else + else ticks = freq / 8; -#endif out: if (ticks <= 0) @@ -324,24 +325,24 @@ mpc85xx_smp_start_cpu(platform_t plat, s int timeout; uintptr_t brr; int cpuid; - -#ifdef QORIQ_DPAA uint32_t tgt; - reg = ccsr_read4(OCP85XX_COREDISR); - cpuid = pc->pc_cpuid; - - if ((reg & cpuid) != 0) { - printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); - return (-1); + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_COREDISR); + cpuid = pc->pc_cpuid; + + if ((reg & (1 << cpuid)) != 0) { + printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); + return (-1); + } + + brr = OCP85XX_BRR; + } else { + brr = OCP85XX_EEBPCR; + cpuid = pc->pc_cpuid + 24; } - - brr = OCP85XX_BRR; -#else /* QORIQ_DPAA */ - brr = OCP85XX_EEBPCR; - cpuid = pc->pc_cpuid + 24; -#endif bp_kernload = kernload; + reg = ccsr_read4(brr); if ((reg & (1 << cpuid)) != 0) { printf("SMP: CPU %d already out of hold-off state!\n", @@ -358,55 +359,52 @@ mpc85xx_smp_start_cpu(platform_t plat, s bptr = ((vm_paddr_t)(uintptr_t)__boot_page - KERNBASE) + kernload; KASSERT((bptr & 0xfff) == 0, ("%s: boot page is not aligned (%#jx)", __func__, (uintmax_t)bptr)); -#ifdef QORIQ_DPAA - - /* - * Read DDR controller configuration to select proper BPTR target ID. - * - * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers - * interleaving. If this bit is set, we have to use - * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, - * this bit is reserved and always 0. - */ - - reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); - if (reg & (1 << 29)) - tgt = OCP85XX_TGTIF_RAM_INTL; - else - tgt = OCP85XX_TGTIF_RAM1; - - /* - * Set BSTR to the physical address of the boot page - */ - ccsr_write4(OCP85XX_BSTRH, bptr >> 32); - ccsr_write4(OCP85XX_BSTRL, bptr); - ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | - (tgt << OCP85XX_TRGT_SHIFT) | (ffsl(PAGE_SIZE) - 2)); - - /* Read back OCP85XX_BSTAR to synchronize write */ - ccsr_read4(OCP85XX_BSTAR); - - /* - * Enable and configure time base on new CPU. - */ - - /* Set TB clock source to platform clock / 32 */ - reg = ccsr_read4(CCSR_CTBCKSELR); - ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); - - /* Enable TB */ - reg = ccsr_read4(CCSR_CTBENR); - ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); -#else - - /* - * Set BPTR to the physical address of the boot page - */ - bptr = (bptr >> 12) | 0x80000000u; - ccsr_write4(OCP85XX_BPTR, bptr); - __asm __volatile("isync; msync"); - -#endif /* QORIQ_DPAA */ + if (mpc85xx_is_qoriq()) { + /* + * Read DDR controller configuration to select proper BPTR target ID. + * + * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers + * interleaving. If this bit is set, we have to use + * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, + * this bit is reserved and always 0. + */ + + reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); + if (reg & (1 << 29)) + tgt = OCP85XX_TGTIF_RAM_INTL; + else + tgt = OCP85XX_TGTIF_RAM1; + + /* + * Set BSTR to the physical address of the boot page + */ + ccsr_write4(OCP85XX_BSTRH, bptr >> 32); + ccsr_write4(OCP85XX_BSTRL, bptr); + ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | + (tgt << OCP85XX_TRGT_SHIFT_QORIQ) | (ffsl(PAGE_SIZE) - 2)); + + /* Read back OCP85XX_BSTAR to synchronize write */ + ccsr_read4(OCP85XX_BSTAR); + + /* + * Enable and configure time base on new CPU. + */ + + /* Set TB clock source to platform clock / 32 */ + reg = ccsr_read4(CCSR_CTBCKSELR); + ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); + + /* Enable TB */ + reg = ccsr_read4(CCSR_CTBENR); + ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); + } else { + /* + * Set BPTR to the physical address of the boot page + */ + bptr = (bptr >> 12) | 0x80000000u; + ccsr_write4(OCP85XX_BPTR, bptr); + __asm __volatile("isync; msync"); + } /* * Release AP from hold-off state @@ -424,15 +422,14 @@ mpc85xx_smp_start_cpu(platform_t plat, s * address (= 0xfffff000) isn't permanently remapped and thus not * usable otherwise. */ -#ifdef QORIQ_DPAA - ccsr_write4(OCP85XX_BSTAR, 0); -#else - ccsr_write4(OCP85XX_BPTR, 0); -#endif + if (mpc85xx_is_qoriq()) + ccsr_write4(OCP85XX_BSTAR, 0); + else + ccsr_write4(OCP85XX_BPTR, 0); __asm __volatile("isync; msync"); if (!pc->pc_awake) - printf("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); + panic("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); return ((pc->pc_awake) ? 0 : EBUSY); #else /* No SMP support */ @@ -469,33 +466,32 @@ mpc85xx_reset(platform_t plat) static void mpc85xx_idle(platform_t plat, int cpu) { -#ifdef QORIQ_DPAA uint32_t reg; - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); -#else - register_t msr; - - msr = mfmsr(); - /* Freescale E500 core RM section 6.4.1. */ - __asm __volatile("msync; mtmsr %0; isync" :: - "r" (msr | PSL_WE)); -#endif + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + } else { + reg = mfmsr(); + /* Freescale E500 core RM section 6.4.1. */ + __asm __volatile("msync; mtmsr %0; isync" :: + "r" (reg | PSL_WE)); + } } static int mpc85xx_idle_wakeup(platform_t plat, int cpu) { -#ifdef QORIQ_DPAA uint32_t reg; - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + + return (1); + } - return (1); -#endif return (0); } From owner-svn-src-head@freebsd.org Wed Aug 3 01:46:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDEBFBAC470; Wed, 3 Aug 2016 01:46:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DC5E1C95; Wed, 3 Aug 2016 01:46:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u731ktqX026130; Wed, 3 Aug 2016 01:46:55 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u731ktHN026129; Wed, 3 Aug 2016 01:46:55 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201608030146.u731ktHN026129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 3 Aug 2016 01:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303696 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 01:46:57 -0000 Author: jhibbits Date: Wed Aug 3 01:46:55 2016 New Revision: 303696 URL: https://svnweb.freebsd.org/changeset/base/303696 Log: Remove a duplicate PMC CPU number CPU number for MPC85XX is a duplicate for E500. Since we don't support MPC85XX "uncore" registers right now, rather than renumbering it simply remove it, and it will properly use the E500 CPU ID. Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Wed Aug 3 01:26:02 2016 (r303695) +++ head/sys/sys/pmc.h Wed Aug 3 01:46:55 2016 (r303696) @@ -105,7 +105,6 @@ __PMC_CPU(MIPS_74K, 0x202, "MIPS 74K") \ __PMC_CPU(PPC_7450, 0x300, "PowerPC MPC7450") \ __PMC_CPU(PPC_E500, 0x340, "PowerPC e500 Core") \ - __PMC_CPU(PPC_MPC85XX, 0x340, "Freescale PowerPC MPC85XX") \ __PMC_CPU(PPC_970, 0x380, "IBM PowerPC 970") \ __PMC_CPU(GENERIC, 0x400, "Generic") \ __PMC_CPU(ARMV7_CORTEX_A5, 0x500, "ARMv7 Cortex A5") \ From owner-svn-src-head@freebsd.org Wed Aug 3 06:33:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08356BAB519; Wed, 3 Aug 2016 06:33:07 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 772641BF5; Wed, 3 Aug 2016 06:33:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u736X4pn032807; Wed, 3 Aug 2016 06:33:04 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u736X4N3032803; Wed, 3 Aug 2016 06:33:04 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201608030633.u736X4N3032803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 3 Aug 2016 06:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303699 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 06:33:07 -0000 Author: ed Date: Wed Aug 3 06:33:04 2016 New Revision: 303699 URL: https://svnweb.freebsd.org/changeset/base/303699 Log: mprotect(): Change prototype to comply to POSIX. Our mprotect() function seems to take a "const void *" address to the pages whose permissions need to be adjusted. POSIX uses "void *". Simply stick to the POSIX one to prevent us from writing unportable code. PR: 211423 (exp-run) Tested by: antoine@ (Thanks!) Modified: head/lib/libc/sys/mprotect.2 head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master head/sys/sys/mman.h Modified: head/lib/libc/sys/mprotect.2 ============================================================================== --- head/lib/libc/sys/mprotect.2 Wed Aug 3 06:32:44 2016 (r303698) +++ head/lib/libc/sys/mprotect.2 Wed Aug 3 06:33:04 2016 (r303699) @@ -28,7 +28,7 @@ .\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd August 3, 2016 .Dt MPROTECT 2 .Os .Sh NAME @@ -39,7 +39,7 @@ .Sh SYNOPSIS .In sys/mman.h .Ft int -.Fn mprotect "const void *addr" "size_t len" "int prot" +.Fn mprotect "void *addr" "size_t len" "int prot" .Sh DESCRIPTION The .Fn mprotect Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Aug 3 06:32:44 2016 (r303698) +++ head/sys/compat/freebsd32/syscalls.master Wed Aug 3 06:33:04 2016 (r303699) @@ -174,7 +174,7 @@ 72 AUE_O_VADVISE NOPROTO { int ovadvise(int anom); } vadvise \ ovadvise_args int 73 AUE_MUNMAP NOPROTO { int munmap(void *addr, size_t len); } -74 AUE_MPROTECT STD { int freebsd32_mprotect(const void *addr, \ +74 AUE_MPROTECT STD { int freebsd32_mprotect(void *addr, \ size_t len, int prot); } 75 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \ int behav); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Aug 3 06:32:44 2016 (r303698) +++ head/sys/kern/syscalls.master Wed Aug 3 06:33:04 2016 (r303699) @@ -175,7 +175,7 @@ 72 AUE_O_VADVISE STD { int ovadvise(int anom); } vadvise \ ovadvise_args int 73 AUE_MUNMAP STD { int munmap(void *addr, size_t len); } -74 AUE_MPROTECT STD { int mprotect(const void *addr, size_t len, \ +74 AUE_MPROTECT STD { int mprotect(void *addr, size_t len, int prot); } 75 AUE_MADVISE STD { int madvise(void *addr, size_t len, \ int behav); } Modified: head/sys/sys/mman.h ============================================================================== --- head/sys/sys/mman.h Wed Aug 3 06:32:44 2016 (r303698) +++ head/sys/sys/mman.h Wed Aug 3 06:33:04 2016 (r303699) @@ -258,7 +258,7 @@ int mlock(const void *, size_t); #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif -int mprotect(const void *, size_t, int); +int mprotect(void *, size_t, int); int msync(void *, size_t, int); int munlock(const void *, size_t); int munmap(void *, size_t); From owner-svn-src-head@freebsd.org Wed Aug 3 06:35:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C928ABAB5D2; Wed, 3 Aug 2016 06:35:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 959051DE5; Wed, 3 Aug 2016 06:35:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u736ZwMH032953; Wed, 3 Aug 2016 06:35:58 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u736ZwcI032952; Wed, 3 Aug 2016 06:35:58 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201608030635.u736ZwcI032952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 3 Aug 2016 06:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303700 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 06:35:59 -0000 Author: ed Date: Wed Aug 3 06:35:58 2016 New Revision: 303700 URL: https://svnweb.freebsd.org/changeset/base/303700 Log: Re-add traling slash that was removed in r303699. I must have accidentally pressed some random key in vim. Modified: head/sys/kern/syscalls.master Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Aug 3 06:33:04 2016 (r303699) +++ head/sys/kern/syscalls.master Wed Aug 3 06:35:58 2016 (r303700) @@ -175,7 +175,7 @@ 72 AUE_O_VADVISE STD { int ovadvise(int anom); } vadvise \ ovadvise_args int 73 AUE_MUNMAP STD { int munmap(void *addr, size_t len); } -74 AUE_MPROTECT STD { int mprotect(void *addr, size_t len, +74 AUE_MPROTECT STD { int mprotect(void *addr, size_t len, \ int prot); } 75 AUE_MADVISE STD { int madvise(void *addr, size_t len, \ int behav); } From owner-svn-src-head@freebsd.org Wed Aug 3 06:36:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9445BAB651; Wed, 3 Aug 2016 06:36:47 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6752B1F54; Wed, 3 Aug 2016 06:36:47 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u736akW9033032; Wed, 3 Aug 2016 06:36:46 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u736ajJR033021; Wed, 3 Aug 2016 06:36:45 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201608030636.u736ajJR033021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 3 Aug 2016 06:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303701 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 06:36:47 -0000 Author: ed Date: Wed Aug 3 06:36:45 2016 New Revision: 303701 URL: https://svnweb.freebsd.org/changeset/base/303701 Log: Regenerate system call tables for r303699 and r303700. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/compat/freebsd32/freebsd32_proto.h Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 2016-08-03 06:33:04Z ed */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -82,7 +82,7 @@ struct freebsd32_execve_args { char envv_l_[PADL_(uint32_t *)]; uint32_t * envv; char envv_r_[PADR_(uint32_t *)]; }; struct freebsd32_mprotect_args { - char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; }; Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 2016-08-03 06:33:04Z ed */ #define FREEBSD32_SYS_syscall 0 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 2016-08-03 06:33:04Z ed */ const char *freebsd32_syscallnames[] = { Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 2016-08-03 06:33:04Z ed */ #include "opt_compat.h" Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Aug 3 06:36:45 2016 (r303701) @@ -462,7 +462,7 @@ systrace_args(int sysnum, void *params, /* freebsd32_mprotect */ case 74: { struct freebsd32_mprotect_args *p = params; - uarg[0] = (intptr_t) p->addr; /* const void * */ + uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->prot; /* int */ *n_args = 3; @@ -4020,7 +4020,7 @@ systrace_entry_setargdesc(int sysnum, in case 74: switch(ndx) { case 0: - p = "const void *"; + p = "void *"; break; case 1: p = "size_t"; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/kern/init_sysent.c Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303435 2016-07-28 12:22:01Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed */ #include "opt_compat.h" Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/kern/syscalls.c Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303435 2016-07-28 12:22:01Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed */ const char *syscallnames[] = { Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/kern/systrace_args.c Wed Aug 3 06:36:45 2016 (r303701) @@ -459,7 +459,7 @@ systrace_args(int sysnum, void *params, /* mprotect */ case 74: { struct mprotect_args *p = params; - uarg[0] = (intptr_t) p->addr; /* const void * */ + uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->prot; /* int */ *n_args = 3; @@ -4027,7 +4027,7 @@ systrace_entry_setargdesc(int sysnum, in case 74: switch(ndx) { case 0: - p = "const void *"; + p = "void *"; break; case 1: p = "size_t"; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/sys/syscall.h Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303435 2016-07-28 12:22:01Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed */ #define SYS_syscall 0 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/sys/syscall.mk Wed Aug 3 06:36:45 2016 (r303701) @@ -1,7 +1,7 @@ # FreeBSD system call object files. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 303435 2016-07-28 12:22:01Z ed +# created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed MIASM = \ syscall.o \ exit.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Wed Aug 3 06:35:58 2016 (r303700) +++ head/sys/sys/sysproto.h Wed Aug 3 06:36:45 2016 (r303701) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303435 2016-07-28 12:22:01Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed */ #ifndef _SYS_SYSPROTO_H_ @@ -277,7 +277,7 @@ struct munmap_args { char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; }; struct mprotect_args { - char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; }; From owner-svn-src-head@freebsd.org Wed Aug 3 07:10:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B76ECBABCD6; Wed, 3 Aug 2016 07:10:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89FF61C4B; Wed, 3 Aug 2016 07:10:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u737A9sc044844; Wed, 3 Aug 2016 07:10:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u737A90m044843; Wed, 3 Aug 2016 07:10:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608030710.u737A90m044843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 07:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303702 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 07:10:10 -0000 Author: kib Date: Wed Aug 3 07:10:09 2016 New Revision: 303702 URL: https://svnweb.freebsd.org/changeset/base/303702 Log: Remove mention of the Giant from the fork_return() description. Making emphasis on this lock in the core function comment is confusing for the modern kernel. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Wed Aug 3 06:36:45 2016 (r303701) +++ head/sys/kern/kern_fork.c Wed Aug 3 07:10:09 2016 (r303702) @@ -1055,9 +1055,9 @@ fork_exit(void (*callout)(void *, struct /* * Simplified back end of syscall(), used when returning from fork() - * directly into user mode. Giant is not held on entry, and must not - * be held on return. This function is passed in to fork_exit() as the - * first parameter and is called when returning to a new userland process. + * directly into user mode. This function is passed in to fork_exit() + * as the first parameter and is called when returning to a new + * userland process. */ void fork_return(struct thread *td, struct trapframe *frame) From owner-svn-src-head@freebsd.org Wed Aug 3 07:11:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4026BABD6A; Wed, 3 Aug 2016 07:11:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B55FD1E57; Wed, 3 Aug 2016 07:11:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u737BJqI047715; Wed, 3 Aug 2016 07:11:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u737BJMS047714; Wed, 3 Aug 2016 07:11:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608030711.u737BJMS047714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 07:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303703 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 07:11:21 -0000 Author: kib Date: Wed Aug 3 07:11:19 2016 New Revision: 303703 URL: https://svnweb.freebsd.org/changeset/base/303703 Log: Explain why swapgeom_close_ev() is delegated. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Wed Aug 3 07:10:09 2016 (r303702) +++ head/sys/vm/swap_pager.c Wed Aug 3 07:11:19 2016 (r303703) @@ -2431,8 +2431,9 @@ swapgeom_acquire(struct g_consumer *cp) } /* - * Remove a reference from the g_consumer. Post a close event if - * all references go away. + * Remove a reference from the g_consumer. Post a close event if all + * references go away, since the function might be called from the + * biodone context. */ static void swapgeom_release(struct g_consumer *cp, struct swdevt *sp) @@ -2555,7 +2556,12 @@ swapgeom_close(struct thread *td, struct cp = sw->sw_id; sw->sw_id = NULL; mtx_unlock(&sw_dev_mtx); - /* XXX: direct call when Giant untangled */ + + /* + * swapgeom_close() may be called from the biodone context, + * where we cannot perform topology changes. Delegate the + * work to the events thread. + */ if (cp != NULL) g_waitfor_event(swapgeom_close_ev, cp, M_WAITOK, NULL); } From owner-svn-src-head@freebsd.org Wed Aug 3 08:53:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77B2CBAD773; Wed, 3 Aug 2016 08:53:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F03C1A29; Wed, 3 Aug 2016 08:53:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u738rT6s085198; Wed, 3 Aug 2016 08:53:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u738rTA4085196; Wed, 3 Aug 2016 08:53:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608030853.u738rTA4085196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 08:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303704 - head/sys/fs/pseudofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 08:53:30 -0000 Author: kib Date: Wed Aug 3 08:53:29 2016 New Revision: 303704 URL: https://svnweb.freebsd.org/changeset/base/303704 Log: Some style changes. Fix a typo in comment. Approved by: des (pseudofs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/pseudofs/pseudofs.c head/sys/fs/pseudofs/pseudofs.h Modified: head/sys/fs/pseudofs/pseudofs.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs.c Wed Aug 3 07:11:19 2016 (r303703) +++ head/sys/fs/pseudofs/pseudofs.c Wed Aug 3 08:53:29 2016 (r303704) @@ -387,7 +387,7 @@ pfs_init(struct pfs_info *pi, struct vfs pfs_fileno_init(pi); - /* set up the root diretory */ + /* set up the root directory */ root = pfs_alloc_node(pi, "/", pfstype_root); pi->pi_root = root; pfs_fileno_alloc(root); Modified: head/sys/fs/pseudofs/pseudofs.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs.h Wed Aug 3 07:11:19 2016 (r303703) +++ head/sys/fs/pseudofs/pseudofs.h Wed Aug 3 08:53:29 2016 (r303704) @@ -198,7 +198,7 @@ struct pfs_info { pfs_init_t pi_init; pfs_init_t pi_uninit; - /* members below this line are initialized at run time*/ + /* members below this line are initialized at run time */ struct pfs_node *pi_root; struct mtx pi_mutex; struct unrhdr *pi_unrhdr; @@ -285,17 +285,17 @@ static int \ _##name##_mount(struct mount *mp) { \ if (jflag && !prison_allow(curthread->td_ucred, jflag)) \ return (EPERM); \ - return pfs_mount(&name##_info, mp); \ + return (pfs_mount(&name##_info, mp)); \ } \ \ static int \ _##name##_init(struct vfsconf *vfc) { \ - return pfs_init(&name##_info, vfc); \ + return (pfs_init(&name##_info, vfc)); \ } \ \ static int \ _##name##_uninit(struct vfsconf *vfc) { \ - return pfs_uninit(&name##_info, vfc); \ + return (pfs_uninit(&name##_info, vfc)); \ } \ \ static struct vfsops name##_vfsops = { \ From owner-svn-src-head@freebsd.org Wed Aug 3 08:57:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2741BBAD802; Wed, 3 Aug 2016 08:57:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 037461C48; Wed, 3 Aug 2016 08:57:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u738vGZV085390; Wed, 3 Aug 2016 08:57:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u738vFbF085386; Wed, 3 Aug 2016 08:57:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608030857.u738vFbF085386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 08:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303705 - head/sys/fs/pseudofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 08:57:17 -0000 Author: kib Date: Wed Aug 3 08:57:15 2016 New Revision: 303705 URL: https://svnweb.freebsd.org/changeset/base/303705 Log: Remove Giant asserts. Update comment. Owning Giant in the init/uninit is accidental due to the moment where VFS modules initialization is performed, and is not enforced by the VFS interface. The Giant lock does not prevent a parallel execution of the code, it is VFS which implements the proper protocol. Approved by: des (pseudofs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/pseudofs/pseudofs.c head/sys/fs/pseudofs/pseudofs.h head/sys/fs/pseudofs/pseudofs_fileno.c head/sys/fs/pseudofs/pseudofs_vncache.c Modified: head/sys/fs/pseudofs/pseudofs.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs.c Wed Aug 3 08:53:29 2016 (r303704) +++ head/sys/fs/pseudofs/pseudofs.c Wed Aug 3 08:57:15 2016 (r303705) @@ -383,8 +383,6 @@ pfs_init(struct pfs_info *pi, struct vfs struct pfs_node *root; int error; - mtx_assert(&Giant, MA_OWNED); - pfs_fileno_init(pi); /* set up the root directory */ @@ -414,8 +412,6 @@ pfs_uninit(struct pfs_info *pi, struct v { int error; - mtx_assert(&Giant, MA_OWNED); - pfs_destroy(pi->pi_root); pi->pi_root = NULL; pfs_fileno_uninit(pi); Modified: head/sys/fs/pseudofs/pseudofs.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs.h Wed Aug 3 08:53:29 2016 (r303704) +++ head/sys/fs/pseudofs/pseudofs.h Wed Aug 3 08:57:15 2016 (r303705) @@ -189,9 +189,9 @@ typedef int (*pfs_destroy_t)(PFS_DESTROY /* * pfs_info: describes a pseudofs instance * - * The pi_mutex is only used to avoid using the global subr_unit lock for - * unrhdr. The rest of struct pfs_info is only modified while Giant is - * held (during vfs_init() and vfs_uninit()). + * The pi_mutex is only used to avoid using the global subr_unit lock + * for unrhdr. The rest of struct pfs_info is only modified during + * vfs_init() and vfs_uninit() of the consumer filesystem. */ struct pfs_info { char pi_name[PFS_FSNAMELEN]; Modified: head/sys/fs/pseudofs/pseudofs_fileno.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_fileno.c Wed Aug 3 08:53:29 2016 (r303704) +++ head/sys/fs/pseudofs/pseudofs_fileno.c Wed Aug 3 08:57:15 2016 (r303705) @@ -52,7 +52,6 @@ void pfs_fileno_init(struct pfs_info *pi) { - mtx_assert(&Giant, MA_OWNED); mtx_init(&pi->pi_mutex, "pfs_fileno", NULL, MTX_DEF); pi->pi_unrhdr = new_unrhdr(3, INT_MAX / NO_PID, &pi->pi_mutex); } @@ -64,7 +63,6 @@ void pfs_fileno_uninit(struct pfs_info *pi) { - mtx_assert(&Giant, MA_OWNED); delete_unrhdr(pi->pi_unrhdr); pi->pi_unrhdr = NULL; mtx_destroy(&pi->pi_mutex); Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Wed Aug 3 08:53:29 2016 (r303704) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Wed Aug 3 08:57:15 2016 (r303705) @@ -84,7 +84,6 @@ void pfs_vncache_load(void) { - mtx_assert(&Giant, MA_OWNED); mtx_init(&pfs_vncache_mutex, "pfs_vncache", NULL, MTX_DEF); pfs_exit_tag = EVENTHANDLER_REGISTER(process_exit, pfs_exit, NULL, EVENTHANDLER_PRI_ANY); @@ -97,7 +96,6 @@ void pfs_vncache_unload(void) { - mtx_assert(&Giant, MA_OWNED); EVENTHANDLER_DEREGISTER(process_exit, pfs_exit_tag); KASSERT(pfs_vncache_entries == 0, ("%d vncache entries remaining", pfs_vncache_entries)); From owner-svn-src-head@freebsd.org Wed Aug 3 09:09:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5848BADC55; Wed, 3 Aug 2016 09:09:35 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79A351374; Wed, 3 Aug 2016 09:09:35 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7399YNk089352; Wed, 3 Aug 2016 09:09:34 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7399YF4089351; Wed, 3 Aug 2016 09:09:34 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608030909.u7399YF4089351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 3 Aug 2016 09:09:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303706 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 09:09:35 -0000 Author: ache Date: Wed Aug 3 09:09:34 2016 New Revision: 303706 URL: https://svnweb.freebsd.org/changeset/base/303706 Log: Although the code amount is not big, move POSIX error processing into two sepatate functions to make glob(3) code less obscure and more simple. There is no needs to make them inline since it is error path which supposed to not happes often. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Wed Aug 3 08:57:15 2016 (r303705) +++ head/lib/libc/gen/glob.c Wed Aug 3 09:09:34 2016 (r303706) @@ -177,6 +177,8 @@ static int globexp2(const Char *, const static int globfinal(glob_t *, struct glob_limit *, size_t, const char *); static int match(Char *, Char *, Char *); +static int err_nomatch(glob_t *, struct glob_limit *, const char *); +static int err_aborted(glob_t *, int, char *); #ifdef DEBUG static void qprintf(const char *, Char *); #endif @@ -217,8 +219,7 @@ glob(const char * __restrict pattern, in while (bufnext <= bufend) { clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) - return (globfinal(pglob, &limit, - pglob->gl_pathc, pattern)); + return (err_nomatch(pglob, &limit, pattern)); else if (clen == 0) { too_long = 0; break; @@ -240,8 +241,7 @@ glob(const char * __restrict pattern, in prot = 0; clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) - return (globfinal(pglob, &limit, - pglob->gl_pathc, pattern)); + return (err_nomatch(pglob, &limit, pattern)); else if (clen == 0) { too_long = 0; break; @@ -251,7 +251,7 @@ glob(const char * __restrict pattern, in } } if (too_long) - return (globfinal(pglob, &limit, pglob->gl_pathc, pattern)); + return (err_nomatch(pglob, &limit, pattern)); *bufnext = EOS; if (flags & GLOB_BRACE) @@ -608,20 +608,9 @@ glob0(const Char *pattern, glob_t *pglob static int globfinal(glob_t *pglob, struct glob_limit *limit, size_t oldpathc, const char *origpat) { - /* - * If there was no match we are going to append the origpat - * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified - * and the origpat did not contain any magic characters - * GLOB_NOMAGIC is there just for compatibility with csh. - */ - if (pglob->gl_pathc == oldpathc) { - if ((pglob->gl_flags & GLOB_NOCHECK) || - ((pglob->gl_flags & GLOB_NOMAGIC) && - !(pglob->gl_flags & GLOB_MAGCHAR))) - return (globextend(NULL, pglob, limit, origpat)); - else - return (GLOB_NOMATCH); - } + if (pglob->gl_pathc == oldpathc) + return (err_nomatch(pglob, limit, origpat)); + if (!(pglob->gl_flags & GLOB_NOSORT)) qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, pglob->gl_pathc - oldpathc, sizeof(char *), compare); @@ -750,16 +739,10 @@ glob3(Char *pathbuf, Char *pathend, Char if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { if (errno == ENOENT || errno == ENOTDIR) return (0); - if ((pglob->gl_errfunc != NULL && - pglob->gl_errfunc(buf, errno)) || - (pglob->gl_flags & GLOB_ERR)) { - if (errno == 0) - errno = saverrno; - return (GLOB_ABORTED); - } + err = err_aborted(pglob, errno, buf); if (errno == 0) errno = saverrno; - return (0); + return (err); } err = 0; @@ -809,11 +792,9 @@ glob3(Char *pathbuf, Char *pathend, Char } sc += clen; } - if (too_long && ((pglob->gl_errfunc != NULL && - pglob->gl_errfunc(buf, ENAMETOOLONG)) || - (pglob->gl_flags & GLOB_ERR))) { + if (too_long && (err = err_aborted(pglob, ENAMETOOLONG, + buf))) { errno = ENAMETOOLONG; - err = GLOB_ABORTED; break; } if (too_long || !match(pathend, pattern, restpattern)) { @@ -840,9 +821,9 @@ glob3(Char *pathbuf, Char *pathend, Char if (err) return (err); - if (dp == NULL && errno != 0 && ((pglob->gl_errfunc != NULL && - pglob->gl_errfunc(buf, errno)) || (pglob->gl_flags & GLOB_ERR))) - return (GLOB_ABORTED); + if (dp == NULL && errno != 0 && + (err = err_aborted(pglob, errno, buf))) + return (err); if (errno == 0) errno = saverrno; @@ -1079,6 +1060,29 @@ g_Ctoc(const Char *str, char *buf, size_ return (1); } +static int +err_nomatch(glob_t *pglob, struct glob_limit *limit, const char *origpat) { + /* + * If there was no match we are going to append the origpat + * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified + * and the origpat did not contain any magic characters + * GLOB_NOMAGIC is there just for compatibility with csh. + */ + if ((pglob->gl_flags & GLOB_NOCHECK) || + ((pglob->gl_flags & GLOB_NOMAGIC) && + !(pglob->gl_flags & GLOB_MAGCHAR))) + return (globextend(NULL, pglob, limit, origpat)); + return (GLOB_NOMATCH); +} + +static int +err_aborted(glob_t *pglob, int err, char *buf) { + if ((pglob->gl_errfunc != NULL && pglob->gl_errfunc(buf, err)) || + (pglob->gl_flags & GLOB_ERR)) + return (GLOB_ABORTED); + return (0); +} + #ifdef DEBUG static void qprintf(const char *str, Char *s) From owner-svn-src-head@freebsd.org Wed Aug 3 09:15:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A8ABBADE2A; Wed, 3 Aug 2016 09:15:11 +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 17E0618E3; Wed, 3 Aug 2016 09:15:11 +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 u739FAOn092947; Wed, 3 Aug 2016 09:15:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u739FAqK092946; Wed, 3 Aug 2016 09:15:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201608030915.u739FAqK092946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 3 Aug 2016 09:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303707 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 09:15:11 -0000 Author: mjg Date: Wed Aug 3 09:15:10 2016 New Revision: 303707 URL: https://svnweb.freebsd.org/changeset/base/303707 Log: locks: fix sx compilation on mips after r303643 The kernel.h header is required for the SYSINIT macro, which apparently was present on amd64 by accident. Reported by: kib Modified: head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Wed Aug 3 09:09:34 2016 (r303706) +++ head/sys/kern/kern_sx.c Wed Aug 3 09:15:10 2016 (r303707) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Wed Aug 3 11:49:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8072BBACEDA; Wed, 3 Aug 2016 11:49:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 531E91989; Wed, 3 Aug 2016 11:49:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73BnHKV049333; Wed, 3 Aug 2016 11:49:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73BnHOt049332; Wed, 3 Aug 2016 11:49:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608031149.u73BnHOt049332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 11:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303710 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 11:49:18 -0000 Author: kib Date: Wed Aug 3 11:49:17 2016 New Revision: 303710 URL: https://svnweb.freebsd.org/changeset/base/303710 Log: Remove unneeded (recursing) Giant acquisition around vprintf(9). Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clsubs.c Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 3 10:23:42 2016 (r303709) +++ head/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 3 11:49:17 2016 (r303710) @@ -166,11 +166,9 @@ ncl_printf(const char *fmt, ...) { va_list ap; - mtx_lock(&Giant); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); - mtx_unlock(&Giant); } #ifdef NFS_ACDEBUG @@ -197,9 +195,6 @@ ncl_getattrcache(struct vnode *vp, struc vap = &np->n_vattr.na_vattr; nmp = VFSTONFS(vp->v_mount); mustflush = nfscl_mustflush(vp); /* must be before mtx_lock() */ -#ifdef NFS_ACDEBUG - mtx_lock(&Giant); /* ncl_printf() */ -#endif mtx_lock(&np->n_mtx); /* XXX n_mtime doesn't seem to be updated on a miss-and-reload */ timeo = (time_second - np->n_mtime.tv_sec) / 10; @@ -236,9 +231,6 @@ ncl_getattrcache(struct vnode *vp, struc (mustflush != 0 || np->n_attrstamp == 0)) { newnfsstats.attrcache_misses++; mtx_unlock(&np->n_mtx); -#ifdef NFS_ACDEBUG - mtx_unlock(&Giant); /* ncl_printf() */ -#endif KDTRACE_NFS_ATTRCACHE_GET_MISS(vp); return( ENOENT); } @@ -266,9 +258,6 @@ ncl_getattrcache(struct vnode *vp, struc vaper->va_mtime = np->n_mtim; } mtx_unlock(&np->n_mtx); -#ifdef NFS_ACDEBUG - mtx_unlock(&Giant); /* ncl_printf() */ -#endif KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap); return (0); } From owner-svn-src-head@freebsd.org Wed Aug 3 13:51:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE21CBAD0CC; Wed, 3 Aug 2016 13:51:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA5E91236; Wed, 3 Aug 2016 13:51:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73DprWq004192; Wed, 3 Aug 2016 13:51:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73DprHE004188; Wed, 3 Aug 2016 13:51:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608031351.u73DprHE004188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 13:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303712 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 13:51:54 -0000 Author: kib Date: Wed Aug 3 13:51:53 2016 New Revision: 303712 URL: https://svnweb.freebsd.org/changeset/base/303712 Log: Merge i386 and amd64 variants of mp_watchdog.c into x86/, there is no difference between files. For pc98, put x86/mp_x86.c into the same place as used by i386 file list. Fix typo in comment. Sponsored by: The FreeBSD Foundation MFC after: 1 week Added: head/sys/x86/x86/mp_watchdog.c - copied, changed from r303711, head/sys/amd64/amd64/mp_watchdog.c Deleted: head/sys/amd64/amd64/mp_watchdog.c head/sys/i386/i386/mp_watchdog.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.pc98 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Aug 3 13:19:58 2016 (r303711) +++ head/sys/conf/files.amd64 Wed Aug 3 13:51:53 2016 (r303712) @@ -123,7 +123,6 @@ amd64/amd64/machdep.c standard amd64/amd64/mem.c optional mem amd64/amd64/minidump_machdep.c standard amd64/amd64/mp_machdep.c optional smp -amd64/amd64/mp_watchdog.c optional mp_watchdog smp amd64/amd64/mpboot.S optional smp amd64/amd64/pmap.c standard amd64/amd64/prof_machdep.c optional profiling-routine @@ -621,6 +620,7 @@ x86/x86/mca.c standard x86/x86/mptable.c optional mptable x86/x86/mptable_pci.c optional mptable pci x86/x86/mp_x86.c optional smp +x86/x86/mp_watchdog.c optional mp_watchdog smp x86/x86/msi.c optional pci x86/x86/nexus.c standard x86/x86/pvclock.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Aug 3 13:19:58 2016 (r303711) +++ head/sys/conf/files.i386 Wed Aug 3 13:51:53 2016 (r303712) @@ -481,7 +481,6 @@ i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp -i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard @@ -612,6 +611,7 @@ x86/x86/mca.c standard x86/x86/mptable.c optional apic x86/x86/mptable_pci.c optional apic pci x86/x86/mp_x86.c optional smp +x86/x86/mp_watchdog.c optional mp_watchdog smp x86/x86/msi.c optional apic pci x86/x86/nexus.c standard x86/x86/stack_machdep.c optional ddb | stack Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Wed Aug 3 13:19:58 2016 (r303711) +++ head/sys/conf/files.pc98 Wed Aug 3 13:51:53 2016 (r303712) @@ -168,7 +168,6 @@ i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp -i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard @@ -269,9 +268,10 @@ x86/x86/io_apic.c optional apic x86/x86/legacy.c standard x86/x86/local_apic.c optional apic x86/x86/mca.c standard -x86/x86/mp_x86.c optional smp x86/x86/mptable.c optional apic x86/x86/mptable_pci.c optional apic pci +x86/x86/mp_x86.c optional smp +x86/x86/mp_watchdog.c optional mp_watchdog smp x86/x86/msi.c optional apic pci x86/x86/nexus.c standard x86/x86/stack_machdep.c optional ddb | stack Copied and modified: head/sys/x86/x86/mp_watchdog.c (from r303711, head/sys/amd64/amd64/mp_watchdog.c) ============================================================================== --- head/sys/amd64/amd64/mp_watchdog.c Wed Aug 3 13:19:58 2016 (r303711, copy source) +++ head/sys/x86/x86/mp_watchdog.c Wed Aug 3 13:51:53 2016 (r303712) @@ -92,7 +92,7 @@ watchdog_init(void *arg) /* * This callout resets a timer until the watchdog kicks in. It acquires some - * critical locks to make sure things haven't gotten wedged with hose locks + * critical locks to make sure things haven't gotten wedged with those locks * held. */ static void From owner-svn-src-head@freebsd.org Wed Aug 3 14:02:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B498BAD22B; Wed, 3 Aug 2016 14:02:11 +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 D4ACB17AB; Wed, 3 Aug 2016 14:02:10 +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 u73E1SAl003237 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 3 Aug 2016 17:01:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u73E1SAl003237 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u73E1SD1003236; Wed, 3 Aug 2016 17:01:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 3 Aug 2016 17:01:28 +0300 From: Konstantin Belousov To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303712 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 Message-ID: <20160803140128.GK83214@kib.kiev.ua> References: <201608031351.u73DprHE004188@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201608031351.u73DprHE004188@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 14:02:11 -0000 On Wed, Aug 03, 2016 at 01:51:53PM +0000, Konstantin Belousov wrote: > Merge i386 and amd64 variants of mp_watchdog.c into x86/, there is no > difference between files. May be, the file should be deleted. From owner-svn-src-head@freebsd.org Wed Aug 3 14:15:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD8CABAD7C2; Wed, 3 Aug 2016 14:15:14 +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 535FE1186; Wed, 3 Aug 2016 14:15:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-149.carlnfd1.nsw.optusnet.com.au [110.21.100.149]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id F14DBD47B11; Wed, 3 Aug 2016 23:44:05 +1000 (AEST) Date: Wed, 3 Aug 2016 23:44:04 +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: r303710 - head/sys/fs/nfsclient In-Reply-To: <201608031149.u73BnHOt049332@repo.freebsd.org> Message-ID: <20160803231538.U935@besplex.bde.org> References: <201608031149.u73BnHOt049332@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=XDAe9YG+7EcdVXYrgT+/UQ==:117 a=XDAe9YG+7EcdVXYrgT+/UQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=hVRPeJs9le-o65wS1HUA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 14:15:14 -0000 On Wed, 3 Aug 2016, Konstantin Belousov wrote: > Log: > Remove unneeded (recursing) Giant acquisition around vprintf(9). > > Reviewed by: rmacklem > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/fs/nfsclient/nfs_clsubs.c > > Modified: head/sys/fs/nfsclient/nfs_clsubs.c > ============================================================================== > --- head/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 3 10:23:42 2016 (r303709) > +++ head/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 3 11:49:17 2016 (r303710) > @@ -166,11 +166,9 @@ ncl_printf(const char *fmt, ...) > { > va_list ap; > > - mtx_lock(&Giant); > va_start(ap, fmt); > vprintf(fmt, ap); > va_end(ap); > - mtx_unlock(&Giant); > } > > #ifdef NFS_ACDEBUG This leaves the less than needed function nfs_printf(). Old versions of nfs used the correct function printf(). All nfs_printf() ever did was: - when it was first implemented, almost never work. It had printf(fmt, ap) instead of vprintf(fmt, ap). This only worked when fmt had no % directives in it. Otherwise, it gave undefined behaviour. FreeBSD-7 still has this version. - to hold the Giant locking. This was not completely unneeded. It had the side effect of serializing printfs within nfs. Serialization in -current is normally done using PRINTF_BUFR_SIZE, but this is not the default and it gives deadlocks or drops output so I don't use it. I refined my old fix for serializing printf() and it now works very well. > @@ -197,9 +195,6 @@ ncl_getattrcache(struct vnode *vp, struc > vap = &np->n_vattr.na_vattr; > nmp = VFSTONFS(vp->v_mount); > mustflush = nfscl_mustflush(vp); /* must be before mtx_lock() */ > -#ifdef NFS_ACDEBUG > - mtx_lock(&Giant); /* ncl_printf() */ > -#endif > mtx_lock(&np->n_mtx); > /* XXX n_mtime doesn't seem to be updated on a miss-and-reload */ > timeo = (time_second - np->n_mtime.tv_sec) / 10; > @@ -236,9 +231,6 @@ ncl_getattrcache(struct vnode *vp, struc > (mustflush != 0 || np->n_attrstamp == 0)) { > newnfsstats.attrcache_misses++; > mtx_unlock(&np->n_mtx); > -#ifdef NFS_ACDEBUG > - mtx_unlock(&Giant); /* ncl_printf() */ > -#endif > KDTRACE_NFS_ATTRCACHE_GET_MISS(vp); > return( ENOENT); > } > @@ -266,9 +258,6 @@ ncl_getattrcache(struct vnode *vp, struc > vaper->va_mtime = np->n_mtim; > } > mtx_unlock(&np->n_mtx); > -#ifdef NFS_ACDEBUG > - mtx_unlock(&Giant); /* ncl_printf() */ > -#endif > KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap); > return (0); > } Unfortunately, these are probably still "needed". printf() serialization using PRINTF_BUFR_SIZE or my method only works for individual printf()s or possibly single lines. Just about any lock around a group of printf()s serializes them as a group (only across subsystems using the same lock of course). Bruce From owner-svn-src-head@freebsd.org Wed Aug 3 15:20:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79686BAE8F1; Wed, 3 Aug 2016 15:20:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AC7D1A82; Wed, 3 Aug 2016 15:20:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73FKAtm037474; Wed, 3 Aug 2016 15:20:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73FKACF037473; Wed, 3 Aug 2016 15:20:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608031520.u73FKACF037473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 3 Aug 2016 15:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303713 - head/sys/amd64/vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 15:20:11 -0000 Author: jhb Date: Wed Aug 3 15:20:10 2016 New Revision: 303713 URL: https://svnweb.freebsd.org/changeset/base/303713 Log: Correct assertion on vcpuid argument to vm_gpa_hold(). PR: 208168 Submitted by: Dave Cameron Reviewed by: grehan MFC after: 1 month Modified: head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Wed Aug 3 13:51:53 2016 (r303712) +++ head/sys/amd64/vmm/vmm.c Wed Aug 3 15:20:10 2016 (r303713) @@ -914,7 +914,7 @@ vm_gpa_hold(struct vm *vm, int vcpuid, v * guaranteed if at least one vcpu is in the VCPU_FROZEN state. */ int state; - KASSERT(vcpuid >= -1 || vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", + KASSERT(vcpuid >= -1 && vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", __func__, vcpuid)); for (i = 0; i < VM_MAXCPU; i++) { if (vcpuid != -1 && vcpuid != i) From owner-svn-src-head@freebsd.org Wed Aug 3 15:58:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28B3BBAD5D4; Wed, 3 Aug 2016 15:58:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0691A18A7; Wed, 3 Aug 2016 15:58:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73FwLbt052261; Wed, 3 Aug 2016 15:58:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73FwKbP052257; Wed, 3 Aug 2016 15:58:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608031558.u73FwKbP052257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 Aug 2016 15:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303715 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 15:58:22 -0000 Author: kib Date: Wed Aug 3 15:58:20 2016 New Revision: 303715 URL: https://svnweb.freebsd.org/changeset/base/303715 Log: Remove ncl_printf(), use printf(9) directly. After r303710 the function duplicates printf(). Correct function names in the messages [*]. Noted by: bde [*] Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clsubs.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsnode.h Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed Aug 3 15:39:58 2016 (r303714) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed Aug 3 15:58:20 2016 (r303715) @@ -103,7 +103,7 @@ ncl_getpages(struct vop_getpages_args *a npages = ap->a_count; if ((object = vp->v_object) == NULL) { - ncl_printf("nfs_getpages: called with non-merged cache vnode??\n"); + printf("ncl_getpages: called with non-merged cache vnode\n"); return (VM_PAGER_ERROR); } @@ -111,7 +111,7 @@ ncl_getpages(struct vop_getpages_args *a mtx_lock(&np->n_mtx); if ((np->n_flag & NNONCACHE) && (vp->v_type == VREG)) { mtx_unlock(&np->n_mtx); - ncl_printf("nfs_getpages: called on non-cacheable vnode??\n"); + printf("ncl_getpages: called on non-cacheable vnode\n"); return (VM_PAGER_ERROR); } else mtx_unlock(&np->n_mtx); @@ -166,7 +166,7 @@ ncl_getpages(struct vop_getpages_args *a relpbuf(bp, &ncl_pbuf_freecnt); if (error && (uio.uio_resid == count)) { - ncl_printf("nfs_getpages: error %d\n", error); + printf("ncl_getpages: error %d\n", error); return (VM_PAGER_ERROR); } @@ -267,7 +267,7 @@ ncl_putpages(struct vop_putpages_args *a if (newnfs_directio_enable && !newnfs_directio_allow_mmap && (np->n_flag & NNONCACHE) && (vp->v_type == VREG)) { mtx_unlock(&np->n_mtx); - ncl_printf("ncl_putpages: called on noncache-able vnode??\n"); + printf("ncl_putpages: called on noncache-able vnode\n"); mtx_lock(&np->n_mtx); } @@ -678,7 +678,7 @@ ncl_bioread(struct vnode *vp, struct uio n = np->n_direofoffset - uio->uio_offset; break; default: - ncl_printf(" ncl_bioread: type %x unexpected\n", vp->v_type); + printf(" ncl_bioread: type %x unexpected\n", vp->v_type); bp = NULL; break; } @@ -1121,7 +1121,7 @@ again: */ if (bp->b_dirtyend > bcount) { - ncl_printf("NFS append race @%lx:%d\n", + printf("NFS append race @%lx:%d\n", (long)bp->b_blkno * DEV_BSIZE, bp->b_dirtyend - bcount); bp->b_dirtyend = bcount; @@ -1662,7 +1662,7 @@ ncl_doio(struct vnode *vp, struct buf *b bp->b_flags |= B_INVAL; break; default: - ncl_printf("ncl_doio: type %x unexpected\n", vp->v_type); + printf("ncl_doio: type %x unexpected\n", vp->v_type); break; } if (error) { Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 3 15:39:58 2016 (r303714) +++ head/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 3 15:58:20 2016 (r303715) @@ -161,16 +161,6 @@ ncl_downgrade_vnlock(struct vnode *vp, i } } -void -ncl_printf(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); -} - #ifdef NFS_ACDEBUG #include SYSCTL_DECL(_vfs_nfs); @@ -201,7 +191,7 @@ ncl_getattrcache(struct vnode *vp, struc #ifdef NFS_ACDEBUG if (nfs_acdebug>1) - ncl_printf("nfs_getattrcache: initial timeo = %d\n", timeo); + printf("ncl_getattrcache: initial timeo = %d\n", timeo); #endif if (vap->va_type == VDIR) { @@ -218,13 +208,13 @@ ncl_getattrcache(struct vnode *vp, struc #ifdef NFS_ACDEBUG if (nfs_acdebug > 2) - ncl_printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n", - nmp->nm_acregmin, nmp->nm_acregmax, - nmp->nm_acdirmin, nmp->nm_acdirmax); + printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n", + nmp->nm_acregmin, nmp->nm_acregmax, + nmp->nm_acdirmin, nmp->nm_acdirmax); if (nfs_acdebug) - ncl_printf("nfs_getattrcache: age = %d; final timeo = %d\n", - (time_second - np->n_attrstamp), timeo); + printf("ncl_getattrcache: age = %d; final timeo = %d\n", + (time_second - np->n_attrstamp), timeo); #endif if ((time_second - np->n_attrstamp) >= timeo && Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Wed Aug 3 15:39:58 2016 (r303714) +++ head/sys/fs/nfsclient/nfs_clvnops.c Wed Aug 3 15:58:20 2016 (r303715) @@ -1785,7 +1785,7 @@ nfs_rename(struct vop_rename_args *ap) } if (fvp == tvp) { - ncl_printf("nfs_rename: fvp == tvp (can't happen)\n"); + printf("nfs_rename: fvp == tvp (can't happen)\n"); error = 0; goto out; } @@ -2313,7 +2313,7 @@ ncl_readdirrpc(struct vnode *vp, struct dnp->n_direofoffset = uiop->uio_offset; else { if (uiop->uio_resid > 0) - ncl_printf("EEK! readdirrpc resid > 0\n"); + printf("EEK! readdirrpc resid > 0\n"); ncl_dircookie_lock(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1); *cookiep = cookie; @@ -2372,7 +2372,7 @@ ncl_readdirplusrpc(struct vnode *vp, str dnp->n_direofoffset = uiop->uio_offset; else { if (uiop->uio_resid > 0) - ncl_printf("EEK! readdirplusrpc resid > 0\n"); + printf("EEK! readdirplusrpc resid > 0\n"); ncl_dircookie_lock(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1); *cookiep = cookie; @@ -3145,8 +3145,8 @@ nfs_print(struct vop_print_args *ap) struct vnode *vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); - ncl_printf("\tfileid %ld fsid 0x%x", - np->n_vattr.na_fileid, np->n_vattr.na_fsid); + printf("\tfileid %ld fsid 0x%x", np->n_vattr.na_fileid, + np->n_vattr.na_fsid); if (vp->v_type == VFIFO) fifo_printinfo(vp); printf("\n"); Modified: head/sys/fs/nfsclient/nfsnode.h ============================================================================== --- head/sys/fs/nfsclient/nfsnode.h Wed Aug 3 15:39:58 2016 (r303714) +++ head/sys/fs/nfsclient/nfsnode.h Wed Aug 3 15:58:20 2016 (r303715) @@ -185,7 +185,6 @@ nfsuint64 *ncl_getcookie(struct nfsnode void ncl_invaldir(struct vnode *); int ncl_upgrade_vnlock(struct vnode *); void ncl_downgrade_vnlock(struct vnode *, int); -void ncl_printf(const char *, ...); void ncl_dircookie_lock(struct nfsnode *); void ncl_dircookie_unlock(struct nfsnode *); From owner-svn-src-head@freebsd.org Wed Aug 3 16:08:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 942FABADA80; Wed, 3 Aug 2016 16:08:23 +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 7210C1291; Wed, 3 Aug 2016 16:08:23 +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 u73G8M45055916; Wed, 3 Aug 2016 16:08:22 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73G8Mjq055909; Wed, 3 Aug 2016 16:08:22 GMT (envelope-from des@FreeBSD.org) Message-Id: <201608031608.u73G8Mjq055909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Wed, 3 Aug 2016 16:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303716 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:08:23 -0000 Author: des Date: Wed Aug 3 16:08:21 2016 New Revision: 303716 URL: https://svnweb.freebsd.org/changeset/base/303716 Log: Remove DSA from default cipher list and disable SSH1. Upstream did this a long time ago, but we kept DSA and SSH1 in FreeBSD for reasons which boil down to POLA. Now is a good time to catch up. MFC after: 3 days Relnotes: yes Modified: head/crypto/openssh/FREEBSD-upgrade head/crypto/openssh/config.h head/crypto/openssh/configure.ac head/crypto/openssh/myproposal.h head/crypto/openssh/servconf.c head/crypto/openssh/ssh_config.5 head/crypto/openssh/sshd_config.5 Modified: head/crypto/openssh/FREEBSD-upgrade ============================================================================== --- head/crypto/openssh/FREEBSD-upgrade Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/FREEBSD-upgrade Wed Aug 3 16:08:21 2016 (r303716) @@ -142,30 +142,25 @@ Support for TCP wrappers was removed in upstream 6.7p1. We've added it back by porting the 6.6p1 code forward. -6) DSA keys - - DSA keys were disabled by default in upstream 6.9p1. We've added - them back. - -7) Agent client reference counting +6) Agent client reference counting We've added code to ssh-agent.c to implement client reference counting; the agent will automatically exit when the last client disconnects. -8) Class-based login restrictions +7) Class-based login restrictions We've added code to auth2.c to enforce the host.allow, host.deny, times.allow and times.deny login class capabilities. -9) HPN +8) HPN We no longer have the HPN patches (adaptive buffer size for increased throughput on high-BxD links), but we recognize and ignore HPN-related configuration options to avoid breaking existing configurations. -A) AES-CBC +9) AES-CBC The AES-CBC ciphers were removed from the server-side proposal list in 6.7p1 due to theoretical weaknesses and the availability of Modified: head/crypto/openssh/config.h ============================================================================== --- head/crypto/openssh/config.h Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/config.h Wed Aug 3 16:08:21 2016 (r303716) @@ -1701,7 +1701,7 @@ /* #undef WITH_SELINUX */ /* include SSH protocol version 1 support */ -#define WITH_SSH1 1 +/* #undef WITH_SSH1 */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ Modified: head/crypto/openssh/configure.ac ============================================================================== --- head/crypto/openssh/configure.ac Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/configure.ac Wed Aug 3 16:08:21 2016 (r303716) @@ -123,7 +123,7 @@ AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [ha ]) openssl=yes -ssh1=yes +ssh1=no AC_ARG_WITH([openssl], [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ], [ if test "x$withval" = "xno" ; then Modified: head/crypto/openssh/myproposal.h ============================================================================== --- head/crypto/openssh/myproposal.h Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/myproposal.h Wed Aug 3 16:08:21 2016 (r303716) @@ -100,13 +100,11 @@ HOSTKEY_ECDSA_CERT_METHODS \ "ssh-ed25519-cert-v01@openssh.com," \ "ssh-rsa-cert-v01@openssh.com," \ - "ssh-dss-cert-v01@openssh.com," \ HOSTKEY_ECDSA_METHODS \ "ssh-ed25519," \ "rsa-sha2-512," \ "rsa-sha2-256," \ - "ssh-rsa," \ - "ssh-dss" + "ssh-rsa" /* the actual algorithms */ Modified: head/crypto/openssh/servconf.c ============================================================================== --- head/crypto/openssh/servconf.c Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/servconf.c Wed Aug 3 16:08:21 2016 (r303716) @@ -206,8 +206,6 @@ fill_default_server_options(ServerOption /* Standard Options */ if (options->protocol == SSH_PROTO_UNKNOWN) options->protocol = SSH_PROTO_2; - if (options->protocol & SSH_PROTO_1) - error("WARNING: SSH protocol version 1 enabled"); if (options->num_host_key_files == 0) { /* fill default hostkeys for protocols */ if (options->protocol & SSH_PROTO_1) Modified: head/crypto/openssh/ssh_config.5 ============================================================================== --- head/crypto/openssh/ssh_config.5 Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/ssh_config.5 Wed Aug 3 16:08:21 2016 (r303716) @@ -871,10 +871,8 @@ ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, -ssh-dss-cert-v01@openssh.com, -ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, -ecdsa-sha2-nistp521,ssh-ed25519, -ssh-rsa,ssh-dss +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa .Ed .Pp The @@ -896,10 +894,8 @@ ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, -ssh-dss-cert-v01@openssh.com, -ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, -ecdsa-sha2-nistp521,ssh-ed25519, -ssh-rsa,ssh-dss +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa .Ed .Pp If hostkeys are known for the destination host then this default is modified @@ -1336,10 +1332,8 @@ ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, -ssh-dss-cert-v01@openssh.com, -ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, -ecdsa-sha2-nistp521,ssh-ed25519, -ssh-rsa,ssh-dss +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa .Ed .Pp The Modified: head/crypto/openssh/sshd_config.5 ============================================================================== --- head/crypto/openssh/sshd_config.5 Wed Aug 3 15:58:20 2016 (r303715) +++ head/crypto/openssh/sshd_config.5 Wed Aug 3 16:08:21 2016 (r303716) @@ -659,10 +659,8 @@ ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, -ssh-dss-cert-v01@openssh.com, -ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, -ecdsa-sha2-nistp521,ssh-ed25519, -ssh-rsa,ssh-dss +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa .Ed .Pp The @@ -753,10 +751,8 @@ ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, -ssh-dss-cert-v01@openssh.com, -ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, -ecdsa-sha2-nistp521,ssh-ed25519, -ssh-rsa,ssh-dss +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa .Ed .Pp The list of available key types may also be obtained using the @@ -1372,10 +1368,8 @@ ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com, ssh-ed25519-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, -ssh-dss-cert-v01@openssh.com, -ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, -ecdsa-sha2-nistp521,ssh-ed25519, -ssh-rsa,ssh-dss +ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, +ssh-ed25519,ssh-rsa .Ed .Pp The From owner-svn-src-head@freebsd.org Wed Aug 3 16:14:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1F6BBADCEF; Wed, 3 Aug 2016 16:14:04 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x22d.google.com (mail-oi0-x22d.google.com [IPv6:2607:f8b0:4003:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76FD41881; Wed, 3 Aug 2016 16:14:04 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x22d.google.com with SMTP id l65so286886304oib.1; Wed, 03 Aug 2016 09:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jTD8PWZXz4FCbXslvBXW8HZKjq6vCr9giP5OpmcNKRc=; b=Q0byiLrlVN5RX0rjsMR/PnDdRI0pBhcf6tGkIyev2UHF2upJorVyOQQIGGOMJ7ZnEp cQHSzau90PwCGcSU+hAEo440o6fC0rtzZNsTKp3wVd5NXp68Nb6OApWU9+x3EibWzt1k gIRVimRS9H1u7wx1H1cEbQDc0DScU3uxyMmzC4mJTuZeRhGwSjw54T+ATvYBMEkKYTKj sRYm7BSDRDYkNIMZTZMbAXXHj+XyZm2jQNzg1FUNEs7MX2fESXiQfc7PkPr++Aa4fiW8 4NMMpecrMHzBWVH25vA2nX0C4BpsmVlf36V0sGafITCpDwErN+3JBgRlLblwUqYkhZ2N j8Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jTD8PWZXz4FCbXslvBXW8HZKjq6vCr9giP5OpmcNKRc=; b=OikhCgn53aWCtNk/JYssgq2ENnTUVU3UqrZqT2hUey0p8rsg7h/YvctTNZuFS6HBh5 DfOKpG/Hf0KPWl9Xh45tcl+4rWFVcEE2843LC3uDwmp1jzoy9pVviszM5JleXKp5XZD2 3KQFwgPdtx9zu3kjFlmFZjboH1QaRXxIuYGQVPELe3Npk9/SEhnfbelEUXmzJpswUgTz HwVxLGCTGw8FdWDIbHsNSja0KOslV7D1Wp5WO+dWXX7XpRGG2MtHWJubbgqJtQ57y6f0 IJw+cHNbLqA+MnPfjyZs9qn5RIP7MyYxNz4ZzuO6LmY8ozzW2pKdE2N6HhnoqXHgWdz+ sCFw== X-Gm-Message-State: AEkoouvY+af1JBGV3x3rC5l/N/P7dzIbfZJuLv/Jw1zqhlL4e0mUf2zab4Ohh8zSzL96zsKyuL7m8Zl/E2cPxQ== X-Received: by 10.202.193.195 with SMTP id r186mr39087437oif.109.1470240843524; Wed, 03 Aug 2016 09:14:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.11.145 with HTTP; Wed, 3 Aug 2016 09:14:03 -0700 (PDT) In-Reply-To: <201608031608.u73G8Mjq055909@repo.freebsd.org> References: <201608031608.u73G8Mjq055909@repo.freebsd.org> From: Benjamin Kaduk Date: Wed, 3 Aug 2016 11:14:03 -0500 Message-ID: Subject: Re: svn commit: r303716 - head/crypto/openssh To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:14:04 -0000 On Wed, Aug 3, 2016 at 11:08 AM, Dag-Erling Sm=C3=B8rgrav wrote: > Author: des > Date: Wed Aug 3 16:08:21 2016 > New Revision: 303716 > URL: https://svnweb.freebsd.org/changeset/base/303716 > > Log: > Remove DSA from default cipher list and disable SSH1. > > Upstream did this a long time ago, but we kept DSA and SSH1 in FreeBSD > for > reasons which boil down to POLA. Now is a good time to catch up. > > MFC after: 3 days > Which branch(es) are MFC targets? (Does POLA no longer apply to them?) -Ben From owner-svn-src-head@freebsd.org Wed Aug 3 16:30:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B039ABAE125; Wed, 3 Aug 2016 16:30:06 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 791FA1357; Wed, 3 Aug 2016 16:30:06 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 36A87296F; Wed, 3 Aug 2016 16:29:59 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id A4CBD4866; Wed, 3 Aug 2016 18:29:06 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Benjamin Kaduk Cc: "src-committers\@freebsd.org" , "svn-src-all\@freebsd.org" , "svn-src-head\@freebsd.org" Subject: Re: svn commit: r303716 - head/crypto/openssh References: <201608031608.u73G8Mjq055909@repo.freebsd.org> Date: Wed, 03 Aug 2016 18:29:06 +0200 In-Reply-To: (Benjamin Kaduk's message of "Wed, 3 Aug 2016 11:14:03 -0500") Message-ID: <86vazhq0j1.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:30:06 -0000 Benjamin Kaduk writes: > Which branch(es) are MFC targets? It will be merged to stable/11 before the release and documented in the release notes. > (Does POLA no longer apply to them?) Things change over time. Such is the nature of software (and of life). POLA does not mean we don't change anything, just that we try not to make disruptive changes during the lifetime of a release branch. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@freebsd.org Wed Aug 3 16:33:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D8B4BAE285; Wed, 3 Aug 2016 16:33:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD14B1890; Wed, 3 Aug 2016 16:33:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73GXZOs067095; Wed, 3 Aug 2016 16:33:35 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73GXYKe067092; Wed, 3 Aug 2016 16:33:34 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608031633.u73GXYKe067092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 3 Aug 2016 16:33:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303718 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:33:36 -0000 Author: pfg Date: Wed Aug 3 16:33:34 2016 New Revision: 303718 URL: https://svnweb.freebsd.org/changeset/base/303718 Log: indent(1): accept offsetof(3) as a keyword. Reference: https://github.com/pstef/freebsd_indent/commit/c470e5e2c974aa38450ca4762b93829f7a7bfa4d Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_globs.h head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Wed Aug 3 16:10:53 2016 (r303717) +++ head/usr.bin/indent/indent.c Wed Aug 3 16:33:34 2016 (r303718) @@ -510,8 +510,11 @@ check_type: case lparen: /* got a '(' or '[' */ ++ps.p_l_follow; /* count parens to make Healy happy */ if (ps.want_blank && *token != '[' && - (ps.last_token != ident || proc_calls_space - || (ps.its_a_keyword && (!ps.sizeof_keyword || Bill_Shannon)))) + (ps.last_token != ident || proc_calls_space || + /* offsetof (1) is never allowed a space; sizeof (2) gets + * one iff -bs; all other keywords (>2) always get a space + * before lparen */ + (ps.keyword + Bill_Shannon > 2))) *e_code++ = ' '; ps.want_blank = false; if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && @@ -542,19 +545,20 @@ check_type: ps.in_or_st = false; /* turn off flag for structure decl or * initialization */ } - if (ps.sizeof_keyword) - ps.sizeof_mask |= 1 << ps.p_l_follow; + /* parenthesized type following sizeof or offsetof is not a cast */ + if (ps.keyword == 1 || ps.keyword == 2) + ps.not_cast_mask |= 1 << ps.p_l_follow; break; case rparen: /* got a ')' or ']' */ rparen_count--; - if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.sizeof_mask) { + if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) { ps.last_u_d = true; ps.cast_mask &= (1 << ps.p_l_follow) - 1; ps.want_blank = false; } else ps.want_blank = true; - ps.sizeof_mask &= (1 << ps.p_l_follow) - 1; + ps.not_cast_mask &= (1 << ps.p_l_follow) - 1; if (--ps.p_l_follow < 0) { ps.p_l_follow = 0; diag3(0, "Extra %c", *token); @@ -712,7 +716,7 @@ check_type: if (ps.last_token == rparen && rparen_count == 0) ps.in_parameter_declaration = 0; ps.cast_mask = 0; - ps.sizeof_mask = 0; + ps.not_cast_mask = 0; ps.block_init = 0; ps.block_init_level = 0; ps.just_saw_decl--; @@ -968,7 +972,7 @@ check_type: copy_id: if (ps.want_blank) *e_code++ = ' '; - if (troff && ps.its_a_keyword) { + if (troff && ps.keyword) { e_code = chfont(&bodyf, &keywordf, e_code); for (t_ptr = token; *t_ptr; ++t_ptr) { CHECK_SIZE_CODE; Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Wed Aug 3 16:10:53 2016 (r303717) +++ head/usr.bin/indent/indent_globs.h Wed Aug 3 16:33:34 2016 (r303718) @@ -244,10 +244,10 @@ struct parser_state { * char should be lined up with the / in / followed by * */ int comment_delta, n_comment_delta; - int cast_mask; /* indicates which close parens close off - * casts */ - int sizeof_mask; /* indicates which close parens close off - * sizeof''s */ + int cast_mask; /* indicates which close parens potentially + * close off casts */ + int not_cast_mask; /* indicates which close parens definitely + * close off something else than casts */ int block_init; /* true iff inside a block initialization */ int block_init_level; /* The level of brace nesting in an * initialization */ @@ -317,8 +317,7 @@ struct parser_state { * specially */ int decl_indent; /* column to indent declared identifiers to */ int local_decl_indent; /* like decl_indent but for locals */ - int its_a_keyword; - int sizeof_keyword; + int keyword; /* the type of a keyword or 0 */ int dumped_decl_indent; float case_indent; /* The distance to indent case labels from the * switch statement */ Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Wed Aug 3 16:10:53 2016 (r303717) +++ head/usr.bin/indent/lexi.c Wed Aug 3 16:33:34 2016 (r303718) @@ -66,13 +66,13 @@ struct templ { struct templ specials[1000] = { - {"switch", 1}, - {"case", 2}, - {"break", 0}, + {"switch", 7}, + {"case", 8}, + {"break", 9}, {"struct", 3}, {"union", 3}, {"enum", 3}, - {"default", 2}, + {"default", 8}, {"int", 4}, {"char", 4}, {"float", 4}, @@ -88,14 +88,15 @@ struct templ specials[1000] = {"void", 4}, {"const", 4}, {"volatile", 4}, - {"goto", 0}, - {"return", 0}, + {"goto", 9}, + {"return", 9}, {"if", 5}, {"while", 5}, {"for", 5}, {"else", 6}, {"do", 6}, - {"sizeof", 7}, + {"sizeof", 2}, + {"offsetof", 1}, {0, 0} }; @@ -230,8 +231,7 @@ lexi(void) if (++buf_ptr >= buf_end) fill_buffer(); } - ps.its_a_keyword = false; - ps.sizeof_keyword = false; + ps.keyword = 0; if (l_struct && !ps.p_l_follow) { /* if last token was 'struct' and we're not * in parentheses, then this token @@ -253,7 +253,7 @@ lexi(void) /* Check if we have an "_t" in the end */ if (q_len > 2 && (strcmp(q + q_len - 2, "_t") == 0)) { - ps.its_a_keyword = true; + ps.keyword = 4; /* a type name */ ps.last_u_d = true; goto found_auto_typedef; } @@ -278,12 +278,12 @@ lexi(void) } if (p->rwd) { /* we have a keyword */ found_keyword: - ps.its_a_keyword = true; + ps.keyword = p->rwcode; ps.last_u_d = true; switch (p->rwcode) { - case 1: /* it is a switch */ + case 7: /* it is a switch */ return (swstmt); - case 2: /* a case or default */ + case 8: /* a case or default */ return (casestmt); case 3: /* a "struct" */ @@ -297,8 +297,9 @@ lexi(void) case 4: /* one of the declaration keywords */ found_auto_typedef: if (ps.p_l_follow) { - ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.sizeof_mask; - break; /* inside parens: cast, param list or sizeof */ + /* inside parens: cast, param list, offsetof or sizeof */ + ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.not_cast_mask; + break; } last_code = decl; return (decl); @@ -309,8 +310,6 @@ lexi(void) case 6: /* do, else */ return (sp_nparen); - case 7: - ps.sizeof_keyword = true; default: /* all others are treated like any other * identifier */ return (ident); @@ -337,7 +336,7 @@ lexi(void) && (ps.last_token == rparen || ps.last_token == semicolon || ps.last_token == decl || ps.last_token == lbrace || ps.last_token == rbrace)) { - ps.its_a_keyword = true; + ps.keyword = 4; /* a type name */ ps.last_u_d = true; last_code = decl; return decl; From owner-svn-src-head@freebsd.org Wed Aug 3 16:34:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 105B6BAE2D7; Wed, 3 Aug 2016 16:34:22 +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 D4D5A1A04; Wed, 3 Aug 2016 16:34:21 +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 u73GYLQb067168; Wed, 3 Aug 2016 16:34:21 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73GYLxr067167; Wed, 3 Aug 2016 16:34:21 GMT (envelope-from des@FreeBSD.org) Message-Id: <201608031634.u73GYLxr067167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Wed, 3 Aug 2016 16:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303719 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:34:22 -0000 Author: des Date: Wed Aug 3 16:34:20 2016 New Revision: 303719 URL: https://svnweb.freebsd.org/changeset/base/303719 Log: Disable DSA again. MFC after: 3 days Modified: head/etc/rc.d/sshd Modified: head/etc/rc.d/sshd ============================================================================== --- head/etc/rc.d/sshd Wed Aug 3 16:33:34 2016 (r303718) +++ head/etc/rc.d/sshd Wed Aug 3 16:34:20 2016 (r303719) @@ -23,7 +23,7 @@ extra_commands="configtest keygen reload : ${sshd_rsa1_enable:="no"} : ${sshd_rsa_enable:="yes"} -: ${sshd_dsa_enable:="yes"} +: ${sshd_dsa_enable:="no"} : ${sshd_ecdsa_enable:="yes"} : ${sshd_ed25519_enable:="yes"} From owner-svn-src-head@freebsd.org Wed Aug 3 16:34:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4CECBAE315; Wed, 3 Aug 2016 16:34:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id C5C2C1BC5; Wed, 3 Aug 2016 16:34:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id 74798144F; Wed, 3 Aug 2016 16:34:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Wed, 3 Aug 2016 16:34:38 +0000 From: Glen Barber To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303716 - head/crypto/openssh Message-ID: <20160803163438.GM68091@FreeBSD.org> References: <201608031608.u73G8Mjq055909@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="m+utxuhC6KVTvgNz" Content-Disposition: inline In-Reply-To: <201608031608.u73G8Mjq055909@repo.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:34:39 -0000 --m+utxuhC6KVTvgNz Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 03, 2016 at 04:08:22PM +0000, Dag-Erling Sm=F8rgrav wrote: > Author: des > Date: Wed Aug 3 16:08:21 2016 > New Revision: 303716 > URL: https://svnweb.freebsd.org/changeset/base/303716 >=20 > Log: > Remove DSA from default cipher list and disable SSH1. > =20 > Upstream did this a long time ago, but we kept DSA and SSH1 in FreeBSD = for > reasons which boil down to POLA. Now is a good time to catch up. > =20 > MFC after: 3 days > Relnotes: yes >=20 It might be worth considering doing the MFC before 3 days. It's still unclear if we'll need BETA4, but would be nice to have this change in the next build regardless. Glen --m+utxuhC6KVTvgNz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXoh0ZAAoJEAMUWKVHj+KTbLMP/RmWS0d0lKJEve/30WFnypOE OKukvuLCChovtS8varO902e6m/PTVph+SoAY+J2xAqSgMCOUnMwz5D4qruyJOmdB dfL9mjJgs5+svAwl6Iic/y+K3IeNCXtLaDl8LSf/AuyNS/bD2y3DQT8/W5DuQ8Vi mO5LmH9PX06qrtnwNMwt86a5Ip/n/5vQw9cDCNrQQfaXvJ5V3UmtHN+TFB3cVbrt ro5q6zYNp6887Zwx9grttLjpIIlVaElB36iHz/TeZzVlx9evMYz9Pqrqa5QEz2OU zPUD2PETT4036ALX1yNVyrpwEIrg+Q7syTftos4vHydFOTdjiM0ESLSspP0dC2c9 mZS8PuQynDw2Kr2HqZwSIVYanviU8Ter/wizjZl4wKVAA3gF5hCYU72lGRqHp3cp tOhvP1jEhfO4CY8PMgrDOA2PSsZo2lTWIraqACZxvCOaYCwOa4ZN8v6yLlmJ/0VV yijIpOjUlhR218Ndaamy/Df9YCUDI/8QmzGzFmzTpNfYMbEkDtwkI3amniaWVaJb Szgxdclve3JXjM1GcBRTDRVJM6EqiqpKsKcF6gh1lMuv+5ug60N2lFW2aHiOUw8o tfR8nPYl/SD0UrlhC9Mcxn++VV0qPZuQCB34UtJr3BWPRArrmiL94NzrnxEEGsAb K+9VYduOmk/n/XMVfzrZ =osHo -----END PGP SIGNATURE----- --m+utxuhC6KVTvgNz-- From owner-svn-src-head@freebsd.org Wed Aug 3 16:52:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD010BAE71F; Wed, 3 Aug 2016 16:52:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9011B19C5; Wed, 3 Aug 2016 16:52:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73Gq0DF074876; Wed, 3 Aug 2016 16:52:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73Gq0UJ074875; Wed, 3 Aug 2016 16:52:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608031652.u73Gq0UJ074875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 3 Aug 2016 16:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303720 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:52:01 -0000 Author: jhb Date: Wed Aug 3 16:52:00 2016 New Revision: 303720 URL: https://svnweb.freebsd.org/changeset/base/303720 Log: Apply the fix from r232612 to fixed function counters. Reviewed by: emaste MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D7397 Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Wed Aug 3 16:34:20 2016 (r303719) +++ head/sys/dev/hwpmc/hwpmc_core.c Wed Aug 3 16:52:00 2016 (r303720) @@ -365,7 +365,7 @@ iaf_read_pmc(int cpu, int ri, pmc_value_ if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) *v = iaf_perfctr_value_to_reload_count(tmp); else - *v = tmp; + *v = tmp & ((1ULL << core_iaf_width) - 1); PMCDBG4(MDP,REA,1, "iaf-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri, IAF_RI_TO_MSR(ri), *v); From owner-svn-src-head@freebsd.org Wed Aug 3 17:09:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F354BAED22; Wed, 3 Aug 2016 17:09:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1171516DF; Wed, 3 Aug 2016 17:09:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73H9Did078743; Wed, 3 Aug 2016 17:09:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73H9C4q078737; Wed, 3 Aug 2016 17:09:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608031709.u73H9C4q078737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 3 Aug 2016 17:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303721 - in head: share/man/man9 sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 17:09:14 -0000 Author: jhb Date: Wed Aug 3 17:09:12 2016 New Revision: 303721 URL: https://svnweb.freebsd.org/changeset/base/303721 Log: Permit the name of the /dev/iov entry to be set by the driver. The PCI_IOV option creates character devices in /dev/iov for each PF device driver that registers support for creating VFs. By default the character device is named after the PF device (e.g. /dev/iov/foo0). This change adds a variant of pci_iov_attach() called pci_iov_attach_name() that allows the name of the /dev/iov entry to be specified by the driver. Reviewed by: rstone MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7400 Modified: head/share/man/man9/Makefile head/share/man/man9/pci.9 head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_iov.c head/sys/dev/pci/pci_iov.h head/sys/dev/pci/pci_private.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Aug 3 16:52:00 2016 (r303720) +++ head/share/man/man9/Makefile Wed Aug 3 17:09:12 2016 (r303721) @@ -1303,6 +1303,7 @@ MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pci_get_vpd_ident.9 \ pci.9 pci_get_vpd_readonly.9 \ pci.9 pci_iov_attach.9 \ + pci.9 pci_iov_attach_name.9 \ pci.9 pci_iov_detach.9 \ pci.9 pci_msi_count.9 \ pci.9 pci_msix_count.9 \ Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Wed Aug 3 16:52:00 2016 (r303720) +++ head/share/man/man9/pci.9 Wed Aug 3 17:09:12 2016 (r303721) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2016 +.Dd August 3, 2016 .Dt PCI 9 .Os .Sh NAME @@ -50,6 +50,7 @@ .Nm pci_get_vpd_ident , .Nm pci_get_vpd_readonly , .Nm pci_iov_attach , +.Nm pci_iov_attach_name , .Nm pci_iov_detach , .Nm pci_msi_count , .Nm pci_msix_count , @@ -152,6 +153,14 @@ .Ft int .Fn pci_iov_attach "device_t dev" "nvlist_t *pf_schema" "nvlist_t *vf_schema" .Ft int +.Fo pci_iov_attach_name +.Fa "device_t dev" +.Fa "nvlist_t *pf_schema" +.Fa "nvlist_t *vf_schema" +.Fa "const char *fmt" +.Fa "..." +.Fc +.Ft int .Fn pci_iov_detach "device_t dev" .Sh DESCRIPTION The @@ -595,6 +604,20 @@ and is responsible for freeing them. The driver must never free the schemas itself. .Pp The +.Fn pci_iov_attach_name +function is a variant of +.Fn pci_iov_attach +that allows the name of the associated character device in +.Pa /dev/iov +to be specified by +.Fa fmt . +The +.Fn pci_iov_attach +function uses the name of +.Fa dev +as the device name. +.Pp +The .Fn pci_iov_detach function is used to advise the SR-IOV infrastructure that the driver for the given device is attempting to detach and that all SR-IOV resources for the Modified: head/sys/dev/pci/pci_if.m ============================================================================== --- head/sys/dev/pci/pci_if.m Wed Aug 3 16:52:00 2016 (r303720) +++ head/sys/dev/pci/pci_if.m Wed Aug 3 17:09:12 2016 (r303721) @@ -235,6 +235,7 @@ METHOD int iov_attach { device_t child; struct nvlist *pf_schema; struct nvlist *vf_schema; + const char *name; }; METHOD int iov_detach { Modified: head/sys/dev/pci/pci_iov.c ============================================================================== --- head/sys/dev/pci/pci_iov.c Wed Aug 3 16:52:00 2016 (r303720) +++ head/sys/dev/pci/pci_iov.c Wed Aug 3 17:09:12 2016 (r303721) @@ -98,8 +98,22 @@ static nvlist_t *pci_iov_get_pf_subsyste static nvlist_t *pci_iov_get_vf_subsystem_schema(void); int +pci_iov_attach_name(device_t dev, struct nvlist *pf_schema, + struct nvlist *vf_schema, const char *fmt, ...) +{ + char buf[NAME_MAX + 1]; + va_list ap; + + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (PCI_IOV_ATTACH(device_get_parent(dev), dev, pf_schema, + vf_schema, buf)); +} + +int pci_iov_attach_method(device_t bus, device_t dev, nvlist_t *pf_schema, - nvlist_t *vf_schema) + nvlist_t *vf_schema, const char *name) { device_t pcib; struct pci_devinfo *dinfo; @@ -149,7 +163,7 @@ pci_iov_attach_method(device_t bus, devi iov->iov_schema = schema; iov->iov_cdev = make_dev(&iov_cdevsw, device_get_unit(dev), - UID_ROOT, GID_WHEEL, 0600, "iov/%s", device_get_nameunit(dev)); + UID_ROOT, GID_WHEEL, 0600, "iov/%s", name); if (iov->iov_cdev == NULL) { error = ENOMEM; Modified: head/sys/dev/pci/pci_iov.h ============================================================================== --- head/sys/dev/pci/pci_iov.h Wed Aug 3 16:52:00 2016 (r303720) +++ head/sys/dev/pci/pci_iov.h Wed Aug 3 17:09:12 2016 (r303721) @@ -33,11 +33,14 @@ struct nvlist; +int pci_iov_attach_name(device_t dev, struct nvlist *pf_schema, + struct nvlist *vf_schema, const char *fmt, ...) __printflike(4, 5); + static __inline int pci_iov_attach(device_t dev, struct nvlist *pf_schema, struct nvlist *vf_schema) { return (PCI_IOV_ATTACH(device_get_parent(dev), dev, pf_schema, - vf_schema)); + vf_schema, device_get_nameunit(dev))); } static __inline int Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Wed Aug 3 16:52:00 2016 (r303720) +++ head/sys/dev/pci/pci_private.h Wed Aug 3 17:09:12 2016 (r303721) @@ -158,7 +158,8 @@ struct resource *pci_alloc_multi_resourc rman_res_t count, u_long num, u_int flags); int pci_iov_attach_method(device_t bus, device_t dev, - struct nvlist *pf_schema, struct nvlist *vf_schema); + struct nvlist *pf_schema, struct nvlist *vf_schema, + const char *name); int pci_iov_detach_method(device_t bus, device_t dev); device_t pci_create_iov_child_method(device_t bus, device_t pf, From owner-svn-src-head@freebsd.org Wed Aug 3 17:11:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D84BBAEE3D; Wed, 3 Aug 2016 17:11:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5B9E18FC; Wed, 3 Aug 2016 17:11:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73HB94v080879; Wed, 3 Aug 2016 17:11:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73HB80B080876; Wed, 3 Aug 2016 17:11:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608031711.u73HB80B080876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 3 Aug 2016 17:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303722 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 17:11:10 -0000 Author: jhb Date: Wed Aug 3 17:11:08 2016 New Revision: 303722 URL: https://svnweb.freebsd.org/changeset/base/303722 Log: Use the port device name for the iov device for Chelsio T4/T5 cards. Chelsio T4/T5 adapters are multifunction cards. The main driver uses physical function 4 (PF4). However, VF devices for SR-IOV are only supported on physical functions 0 through 3, where PF0 creates VFs tied to port 0, etc. The t4iov/t5iov driver was previously added to create VF devices for ports that are present on each adapter. This change uses the recently added pci_iov_attach_name() function to name the character device in /dev/iov after the associated port on the card (e.g. /dev/iov/cxl0 is used to create VFs that share the cxl0 port). With this in place, mark the t4iov/t5iov devices quiet to prevent them from cluttering dmesg. Reviewed by: rstone Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7402 Modified: head/sys/dev/cxgbe/t4_if.m head/sys/dev/cxgbe/t4_iov.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_if.m ============================================================================== --- head/sys/dev/cxgbe/t4_if.m Wed Aug 3 17:09:12 2016 (r303721) +++ head/sys/dev/cxgbe/t4_if.m Wed Aug 3 17:11:08 2016 (r303722) @@ -55,11 +55,11 @@ METHOD int detach_child { device_t dev; }; -# Called by a driver to query the PF4 driver for the unit number to use -# for a given port. If the port is not enabled on the adapter, this -# will fail. -METHOD int read_port_unit { +# Called by a driver to query the PF4 driver for the child device +# associated with a given port. If the port is not enabled on the adapter, +# this will fail. +METHOD int read_port_device { device_t dev; int port; - int *unit; + device_t *child; }; Modified: head/sys/dev/cxgbe/t4_iov.c ============================================================================== --- head/sys/dev/cxgbe/t4_iov.c Wed Aug 3 17:09:12 2016 (r303721) +++ head/sys/dev/cxgbe/t4_iov.c Wed Aug 3 17:11:08 2016 (r303722) @@ -104,6 +104,7 @@ t4iov_probe(device_t dev) for (i = 0; i < nitems(t4iov_pciids); i++) { if (d == t4iov_pciids[i].device) { device_set_desc(dev, t4iov_pciids[i].desc); + device_quiet(dev); return (BUS_PROBE_DEFAULT); } } @@ -120,6 +121,7 @@ t5iov_probe(device_t dev) for (i = 0; i < nitems(t5iov_pciids); i++) { if (d == t5iov_pciids[i].device) { device_set_desc(dev, t5iov_pciids[i].desc); + device_quiet(dev); return (BUS_PROBE_DEFAULT); } } @@ -148,25 +150,27 @@ t4iov_attach_child(device_t dev) #ifdef PCI_IOV nvlist_t *pf_schema, *vf_schema; #endif - int error, unit; + device_t pdev; + int error; sc = device_get_softc(dev); MPASS(!sc->sc_attached); /* * PF0-3 are associated with a specific port on the NIC (PF0 - * with port 0, etc.). Ask the PF4 driver for the unit number - * for this function's associated port to determine if the port - * is present. + * with port 0, etc.). Ask the PF4 driver for the device for + * this function's associated port to determine if the port is + * present. */ - error = T4_READ_PORT_UNIT(sc->sc_main, pci_get_function(dev), &unit); + error = T4_READ_PORT_DEVICE(sc->sc_main, pci_get_function(dev), &pdev); if (error) return (0); #ifdef PCI_IOV pf_schema = pci_iov_schema_alloc_node(); vf_schema = pci_iov_schema_alloc_node(); - error = pci_iov_attach(dev, pf_schema, vf_schema); + error = pci_iov_attach_name(dev, pf_schema, vf_schema, "%s", + device_get_nameunit(pdev)); if (error) { device_printf(dev, "Failed to initialize SR-IOV: %d\n", error); return (0); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Aug 3 17:09:12 2016 (r303721) +++ head/sys/dev/cxgbe/t4_main.c Wed Aug 3 17:11:08 2016 (r303722) @@ -83,14 +83,14 @@ static int t4_probe(device_t); static int t4_attach(device_t); static int t4_detach(device_t); static int t4_ready(device_t); -static int t4_read_port_unit(device_t, int, int *); +static int t4_read_port_device(device_t, int, device_t *); static device_method_t t4_methods[] = { DEVMETHOD(device_probe, t4_probe), DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), DEVMETHOD(t4_is_main_ready, t4_ready), - DEVMETHOD(t4_read_port_unit, t4_read_port_unit), + DEVMETHOD(t4_read_port_device, t4_read_port_device), DEVMETHOD_END }; @@ -149,7 +149,7 @@ static device_method_t t5_methods[] = { DEVMETHOD(device_detach, t4_detach), DEVMETHOD(t4_is_main_ready, t4_ready), - DEVMETHOD(t4_read_port_unit, t4_read_port_unit), + DEVMETHOD(t4_read_port_device, t4_read_port_device), DEVMETHOD_END }; @@ -1094,7 +1094,7 @@ t4_ready(device_t dev) } static int -t4_read_port_unit(device_t dev, int port, int *unit) +t4_read_port_device(device_t dev, int port, device_t *child) { struct adapter *sc; struct port_info *pi; @@ -1105,7 +1105,7 @@ t4_read_port_unit(device_t dev, int port pi = sc->port[port]; if (pi == NULL || pi->dev == NULL) return (ENXIO); - *unit = device_get_unit(pi->dev); + *child = pi->dev; return (0); } From owner-svn-src-head@freebsd.org Wed Aug 3 17:17:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56A5BBAEFBE; Wed, 3 Aug 2016 17:17:03 +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 3218C1F20; Wed, 3 Aug 2016 17:17:03 +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 u73HH2Go082341; Wed, 3 Aug 2016 17:17:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73HH2Ui082337; Wed, 3 Aug 2016 17:17:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608031717.u73HH2Ui082337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 3 Aug 2016 17:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303723 - head/sys/boot/efi/boot1 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 17:17:03 -0000 Author: markj Date: Wed Aug 3 17:17:01 2016 New Revision: 303723 URL: https://svnweb.freebsd.org/changeset/base/303723 Log: Fix a few cosmetic issues in boot1.efi. - Use ANSI function signatures. - Remove unneeded checks for a NULL boot module. - Use nitems(). MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/boot/efi/boot1/boot1.c head/sys/boot/efi/boot1/ufs_module.c head/sys/boot/efi/boot1/zfs_module.c Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Wed Aug 3 17:11:08 2016 (r303722) +++ head/sys/boot/efi/boot1/boot1.c Wed Aug 3 17:17:01 2016 (r303723) @@ -43,7 +43,7 @@ static const boot_module_t *boot_modules #endif }; -#define NUM_BOOT_MODULES (sizeof(boot_modules) / sizeof(boot_module_t*)) +#define NUM_BOOT_MODULES nitems(boot_modules) /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 @@ -331,8 +331,6 @@ load_loader(const boot_module_t **modp, const boot_module_t *mod; for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] == NULL) - continue; mod = boot_modules[i]; for (dev = mod->devices(); dev != NULL; dev = dev->next) { if (dev->preferred != preferred) @@ -355,7 +353,7 @@ load_loader(const boot_module_t **modp, * it simply boots, otherwise it returns the status of last EFI call. */ static EFI_STATUS -try_boot() +try_boot(void) { size_t bufsize, loadersize, cmdsize; void *buf, *loaderbuf; @@ -498,9 +496,6 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PA /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] == NULL) - continue; - if ((status = bs->AllocatePool(EfiLoaderData, sizeof(*devinfo), (void **)&devinfo)) != EFI_SUCCESS) { @@ -605,9 +600,6 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_T printf(" Loader path: %s\n\n", PATH_LOADER_EFI); printf(" Initializing modules:"); for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] == NULL) - continue; - printf(" %s", boot_modules[i]->name); if (boot_modules[i]->init != NULL) boot_modules[i]->init(); @@ -667,10 +659,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_T /* Status summary. */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] != NULL) { - printf(" "); - boot_modules[i]->status(); - } + printf(" "); + boot_modules[i]->status(); } try_boot(); Modified: head/sys/boot/efi/boot1/ufs_module.c ============================================================================== --- head/sys/boot/efi/boot1/ufs_module.c Wed Aug 3 17:11:08 2016 (r303722) +++ head/sys/boot/efi/boot1/ufs_module.c Wed Aug 3 17:17:01 2016 (r303723) @@ -142,7 +142,7 @@ load(const char *filepath, dev_info_t *d } static void -status() +status(void) { int i; dev_info_t *dev; @@ -164,7 +164,7 @@ status() } static dev_info_t * -_devices() +_devices(void) { return (devices); Modified: head/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- head/sys/boot/efi/boot1/zfs_module.c Wed Aug 3 17:11:08 2016 (r303722) +++ head/sys/boot/efi/boot1/zfs_module.c Wed Aug 3 17:17:01 2016 (r303723) @@ -154,7 +154,7 @@ load(const char *filepath, dev_info_t *d } static void -status() +status(void) { spa_t *spa; @@ -172,14 +172,14 @@ status() } static void -init() +init(void) { zfs_init(); } static dev_info_t * -_devices() +_devices(void) { return (devices); From owner-svn-src-head@freebsd.org Wed Aug 3 18:02:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7089BBADD25; Wed, 3 Aug 2016 18:02:11 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4358D1EBA; Wed, 3 Aug 2016 18:02:11 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73I2ACw001225; Wed, 3 Aug 2016 18:02:10 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73I2AaJ001224; Wed, 3 Aug 2016 18:02:10 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201608031802.u73I2AaJ001224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 3 Aug 2016 18:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303725 - head/sbin/geom/class/eli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 18:02:11 -0000 Author: oshogbo Date: Wed Aug 3 18:02:10 2016 New Revision: 303725 URL: https://svnweb.freebsd.org/changeset/base/303725 Log: Fix misleading description of the -b option in the geli init command. Reviewed by: bjk, wblock Differential Revision: https://reviews.freebsd.org/D7226 Discussed with: AllanJude Modified: head/sbin/geom/class/eli/geli.8 Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Wed Aug 3 17:20:35 2016 (r303724) +++ head/sbin/geom/class/eli/geli.8 Wed Aug 3 18:02:10 2016 (r303725) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2015 +.Dd August 3, 2016 .Dt GELI 8 .Os .Sh NAME @@ -266,7 +266,7 @@ If the option is not given, there will b The recommended algorithm is .Nm HMAC/SHA256 . .It Fl b -Ask for the passphrase on boot, before the root partition is mounted. +Try to decrypt this partition during boot, before the root partition is mounted. This makes it possible to use an encrypted root partition. One will still need bootable unencrypted storage with a .Pa /boot/ From owner-svn-src-head@freebsd.org Wed Aug 3 18:03:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6705EBADDBD; Wed, 3 Aug 2016 18:03:15 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33B481214; Wed, 3 Aug 2016 18:03:15 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73I3E80001316; Wed, 3 Aug 2016 18:03:14 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73I3EPj001315; Wed, 3 Aug 2016 18:03:14 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201608031803.u73I3EPj001315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 3 Aug 2016 18:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303726 - head/sys/boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 18:03:15 -0000 Author: gonzo Date: Wed Aug 3 18:03:14 2016 New Revision: 303726 URL: https://svnweb.freebsd.org/changeset/base/303726 Log: Fix EHCI driver by excluding first 512K from available memory On Zynq 256K-512K memory region is not accessible by all bus masters. EHCI driver fails when trying to use it for DMA transfers. Patching memory node does not help because ubldr overrides values there with the ones obtained from u-boot. So as a workaround we just mark first 512K as reserved. PR: 211484 Submitted by: Thomas Skibo MFC after: 3 days Modified: head/sys/boot/fdt/dts/arm/zynq-7000.dtsi Modified: head/sys/boot/fdt/dts/arm/zynq-7000.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/zynq-7000.dtsi Wed Aug 3 18:02:10 2016 (r303725) +++ head/sys/boot/fdt/dts/arm/zynq-7000.dtsi Wed Aug 3 18:03:14 2016 (r303726) @@ -32,6 +32,10 @@ #size-cells = <1>; interrupt-parent = <&GIC>; + // Reserve first half megabyte because it is not accessible to all + // bus masters. + memreserve = <0x00000000 0x00080000>; + // Zynq PS System registers. // ps7sys@f8000000 { From owner-svn-src-head@freebsd.org Wed Aug 3 18:04:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53040BADE43; Wed, 3 Aug 2016 18:04:09 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2617F13A1; Wed, 3 Aug 2016 18:04:09 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73I48H7001401; Wed, 3 Aug 2016 18:04:08 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73I48p9001400; Wed, 3 Aug 2016 18:04:08 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201608031804.u73I48p9001400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 3 Aug 2016 18:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303727 - head/bin/uuidgen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 18:04:09 -0000 Author: oshogbo Date: Wed Aug 3 18:04:08 2016 New Revision: 303727 URL: https://svnweb.freebsd.org/changeset/base/303727 Log: uuid_to_string(3) is allocating memory and can fail on that. Check if any error accrued. Modified: head/bin/uuidgen/uuidgen.c Modified: head/bin/uuidgen/uuidgen.c ============================================================================== --- head/bin/uuidgen/uuidgen.c Wed Aug 3 18:03:14 2016 (r303726) +++ head/bin/uuidgen/uuidgen.c Wed Aug 3 18:04:08 2016 (r303727) @@ -47,7 +47,7 @@ main(int argc, char *argv[]) FILE *fp; uuid_t *store, *uuid; char *p; - int ch, count, i, iterate; + int ch, count, i, iterate, status; count = -1; /* no count yet */ fp = stdout; /* default output file */ @@ -101,7 +101,9 @@ main(int argc, char *argv[]) uuid = store; while (count--) { - uuid_to_string(uuid++, &p, NULL); + uuid_to_string(uuid++, &p, &status); + if (status != uuid_s_ok) + err(1, "cannot stringify a UUID"); fprintf(fp, "%s\n", p); free(p); } From owner-svn-src-head@freebsd.org Wed Aug 3 18:45:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4698BAE93C; Wed, 3 Aug 2016 18:45:57 +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 84DAC1C53; Wed, 3 Aug 2016 18:45:57 +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 u73IjuMG016412; Wed, 3 Aug 2016 18:45:56 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73Ijui6016411; Wed, 3 Aug 2016 18:45:56 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201608031845.u73Ijui6016411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 3 Aug 2016 18:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303728 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 18:45:57 -0000 Author: manu Date: Wed Aug 3 18:45:56 2016 New Revision: 303728 URL: https://svnweb.freebsd.org/changeset/base/303728 Log: We need aw_nmi to be attached which needs GIC so attach a bit later. Also the GPIOC doesn't need to be attach early Reviewed by: andrew MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7082 Modified: head/sys/arm/allwinner/axp209.c Modified: head/sys/arm/allwinner/axp209.c ============================================================================== --- head/sys/arm/allwinner/axp209.c Wed Aug 3 18:04:08 2016 (r303727) +++ head/sys/arm/allwinner/axp209.c Wed Aug 3 18:45:56 2016 (r303728) @@ -707,10 +707,10 @@ extern devclass_t ofwgpiobus_devclass, g extern driver_t ofw_gpiobus_driver, gpioc_driver; EARLY_DRIVER_MODULE(axp209, iicbus, axp209_driver, axp209_devclass, - 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); EARLY_DRIVER_MODULE(ofw_gpiobus, axp209_pmu, ofw_gpiobus_driver, - ofwgpiobus_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); -EARLY_DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass, - 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); + ofwgpiobus_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); +DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass, + 0, 0); MODULE_VERSION(axp209, 1); MODULE_DEPEND(axp209, iicbus, 1, 1, 1); From owner-svn-src-head@freebsd.org Wed Aug 3 18:48:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F2A0BAEA5A; Wed, 3 Aug 2016 18:48:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E8711F1B; Wed, 3 Aug 2016 18:48:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73ImuWM016548; Wed, 3 Aug 2016 18:48:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73Imumc016547; Wed, 3 Aug 2016 18:48:56 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608031848.u73Imumc016547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 3 Aug 2016 18:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303729 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 18:48:57 -0000 Author: bdrewery Date: Wed Aug 3 18:48:56 2016 New Revision: 303729 URL: https://svnweb.freebsd.org/changeset/base/303729 Log: Correct some comments. Sponsored by: EMC / Isilon Storage Division MFC after: 3 days Modified: head/sys/kern/syscalls.master Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Aug 3 18:45:56 2016 (r303728) +++ head/sys/kern/syscalls.master Wed Aug 3 18:48:56 2016 (r303729) @@ -25,10 +25,10 @@ ; types: ; STD always included ; COMPAT included on COMPAT #ifdef -; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) -; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) -; COMPAT7 included on COMPAT7 #ifdef (FreeBSD 7 compat) -; COMPAT10 included on COMPAT7 #ifdef (FreeBSD 10 compat) +; COMPAT4 included on COMPAT_FREEBSD4 #ifdef (FreeBSD 4 compat) +; COMPAT6 included on COMPAT_FREEBSD6 #ifdef (FreeBSD 6 compat) +; COMPAT7 included on COMPAT_FREEBSD7 #ifdef (FreeBSD 7 compat) +; COMPAT10 included on COMPAT_FREEBSD10 #ifdef (FreeBSD 10 compat) ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only ; NOSTD implemented but as a lkm that can be statically From owner-svn-src-head@freebsd.org Wed Aug 3 19:13:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7437ABAE154; Wed, 3 Aug 2016 19:13:10 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44C591263; Wed, 3 Aug 2016 19:13:10 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73JD9db027430; Wed, 3 Aug 2016 19:13:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73JD9bD027429; Wed, 3 Aug 2016 19:13:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608031913.u73JD9bD027429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 3 Aug 2016 19:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303730 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 19:13:10 -0000 Author: adrian Date: Wed Aug 3 19:13:09 2016 New Revision: 303730 URL: https://svnweb.freebsd.org/changeset/base/303730 Log: [ar9330] add in module support for ipfw nat. This actually does work, and works pretty well. Modified: head/sys/mips/conf/AR933X_BASE Modified: head/sys/mips/conf/AR933X_BASE ============================================================================== --- head/sys/mips/conf/AR933X_BASE Wed Aug 3 18:48:56 2016 (r303729) +++ head/sys/mips/conf/AR933X_BASE Wed Aug 3 19:13:09 2016 (r303730) @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR933X_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw urtwn urtwnfw otus otusfw" +makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 urtwn urtwnfw otus otusfw" options DDB options KDB From owner-svn-src-head@freebsd.org Wed Aug 3 19:18:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D32EBAE38D; Wed, 3 Aug 2016 19:18:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1958016A0; Wed, 3 Aug 2016 19:18:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73JIswu027660; Wed, 3 Aug 2016 19:18:54 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73JIrZr027653; Wed, 3 Aug 2016 19:18:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608031918.u73JIrZr027653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 3 Aug 2016 19:18:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303731 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 19:18:55 -0000 Author: adrian Date: Wed Aug 3 19:18:53 2016 New Revision: 303731 URL: https://svnweb.freebsd.org/changeset/base/303731 Log: [ar9330] ok, fine, I'll finally undo the 2011-era mistake of _BASE config files. Repeated prodding by: imp Added: head/sys/mips/conf/std.AR933X - copied, changed from r303730, head/sys/mips/conf/AR933X_BASE Deleted: head/sys/mips/conf/AR933X_BASE Modified: head/sys/mips/conf/ALFA_HORNET_UB head/sys/mips/conf/AP121 head/sys/mips/conf/CARAMBOLA2 head/sys/mips/conf/ONIONOMEGA head/sys/mips/conf/TL-WR740Nv4 head/sys/mips/conf/TP-MR3020 Modified: head/sys/mips/conf/ALFA_HORNET_UB ============================================================================== --- head/sys/mips/conf/ALFA_HORNET_UB Wed Aug 3 19:13:09 2016 (r303730) +++ head/sys/mips/conf/ALFA_HORNET_UB Wed Aug 3 19:18:53 2016 (r303731) @@ -18,7 +18,7 @@ #NO_UNIVERSE # Include the default AR933x parameters -include "AR933X_BASE" +include "std.AR933X" ident ALFA_HORNET_UB Modified: head/sys/mips/conf/AP121 ============================================================================== --- head/sys/mips/conf/AP121 Wed Aug 3 19:13:09 2016 (r303730) +++ head/sys/mips/conf/AP121 Wed Aug 3 19:18:53 2016 (r303731) @@ -12,7 +12,7 @@ #NO_UNIVERSE # Include the default AR933x parameters -include "AR933X_BASE" +include "std.AR933X" ident AP121 Modified: head/sys/mips/conf/CARAMBOLA2 ============================================================================== --- head/sys/mips/conf/CARAMBOLA2 Wed Aug 3 19:13:09 2016 (r303730) +++ head/sys/mips/conf/CARAMBOLA2 Wed Aug 3 19:18:53 2016 (r303731) @@ -14,7 +14,7 @@ #NO_UNIVERSE # Include the default AR933x parameters -include "AR933X_BASE" +include "std.AR933X" ident CARAMBOLA2 Modified: head/sys/mips/conf/ONIONOMEGA ============================================================================== --- head/sys/mips/conf/ONIONOMEGA Wed Aug 3 19:13:09 2016 (r303730) +++ head/sys/mips/conf/ONIONOMEGA Wed Aug 3 19:18:53 2016 (r303731) @@ -14,7 +14,7 @@ #NO_UNIVERSE # Include the default AR933x parameters -include "AR933X_BASE" +include "std.AR933X" ident ONIONOMEGA Modified: head/sys/mips/conf/TL-WR740Nv4 ============================================================================== --- head/sys/mips/conf/TL-WR740Nv4 Wed Aug 3 19:13:09 2016 (r303730) +++ head/sys/mips/conf/TL-WR740Nv4 Wed Aug 3 19:18:53 2016 (r303731) @@ -12,7 +12,7 @@ #NO_UNIVERSE # Include the default AR933x parameters -include "AR933X_BASE" +include "std.AR933X" ident TL-WR740Nv4 Modified: head/sys/mips/conf/TP-MR3020 ============================================================================== --- head/sys/mips/conf/TP-MR3020 Wed Aug 3 19:13:09 2016 (r303730) +++ head/sys/mips/conf/TP-MR3020 Wed Aug 3 19:18:53 2016 (r303731) @@ -19,7 +19,7 @@ #NO_UNIVERSE # Include the default AR933x parameters -include "AR933X_BASE" +include "std.AR933X" ident TP-MR3020 Copied and modified: head/sys/mips/conf/std.AR933X (from r303730, head/sys/mips/conf/AR933X_BASE) ============================================================================== --- head/sys/mips/conf/AR933X_BASE Wed Aug 3 19:13:09 2016 (r303730, copy source) +++ head/sys/mips/conf/std.AR933X Wed Aug 3 19:18:53 2016 (r303731) @@ -11,7 +11,7 @@ # machine mips mips -ident AR933X_BASE +#ident std.AR933X cpu CPU_MIPS24K makeoptions KERNLOADADDR=0x80050000 options HZ=1000 From owner-svn-src-head@freebsd.org Wed Aug 3 19:23:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96868BAE776; Wed, 3 Aug 2016 19:23:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CD271CD6; Wed, 3 Aug 2016 19:23:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73JNN0q031405; Wed, 3 Aug 2016 19:23:23 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73JNNde031401; Wed, 3 Aug 2016 19:23:23 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608031923.u73JNNde031401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 3 Aug 2016 19:23:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303732 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 19:23:24 -0000 Author: adrian Date: Wed Aug 3 19:23:22 2016 New Revision: 303732 URL: https://svnweb.freebsd.org/changeset/base/303732 Log: [ar934x] shuffle AR93XX_BASE -> std.AR934X Added: head/sys/mips/conf/std.AR934X - copied, changed from r303731, head/sys/mips/conf/AR934X_BASE Deleted: head/sys/mips/conf/AR934X_BASE Modified: head/sys/mips/conf/DB120 head/sys/mips/conf/DIR-825C1 head/sys/mips/conf/TL-WDR4300 Modified: head/sys/mips/conf/DB120 ============================================================================== --- head/sys/mips/conf/DB120 Wed Aug 3 19:18:53 2016 (r303731) +++ head/sys/mips/conf/DB120 Wed Aug 3 19:23:22 2016 (r303732) @@ -5,7 +5,7 @@ # # Include the default AR934x parameters -include "AR934X_BASE" +include "std.AR934X" #NO_UNIVERSE Modified: head/sys/mips/conf/DIR-825C1 ============================================================================== --- head/sys/mips/conf/DIR-825C1 Wed Aug 3 19:18:53 2016 (r303731) +++ head/sys/mips/conf/DIR-825C1 Wed Aug 3 19:23:22 2016 (r303732) @@ -15,7 +15,7 @@ #NO_UNIVERSE # Include the default AR934x parameters -include "AR934X_BASE" +include "std.AR934X" ident DIR825C1 # Override hints with board values Modified: head/sys/mips/conf/TL-WDR4300 ============================================================================== --- head/sys/mips/conf/TL-WDR4300 Wed Aug 3 19:18:53 2016 (r303731) +++ head/sys/mips/conf/TL-WDR4300 Wed Aug 3 19:23:22 2016 (r303732) @@ -7,7 +7,7 @@ #NO_UNIVERSE # Include the default AR934x parameters -include "AR934X_BASE" +include "std.AR934X" ident TL-WDR4300 Copied and modified: head/sys/mips/conf/std.AR934X (from r303731, head/sys/mips/conf/AR934X_BASE) ============================================================================== --- head/sys/mips/conf/AR934X_BASE Wed Aug 3 19:18:53 2016 (r303731, copy source) +++ head/sys/mips/conf/std.AR934X Wed Aug 3 19:23:22 2016 (r303732) @@ -11,7 +11,7 @@ # machine mips mips -ident AR934X_BASE +#ident std.AR934X cpu CPU_MIPS74K makeoptions KERNLOADADDR=0x80050000 options HZ=1000 From owner-svn-src-head@freebsd.org Wed Aug 3 20:08:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70EBFBAE294; Wed, 3 Aug 2016 20:08:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 350FE1A29; Wed, 3 Aug 2016 20:08:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73K8dak047331; Wed, 3 Aug 2016 20:08:39 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73K8dWe047330; Wed, 3 Aug 2016 20:08:39 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201608032008.u73K8dWe047330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 3 Aug 2016 20:08:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303733 - head/contrib/libpcap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 20:08:40 -0000 Author: jkim Date: Wed Aug 3 20:08:39 2016 New Revision: 303733 URL: https://svnweb.freebsd.org/changeset/base/303733 Log: Support nanosecond time stamps for pcap_dispatch(3) and pcap_loop(3). Modified: head/contrib/libpcap/pcap-bpf.c Modified: head/contrib/libpcap/pcap-bpf.c ============================================================================== --- head/contrib/libpcap/pcap-bpf.c Wed Aug 3 19:23:22 2016 (r303732) +++ head/contrib/libpcap/pcap-bpf.c Wed Aug 3 20:08:39 2016 (r303733) @@ -431,6 +431,22 @@ pcap_create_interface(const char *device p->activate_op = pcap_activate_bpf; p->can_set_rfmon_op = pcap_can_set_rfmon_bpf; +#ifdef BIOCSTSTAMP + /* + * We claim that we support microsecond and nanosecond time + * stamps. + */ + p->tstamp_precision_count = 2; + p->tstamp_precision_list = malloc(2 * sizeof(u_int)); + if (p->tstamp_precision_list == NULL) { + snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s", + pcap_strerror(errno)); + free(p); + return NULL; + } + p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO; + p->tstamp_precision_list[1] = PCAP_TSTAMP_PRECISION_NANO; +#endif /* BIOCSTSTAMP */ return (p); } @@ -946,7 +962,11 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_h /* * Loop through each packet. */ +#ifdef BIOCSTSTAMP +#define bhp ((struct bpf_xhdr *)bp) +#else #define bhp ((struct bpf_hdr *)bp) +#endif ep = bp + cc; #ifdef PCAP_FDDIPAD pad = p->fddipad; @@ -1008,7 +1028,25 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_h if (pb->filtering_in_kernel || bpf_filter(p->fcode.bf_insns, datap, bhp->bh_datalen, caplen)) { struct pcap_pkthdr pkthdr; +#ifdef BIOCSTSTAMP + struct bintime bt; + + bt.sec = bhp->bh_tstamp.bt_sec; + bt.frac = bhp->bh_tstamp.bt_frac; + if (p->opt.tstamp_precision == PCAP_TSTAMP_PRECISION_NANO) { + struct timespec ts; + + bintime2timespec(&bt, &ts); + pkthdr.ts.tv_sec = ts.tv_sec; + pkthdr.ts.tv_usec = ts.tv_nsec; + } else { + struct timeval tv; + bintime2timeval(&bt, &tv); + pkthdr.ts.tv_sec = tv.tv_sec; + pkthdr.ts.tv_usec = tv.tv_usec; + } +#else pkthdr.ts.tv_sec = bhp->bh_tstamp.tv_sec; #ifdef _AIX /* @@ -1019,6 +1057,7 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_h #else pkthdr.ts.tv_usec = bhp->bh_tstamp.tv_usec; #endif +#endif /* BIOCSTSTAMP */ #ifdef PCAP_FDDIPAD if (caplen > pad) pkthdr.caplen = caplen - pad; @@ -2192,6 +2231,16 @@ pcap_activate_bpf(pcap_t *p) } } +#ifdef BIOCSTSTAMP + v = BPF_T_BINTIME; + if (ioctl(p->fd, BIOCSTSTAMP, &v) < 0) { + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSTSTAMP: %s", + pcap_strerror(errno)); + status = PCAP_ERROR; + goto bad; + } +#endif /* BIOCSTSTAMP */ + if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGBLEN: %s", pcap_strerror(errno)); From owner-svn-src-head@freebsd.org Wed Aug 3 20:12:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF8EBAE462; Wed, 3 Aug 2016 20:12:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id E3A3E1F48; Wed, 3 Aug 2016 20:12:46 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r303733 - head/contrib/libpcap To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201608032008.u73K8dWe047330@repo.freebsd.org> From: Jung-uk Kim Message-ID: Date: Wed, 3 Aug 2016 16:12:40 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201608032008.u73K8dWe047330@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wHX5hw7tTP1UnbAP7Bm98UoIsuMlrgMLA" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 20:12:47 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wHX5hw7tTP1UnbAP7Bm98UoIsuMlrgMLA Content-Type: multipart/mixed; boundary="t7bhlFvDMrinVIfWS8Eifbdsbh9wmvTn6" From: Jung-uk Kim To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r303733 - head/contrib/libpcap References: <201608032008.u73K8dWe047330@repo.freebsd.org> In-Reply-To: <201608032008.u73K8dWe047330@repo.freebsd.org> --t7bhlFvDMrinVIfWS8Eifbdsbh9wmvTn6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/03/16 04:08 PM, Jung-uk Kim wrote: > Author: jkim > Date: Wed Aug 3 20:08:39 2016 > New Revision: 303733 > URL: https://svnweb.freebsd.org/changeset/base/303733 >=20 > Log: > Support nanosecond time stamps for pcap_dispatch(3) and pcap_loop(3).= > > Modified: > head/contrib/libpcap/pcap-bpf.c Note the upstream accepted the patch: https://github.com/the-tcpdump-group/libpcap/commit/0957dac Jung-uk Kim --t7bhlFvDMrinVIfWS8Eifbdsbh9wmvTn6-- --wHX5hw7tTP1UnbAP7Bm98UoIsuMlrgMLA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXolA4AAoJEHyflib82/FG4MUH/jZG5cQNotNXnuXmBDIbEjzJ hfBfNpUENoWjzlH3AxievvLBhRmHWRlamR2W7EkAKPBM8oCX9H8uGNMZ+1YHzno2 MUVqUo1FoHhBkb31Q08dorP9gsPSNGB0FHRrxerqmK10xAC4NWDXmbWJofWQWEnz 4W5Tj3USbKZ9LiOERtNW+MDLBDcRiE8ltzcm7Jk5hp94CuDo41unhHOM6R1WFrkD PjMTRE9wh3kGBztzA3+rNJO03BcO0nNKhbl/rppmmz8PrkLfcwJqGQa1tdds3iEX d3rEVtEaXAEgzynrCo50t4WjWH/DQFzQJI0LbZUItg00Fo2vCOBUZyZ2ieRl5hc= =qrfc -----END PGP SIGNATURE----- --wHX5hw7tTP1UnbAP7Bm98UoIsuMlrgMLA-- From owner-svn-src-head@freebsd.org Wed Aug 3 20:21:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89E25BAE684; Wed, 3 Aug 2016 20:21:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53BBC1754; Wed, 3 Aug 2016 20:21:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73KLwR8053071; Wed, 3 Aug 2016 20:21:58 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73KLw3h053070; Wed, 3 Aug 2016 20:21:58 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201608032021.u73KLw3h053070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 3 Aug 2016 20:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303734 - head/contrib/libpcap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 20:21:59 -0000 Author: jkim Date: Wed Aug 3 20:21:58 2016 New Revision: 303734 URL: https://svnweb.freebsd.org/changeset/base/303734 Log: Fix a style(9) bug. Modified: head/contrib/libpcap/pcap-bpf.c Modified: head/contrib/libpcap/pcap-bpf.c ============================================================================== --- head/contrib/libpcap/pcap-bpf.c Wed Aug 3 20:08:39 2016 (r303733) +++ head/contrib/libpcap/pcap-bpf.c Wed Aug 3 20:21:58 2016 (r303734) @@ -442,7 +442,7 @@ pcap_create_interface(const char *device snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); free(p); - return NULL; + return (NULL); } p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO; p->tstamp_precision_list[1] = PCAP_TSTAMP_PRECISION_NANO; From owner-svn-src-head@freebsd.org Wed Aug 3 22:08:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87E3DBAE26D; Wed, 3 Aug 2016 22:08:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65F1E12B2; Wed, 3 Aug 2016 22:08:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73M87dA092876; Wed, 3 Aug 2016 22:08:07 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73M87SO092871; Wed, 3 Aug 2016 22:08:07 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608032208.u73M87SO092871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 3 Aug 2016 22:08:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303735 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 22:08:08 -0000 Author: pfg Date: Wed Aug 3 22:08:07 2016 New Revision: 303735 URL: https://svnweb.freebsd.org/changeset/base/303735 Log: indent(1): add new -sac and -U options. Add -sac (space after cast) and -nsac options. These control whether space character is put after a cast operator or not. Default is -nsac. Add -U option for providing a file containing list of types. This is needed for properly deciding which asterisks denote unary operation and which denote binary. These come from PostgreSQL. Reference: https://github.com/pstef/freebsd_indent/commit/84b00e3d46dfd6d955b2f481a1f3b275de9ad6d1 https://github.com/pstef/freebsd_indent/commit/49c52cf383fa2a246a1a22c6640a5a21b0f1fd90 Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent.1 head/usr.bin/indent/indent.c head/usr.bin/indent/indent_globs.h head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Wed Aug 3 20:21:58 2016 (r303734) +++ head/usr.bin/indent/args.c Wed Aug 3 22:08:07 2016 (r303735) @@ -74,8 +74,12 @@ __FBSDID("$FreeBSD$"); static void scan_profile(FILE *); +#define KEY_FILE 5 /* only used for args */ + const char *option_source = "?"; +void add_typedefs_from_file(const char *str); + /* * N.B.: because of the way the table here is scanned, options whose names are * substrings of other options must occur later; that is, with -lp vs -l, -lp @@ -91,6 +95,7 @@ struct pro { } pro[] = { {"T", PRO_SPECIAL, 0, KEY, 0}, + {"U", PRO_SPECIAL, 0, KEY_FILE, 0}, {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation}, {"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop}, {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations}, @@ -147,6 +152,7 @@ struct pro { {"npro", PRO_SPECIAL, 0, IGN, 0}, {"npsl", PRO_BOOL, true, OFF, &procnames_start_line}, {"nps", PRO_BOOL, false, OFF, &pointer_as_binop}, + {"nsac", PRO_BOOL, false, OFF, &space_after_cast}, {"nsc", PRO_BOOL, true, OFF, &star_comment_cont}, {"nsob", PRO_BOOL, false, OFF, &swallow_optional_blanklines}, {"nut", PRO_BOOL, true, OFF, &use_tabs}, @@ -154,6 +160,7 @@ struct pro { {"pcs", PRO_BOOL, false, ON, &proc_calls_space}, {"psl", PRO_BOOL, true, ON, &procnames_start_line}, {"ps", PRO_BOOL, false, ON, &pointer_as_binop}, + {"sac", PRO_BOOL, false, ON, &space_after_cast}, {"sc", PRO_BOOL, true, ON, &star_comment_cont}, {"sob", PRO_BOOL, false, ON, &swallow_optional_blanklines}, {"st", PRO_SPECIAL, 0, STDIN, 0}, @@ -295,6 +302,12 @@ found: } break; + case KEY_FILE: + if (*param_start == 0) + goto need_param; + add_typedefs_from_file(param_start); + break; + default: errx(1, "set_option: internal error: p_special %d", p->p_special); } @@ -323,3 +336,21 @@ found: errx(1, "set_option: internal error: p_type %d", p->p_type); } } + +void +add_typedefs_from_file(const char *str) +{ + FILE *file; + char line[BUFSIZ]; + + if ((file = fopen(str, "r")) == NULL) { + fprintf(stderr, "indent: cannot open file %s\n", str); + exit(1); + } + while ((fgets(line, BUFSIZ, file)) != NULL) { + /* Remove trailing whitespace */ + *(line + strcspn(line, " \t\n\r")) = '\0'; + addkey(strdup(line), 4); + } + fclose(file); +} Modified: head/usr.bin/indent/indent.1 ============================================================================== --- head/usr.bin/indent/indent.1 Wed Aug 3 20:21:58 2016 (r303734) +++ head/usr.bin/indent/indent.1 Wed Aug 3 22:08:07 2016 (r303735) @@ -30,7 +30,7 @@ .\" @(#)indent.1 8.1 (Berkeley) 7/1/93 .\" $FreeBSD$ .\" -.Dd March 3, 2012 +.Dd August 3, 2016 .Dt INDENT 1 .Os .Sh NAME @@ -74,6 +74,7 @@ .Op Fl npro .Op Fl pcs | Fl npcs .Op Fl psl | Fl npsl +.Op Fl sac | Fl nsac .Op Fl \&sc | Fl nsc .Bk -words .Op Fl sob | Fl nsob @@ -81,6 +82,7 @@ .Op Fl \&st .Op Fl \&ta .Op Fl troff +.Op Fl U Ns Ar file .Op Fl ut | Fl nut .Op Fl v | Fl \&nv .Sh DESCRIPTION @@ -378,6 +380,11 @@ column 1 \- their types, if any, will be The default is .Fl psl . +.It Fl sac , nsac +Control whether parenthesized type names in casts are followed by a space or +not. +The default is +.Fl nsac . .It Fl \&sc , nsc Enables (disables) the placement of asterisks (`*'s) at the left edge of all comments. @@ -430,6 +437,10 @@ listing in much the same spirit as .Xr vgrind 1 . If the output file is not specified, the default is standard output, rather than formatting in place. +.It Fl U Ns Ar file +Adds type names from +.Ar file +to the list of type keywords. .It Fl ut , nut Enables (disables) the use of tab characters in the output. Tabs are assumed to be aligned on columns divisible by 8. Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Wed Aug 3 20:21:58 2016 (r303734) +++ head/usr.bin/indent/indent.c Wed Aug 3 22:08:07 2016 (r303735) @@ -555,7 +555,7 @@ check_type: if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) { ps.last_u_d = true; ps.cast_mask &= (1 << ps.p_l_follow) - 1; - ps.want_blank = false; + ps.want_blank = space_after_cast; } else ps.want_blank = true; ps.not_cast_mask &= (1 << ps.p_l_follow) - 1; Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Wed Aug 3 20:21:58 2016 (r303734) +++ head/usr.bin/indent/indent_globs.h Wed Aug 3 22:08:07 2016 (r303735) @@ -212,6 +212,7 @@ int use_tabs; /* set true to use t * false uses all spaces */ int auto_typedefs; /* set true to recognize identifiers * ending in "_t" like typedefs */ +int space_after_cast; /* "b = (int) a" vs "b = (int)a" */ /* -troff font state information */ Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Wed Aug 3 20:21:58 2016 (r303734) +++ head/usr.bin/indent/lexi.c Wed Aug 3 22:08:07 2016 (r303735) @@ -64,7 +64,7 @@ struct templ { int rwcode; }; -struct templ specials[1000] = +struct templ specials[16384] = { {"switch", 7}, {"case", 8}, @@ -595,9 +595,10 @@ addkey(char *key, int val) return; else p++; - if (p >= specials + sizeof specials / sizeof specials[0]) - return; /* For now, table overflows are silently - * ignored */ + if (p >= specials + sizeof(specials) / sizeof(specials[0])) { + fprintf(stderr, "indent: typedef table overflow\n"); + exit(1); + } p->rwd = key; p->rwcode = val; p[1].rwd = NULL; From owner-svn-src-head@freebsd.org Thu Aug 4 01:49:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2C5CBAD0E5; Thu, 4 Aug 2016 01:49:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FAAF1385; Thu, 4 Aug 2016 01:49:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u741nIfi074832; Thu, 4 Aug 2016 01:49:18 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u741nIhX074831; Thu, 4 Aug 2016 01:49:18 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608040149.u741nIhX074831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 4 Aug 2016 01:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303736 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 01:49:19 -0000 Author: adrian Date: Thu Aug 4 01:49:18 2016 New Revision: 303736 URL: https://svnweb.freebsd.org/changeset/base/303736 Log: Add in tap/tun for openvpn-on-mips experiments. (FWIW, it does work.) Modified: head/sys/mips/conf/std.AR933X Modified: head/sys/mips/conf/std.AR933X ============================================================================== --- head/sys/mips/conf/std.AR933X Wed Aug 3 22:08:07 2016 (r303735) +++ head/sys/mips/conf/std.AR933X Thu Aug 4 01:49:18 2016 (r303736) @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR933X_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 urtwn urtwnfw otus otusfw" +makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 urtwn urtwnfw otus otusfw" options DDB options KDB From owner-svn-src-head@freebsd.org Thu Aug 4 03:40:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C669BAC053; Thu, 4 Aug 2016 03:40:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 4735D1EAB; Thu, 4 Aug 2016 03:40:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id D500D1A48E6; Thu, 4 Aug 2016 13:40:39 +1000 (AEST) Date: Thu, 4 Aug 2016 13:40:38 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jung-uk Kim cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303733 - head/contrib/libpcap In-Reply-To: <201608032008.u73K8dWe047330@repo.freebsd.org> Message-ID: <20160804124849.Y1045@besplex.bde.org> References: <201608032008.u73K8dWe047330@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=YDmY72k8xEVSsdaq3ocA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 03:40:43 -0000 On Wed, 3 Aug 2016, Jung-uk Kim wrote: > Log: > Support nanosecond time stamps for pcap_dispatch(3) and pcap_loop(3). > > Modified: > head/contrib/libpcap/pcap-bpf.c > > Modified: head/contrib/libpcap/pcap-bpf.c > ============================================================================== > --- head/contrib/libpcap/pcap-bpf.c Wed Aug 3 19:23:22 2016 (r303732) > +++ head/contrib/libpcap/pcap-bpf.c Wed Aug 3 20:08:39 2016 (r303733) > @@ -1008,7 +1028,25 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_h > if (pb->filtering_in_kernel || > bpf_filter(p->fcode.bf_insns, datap, bhp->bh_datalen, caplen)) { > struct pcap_pkthdr pkthdr; > +#ifdef BIOCSTSTAMP > + struct bintime bt; > + > + bt.sec = bhp->bh_tstamp.bt_sec; > + bt.frac = bhp->bh_tstamp.bt_frac; The names are very confusing since bt_sec and bt_frac are only misnamed as sec and frac in struct bintime. > + if (p->opt.tstamp_precision == PCAP_TSTAMP_PRECISION_NANO) { > + struct timespec ts; > + > + bintime2timespec(&bt, &ts); > + pkthdr.ts.tv_sec = ts.tv_sec; > + pkthdr.ts.tv_usec = ts.tv_nsec; And this abuses tv_usec to hold nanoseconds. Old code is even more confusing, and at least partly wrong. X contrib/libpcap/pcap-bpf.c: pkthdr.ts.tv_usec = bhp->bh_tstamp.tv_usec/1000; This is to convert for tv_usec actually being tv_nsec on AIX. If the above works with no conversion, then it might work for AIX too. X sys/net/bpf.c: struct timeval32 bh_tstamp; /* time stamp */ Banal comment. The complexities are from what sort of timestamp this is. It is obviously a timestamp. This bh_tstamp is in struct bpf_hdr32 for the !BURN_BRIDGES case. There is also struct timeval bh_timestamp in struct bpf_hdr. This header is bogusly marked Obsolete. X sys/net/bpf.c: hdr32_old.bh_tstamp.tv_usec = ts.bt_frac; This is in the !BURN_BRIDGES && COMPAT_FREEBSD32 case. Since struct timeval32 always has a 32-bit tv_usec, this assignment discards the most significant bits in bt_frac but keeps the noise. X sys/net/bpf.c: hdr_old.bh_tstamp.tv_usec = ts.bt_frac; This is in the !BURN_BRIDGES && !COMPAT_FREEBSD32 case. Since tv_sec in a normal timetamp is bogusly long, this accidentally preserves all of the bits in bt_frac on 64-bit arches. On 32-bit arches, it loses the signal as for the COMPAT_FREEBSD32 case. Bruce From owner-svn-src-head@freebsd.org Thu Aug 4 05:05:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F2AABAD546; Thu, 4 Aug 2016 05:05:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDABB1C33; Thu, 4 Aug 2016 05:05:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7455a1F051196; Thu, 4 Aug 2016 05:05:36 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7455anK051195; Thu, 4 Aug 2016 05:05:36 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608040505.u7455anK051195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 4 Aug 2016 05:05:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303737 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 05:05:37 -0000 Author: sephe Date: Thu Aug 4 05:05:35 2016 New Revision: 303737 URL: https://svnweb.freebsd.org/changeset/base/303737 Log: hyperv/storvsc: Claim SPC-3 conformance, thus enable UNMAP support The Hyper-V on pre-win10 systems will only report SPC-2 conformance, but it actually conforms to SPC-3. The INQUIRY response is adjusted to propagate the SPC-3 version information to CAM. Submitted by: Hongjiang Zhang MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7405 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Aug 4 01:49:18 2016 (r303736) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Aug 4 05:05:35 2016 (r303737) @@ -2124,8 +2124,8 @@ storvsc_io_done(struct hv_storvsc_reques * For more information about INQUIRY, please refer to: * ftp://ftp.avc-pioneer.com/Mtfuji_7/Proposal/Jun09/INQUIRY.pdf */ - const struct scsi_inquiry_data *inq_data = - (const struct scsi_inquiry_data *)csio->data_ptr; + struct scsi_inquiry_data *inq_data = + (struct scsi_inquiry_data *)csio->data_ptr; uint8_t* resp_buf = (uint8_t*)csio->data_ptr; /* Get the buffer length reported by host */ int resp_xfer_len = vm_srb->transfer_len; @@ -2154,6 +2154,25 @@ storvsc_io_done(struct hv_storvsc_reques mtx_unlock(&sc->hs_lock); } } else { + char vendor[16]; + cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), + sizeof(vendor)); + /** + * XXX: upgrade SPC2 to SPC3 if host is WIN8 or WIN2012 R2 + * in order to support UNMAP feature + */ + if (!strncmp(vendor,"Msft",4) && + SID_ANSI_REV(inq_data) == SCSI_REV_SPC2 && + (vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN8_1 || + vmstor_proto_version== VMSTOR_PROTOCOL_VERSION_WIN8)) { + inq_data->version = SCSI_REV_SPC3; + if (bootverbose) { + mtx_lock(&sc->hs_lock); + xpt_print(ccb->ccb_h.path, + "storvsc upgrades SPC2 to SPC3\n"); + mtx_unlock(&sc->hs_lock); + } + } ccb->ccb_h.status |= CAM_REQ_CMP; if (bootverbose) { mtx_lock(&sc->hs_lock); From owner-svn-src-head@freebsd.org Thu Aug 4 06:40:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F70ABAEE6F; Thu, 4 Aug 2016 06:40:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E13981738; Thu, 4 Aug 2016 06:40:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u746eqxB085035; Thu, 4 Aug 2016 06:40:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u746eqla085033; Thu, 4 Aug 2016 06:40:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608040640.u746eqla085033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 4 Aug 2016 06:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303738 - head/sys/boot/i386/libi386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 06:40:53 -0000 Author: avg Date: Thu Aug 4 06:40:51 2016 New Revision: 303738 URL: https://svnweb.freebsd.org/changeset/base/303738 Log: report sector size and number of sectors in lsdev output for bios disks MFC after: 3 weeks Modified: head/sys/boot/i386/libi386/biosdisk.c Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Thu Aug 4 05:05:35 2016 (r303737) +++ head/sys/boot/i386/libi386/biosdisk.c Thu Aug 4 06:40:51 2016 (r303738) @@ -315,9 +315,11 @@ bd_print(int verbose) pager_open(); for (i = 0; i < nbdinfo; i++) { - sprintf(line, " disk%d: BIOS drive %c:\n", i, + sprintf(line, " disk%d: BIOS drive %c (%ju X %u):\n", i, (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): - ('C' + bdinfo[i].bd_unit - 0x80)); + ('C' + bdinfo[i].bd_unit - 0x80), + (uintmax_t)bdinfo[i].bd_sectors, + bdinfo[i].bd_sectorsize); if (pager_output(line)) break; dev.d_dev = &biosdisk; From owner-svn-src-head@freebsd.org Thu Aug 4 10:49:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BEBEBAE2D1; Thu, 4 Aug 2016 10:49:01 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D1AB114B; Thu, 4 Aug 2016 10:49:01 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74An0Gq077900; Thu, 4 Aug 2016 10:49:00 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74An0Vr077899; Thu, 4 Aug 2016 10:49:00 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201608041049.u74An0Vr077899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Thu, 4 Aug 2016 10:49:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303739 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 10:49:01 -0000 Author: maxim Date: Thu Aug 4 10:49:00 2016 New Revision: 303739 URL: https://svnweb.freebsd.org/changeset/base/303739 Log: DragonFly 4.6.0 release added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Thu Aug 4 06:40:51 2016 (r303738) +++ head/share/misc/bsd-family-tree Thu Aug 4 10:49:00 2016 (r303739) @@ -338,7 +338,7 @@ FreeBSD 5.2 | | | | | | | DragonFly 4.4.1 | FreeBSD | | OpenBSD 5.9 | | 10.3 | | | | - | | | | | + | | | | DragonFly 4.6.0 *--FreeBSD | | | | | 11.0 | | | | | | | | | @@ -691,6 +691,7 @@ OpenBSD 5.8 2015-10-18 [OBD] DragonFly 4.4.1 2015-12-07 [DFB] OpenBSD 5.9 2016-03-29 [OBD] FreeBSD 10.3 2016-04-04 [FBD] +DragonFly 4.6.0 2016-08-02 [DFB] Bibliography ------------------------ From owner-svn-src-head@freebsd.org Thu Aug 4 11:22:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 907A1BAEFBC; Thu, 4 Aug 2016 11:22:52 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FD8B1920; Thu, 4 Aug 2016 11:22:52 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74BMptK092237; Thu, 4 Aug 2016 11:22:51 GMT (envelope-from pluknet@FreeBSD.org) Received: (from pluknet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74BMpkx092235; Thu, 4 Aug 2016 11:22:51 GMT (envelope-from pluknet@FreeBSD.org) Message-Id: <201608041122.u74BMpkx092235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pluknet set sender to pluknet@FreeBSD.org using -f From: Sergey Kandaurov Date: Thu, 4 Aug 2016 11:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303740 - in head: lib/libc/gen share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 11:22:52 -0000 Author: pluknet Date: Thu Aug 4 11:22:51 2016 New Revision: 303740 URL: https://svnweb.freebsd.org/changeset/base/303740 Log: mdoc: The .Fn function. Modified: head/lib/libc/gen/clock_getcpuclockid.3 head/share/man/man3/pthread_getcpuclockid.3 Modified: head/lib/libc/gen/clock_getcpuclockid.3 ============================================================================== --- head/lib/libc/gen/clock_getcpuclockid.3 Thu Aug 4 10:49:00 2016 (r303739) +++ head/lib/libc/gen/clock_getcpuclockid.3 Thu Aug 4 11:22:51 2016 (r303740) @@ -70,7 +70,9 @@ Upon successful completion, returns zero; otherwise, an error number is returned to indicate the error. .Sh ERRORS -The clock_getcpuclockid() function will fail if: +The +.Fn clock_getcpuclockid +function will fail if: .Bl -tag -width Er .It Bq Er EPERM The requesting process does not have permission to access the CPU-time Modified: head/share/man/man3/pthread_getcpuclockid.3 ============================================================================== --- head/share/man/man3/pthread_getcpuclockid.3 Thu Aug 4 10:49:00 2016 (r303739) +++ head/share/man/man3/pthread_getcpuclockid.3 Thu Aug 4 11:22:51 2016 (r303740) @@ -61,7 +61,9 @@ Upon successful completion, returns zero; otherwise, an error number is returned to indicate the error. .Sh ERRORS -The pthread_getcpuclockid() function will fail if: +The +.Fn pthread_getcpuclockid +function will fail if: .Bl -tag -width Er .It Bq Er ESRCH The value specified by From owner-svn-src-head@freebsd.org Thu Aug 4 11:38:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB638BAE433; Thu, 4 Aug 2016 11:38:54 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE2441222; Thu, 4 Aug 2016 11:38:54 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74BcrXP096166; Thu, 4 Aug 2016 11:38:53 GMT (envelope-from pluknet@FreeBSD.org) Received: (from pluknet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74BcrlU096164; Thu, 4 Aug 2016 11:38:53 GMT (envelope-from pluknet@FreeBSD.org) Message-Id: <201608041138.u74BcrlU096164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pluknet set sender to pluknet@FreeBSD.org using -f From: Sergey Kandaurov Date: Thu, 4 Aug 2016 11:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303742 - in head: lib/libc/gen share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 11:38:55 -0000 Author: pluknet Date: Thu Aug 4 11:38:53 2016 New Revision: 303742 URL: https://svnweb.freebsd.org/changeset/base/303742 Log: Grammar fixes. Modified: head/lib/libc/gen/clock_getcpuclockid.3 head/share/man/man3/pthread_getcpuclockid.3 Modified: head/lib/libc/gen/clock_getcpuclockid.3 ============================================================================== --- head/lib/libc/gen/clock_getcpuclockid.3 Thu Aug 4 11:26:52 2016 (r303741) +++ head/lib/libc/gen/clock_getcpuclockid.3 Thu Aug 4 11:38:53 2016 (r303742) @@ -86,7 +86,7 @@ No process can be found corresponding to .Sh STANDARDS The .Fn clock_getcpuclockid -function conform to +function conforms to .St -p1003.1-2001 . .Sh HISTORY The Modified: head/share/man/man3/pthread_getcpuclockid.3 ============================================================================== --- head/share/man/man3/pthread_getcpuclockid.3 Thu Aug 4 11:26:52 2016 (r303741) +++ head/share/man/man3/pthread_getcpuclockid.3 Thu Aug 4 11:38:53 2016 (r303742) @@ -51,8 +51,8 @@ The .Fn pthread_getcpuclockid returns the clock ID of the CPU-time clock of the thread specified by -.Fa thread_id . -If the thread described by +.Fa thread_id , +if the thread described by .Fa thread_id exists. .Sh RETURN VALUES From owner-svn-src-head@freebsd.org Thu Aug 4 13:45:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FAA1BAE872; Thu, 4 Aug 2016 13:45:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DD0716D2; Thu, 4 Aug 2016 13:45:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74DjIoS044107; Thu, 4 Aug 2016 13:45:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74DjIxP044104; Thu, 4 Aug 2016 13:45:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201608041345.u74DjIxP044104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 4 Aug 2016 13:45:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303743 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 13:45:19 -0000 Author: trasz Date: Thu Aug 4 13:45:18 2016 New Revision: 303743 URL: https://svnweb.freebsd.org/changeset/base/303743 Log: Remove unused - never actually implemented - vnode lock types from vnode_if.src. MFC after: 1 month Modified: head/sys/kern/vfs_subr.c head/sys/kern/vnode_if.src head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Aug 4 11:38:53 2016 (r303742) +++ head/sys/kern/vfs_subr.c Thu Aug 4 13:45:18 2016 (r303743) @@ -4465,25 +4465,6 @@ assert_vop_elocked(struct vnode *vp, con if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) != LK_EXCLUSIVE) vfs_badlock("is not exclusive locked but should be", str, vp); } - -#if 0 -void -assert_vop_elocked_other(struct vnode *vp, const char *str) -{ - - if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) != LK_EXCLOTHER) - vfs_badlock("is not exclusive locked by another thread", - str, vp); -} - -void -assert_vop_slocked(struct vnode *vp, const char *str) -{ - - if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) != LK_SHARED) - vfs_badlock("is not locked shared but should be", str, vp); -} -#endif /* 0 */ #endif /* DEBUG_VFS_LOCKS */ void Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Thu Aug 4 11:38:53 2016 (r303742) +++ head/sys/kern/vnode_if.src Thu Aug 4 13:45:18 2016 (r303743) @@ -40,10 +40,7 @@ # # The locking value can take the following values: # L: locked; not converted to type of lock. -# A: any lock type. -# S: locked with shared lock. # E: locked with exclusive lock for this process. -# O: locked with exclusive lock for other process. # U: unlocked. # -: not applicable. vnode does not yet (or no longer) exists. # =: the same on input and output, may be either L or U. Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Aug 4 11:38:53 2016 (r303742) +++ head/sys/sys/vnode.h Thu Aug 4 13:45:18 2016 (r303743) @@ -517,25 +517,13 @@ extern struct vnodeop_desc *vnodeop_desc void assert_vi_locked(struct vnode *vp, const char *str); void assert_vi_unlocked(struct vnode *vp, const char *str); void assert_vop_elocked(struct vnode *vp, const char *str); -#if 0 -void assert_vop_elocked_other(struct vnode *vp, const char *str); -#endif void assert_vop_locked(struct vnode *vp, const char *str); -#if 0 -voi0 assert_vop_slocked(struct vnode *vp, const char *str); -#endif void assert_vop_unlocked(struct vnode *vp, const char *str); #define ASSERT_VI_LOCKED(vp, str) assert_vi_locked((vp), (str)) #define ASSERT_VI_UNLOCKED(vp, str) assert_vi_unlocked((vp), (str)) #define ASSERT_VOP_ELOCKED(vp, str) assert_vop_elocked((vp), (str)) -#if 0 -#define ASSERT_VOP_ELOCKED_OTHER(vp, str) assert_vop_locked_other((vp), (str)) -#endif #define ASSERT_VOP_LOCKED(vp, str) assert_vop_locked((vp), (str)) -#if 0 -#define ASSERT_VOP_SLOCKED(vp, str) assert_vop_slocked((vp), (str)) -#endif #define ASSERT_VOP_UNLOCKED(vp, str) assert_vop_unlocked((vp), (str)) #else /* !DEBUG_VFS_LOCKS */ @@ -543,13 +531,7 @@ void assert_vop_unlocked(struct vnode *v #define ASSERT_VI_LOCKED(vp, str) ((void)0) #define ASSERT_VI_UNLOCKED(vp, str) ((void)0) #define ASSERT_VOP_ELOCKED(vp, str) ((void)0) -#if 0 -#define ASSERT_VOP_ELOCKED_OTHER(vp, str) -#endif #define ASSERT_VOP_LOCKED(vp, str) ((void)0) -#if 0 -#define ASSERT_VOP_SLOCKED(vp, str) -#endif #define ASSERT_VOP_UNLOCKED(vp, str) ((void)0) #endif /* DEBUG_VFS_LOCKS */ From owner-svn-src-head@freebsd.org Thu Aug 4 13:49:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CED40BAE9A6; Thu, 4 Aug 2016 13:49:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91C141989; Thu, 4 Aug 2016 13:49:37 +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 u74Dna8X044281; Thu, 4 Aug 2016 13:49:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74DnauZ044280; Thu, 4 Aug 2016 13:49:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201608041349.u74DnauZ044280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 4 Aug 2016 13:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303744 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 13:49:37 -0000 Author: andrew Date: Thu Aug 4 13:49:36 2016 New Revision: 303744 URL: https://svnweb.freebsd.org/changeset/base/303744 Log: Remove the pvh_global_lock lock from the arm64 pmap. It is unneeded on arm64 as invalidation will have completed before the pmap_invalidate_* functions have complete. Discussed with: alc, kib 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 Thu Aug 4 13:45:18 2016 (r303743) +++ head/sys/arm64/arm64/pmap.c Thu Aug 4 13:49:36 2016 (r303744) @@ -218,8 +218,6 @@ vm_offset_t kernel_vm_end = 0; struct msgbuf *msgbufp = NULL; -static struct rwlock_padalign pvh_global_lock; - vm_paddr_t dmap_phys_base; /* The start of the dmap region */ vm_paddr_t dmap_phys_max; /* The limit of the dmap region */ vm_offset_t dmap_max_addr; /* The virtual address limit of the dmap */ @@ -671,11 +669,6 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offs kernel_pmap_store.pm_l0 = (pd_entry_t *)l0pt; PMAP_LOCK_INIT(kernel_pmap); - /* - * Initialize the global pv list lock. - */ - rw_init(&pvh_global_lock, "pmap pv global"); - /* Assume the address we were loaded to is a valid physical address */ min_pa = max_pa = KERNBASE - kern_delta; @@ -1404,9 +1397,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); - rw_runlock(&pvh_global_lock); VM_WAIT; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); } @@ -1748,7 +1739,6 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv struct pv_chunk *pc; int idx, field, bit; - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(atomic_add_long(&pv_entry_frees, 1)); PV_STAT(atomic_add_int(&pv_entry_spare, 1)); @@ -1805,7 +1795,6 @@ get_pv_entry(pmap_t pmap, struct rwlock struct pv_chunk *pc; vm_page_t m; - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(atomic_add_long(&pv_entry_allocs, 1)); retry: @@ -1873,7 +1862,6 @@ pmap_pvh_remove(struct md_page *pvh, pma { pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_LOCKED); TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) { if (pmap == PV_PMAP(pv) && va == pv->pv_va) { TAILQ_REMOVE(&pvh->pv_list, pv, pv_next); @@ -1909,7 +1897,6 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm { pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* Pass NULL instead of the lock pointer to disable reclamation. */ if ((pv = get_pv_entry(pmap, NULL)) != NULL) { @@ -1978,7 +1965,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva anyvalid = 0; SLIST_INIT(&free); - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); lock = NULL; @@ -2057,7 +2043,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva rw_wunlock(lock); if (anyvalid) pmap_invalidate_all(pmap); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(&free); } @@ -2080,18 +2065,31 @@ pmap_remove_all(vm_page_t m) { pv_entry_t pv; pmap_t pmap; + struct rwlock *lock; pd_entry_t *pde, tpde; pt_entry_t *pte, tpte; struct spglist free; - int lvl; + int lvl, md_gen; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); SLIST_INIT(&free); - rw_wlock(&pvh_global_lock); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); +retry: + rw_wlock(lock); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); + if (!PMAP_TRYLOCK(pmap)) { + md_gen = m->md.pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (md_gen != m->md.pv_gen) { + rw_wunlock(lock); + PMAP_UNLOCK(pmap); + goto retry; + } + } pmap_resident_count_dec(pmap, 1); pde = pmap_pde(pmap, pv->pv_va, &lvl); @@ -2126,7 +2124,7 @@ pmap_remove_all(vm_page_t m) PMAP_UNLOCK(pmap); } vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_wunlock(&pvh_global_lock); + rw_wunlock(lock); pmap_free_zero_pages(&free); } @@ -2241,7 +2239,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, mpte = NULL; lock = NULL; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); if (va < VM_MAXUSER_ADDRESS) { @@ -2251,7 +2248,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, CTR0(KTR_PMAP, "pmap_enter: mpte == NULL"); if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); return (KERN_RESOURCE_SHORTAGE); } @@ -2433,7 +2429,6 @@ validate: if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); return (KERN_SUCCESS); } @@ -2465,7 +2460,6 @@ pmap_enter_object(pmap_t pmap, vm_offset mpte = NULL; m = m_start; lock = NULL; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); @@ -2474,7 +2468,6 @@ pmap_enter_object(pmap_t pmap, vm_offset } if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2493,12 +2486,10 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ struct rwlock *lock; lock = NULL; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL, &lock); if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2515,7 +2506,6 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); CTR2(KTR_PMAP, "pmap_enter_quick_locked: %p %lx", pmap, va); @@ -2644,9 +2634,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva vm_offset_t va_next; pd_entry_t *l0, *l1, *l2; pt_entry_t *l3; - boolean_t pv_lists_locked; - pv_lists_locked = FALSE; PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { l0 = pmap_l0(pmap, sva); @@ -2692,8 +2680,6 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva pmap->pm_stats.wired_count--; } } - if (pv_lists_locked) - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2837,7 +2823,6 @@ pmap_page_exists_quick(pmap_t pmap, vm_p KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_rlock(lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { @@ -2850,7 +2835,6 @@ pmap_page_exists_quick(pmap_t pmap, vm_p break; } rw_runlock(lock); - rw_runlock(&pvh_global_lock); return (rv); } @@ -2871,7 +2855,6 @@ pmap_page_wired_mappings(vm_page_t m) if ((m->oflags & VPO_UNMANAGED) != 0) return (0); - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_rlock(lock); restart: @@ -2894,7 +2877,6 @@ restart: PMAP_UNLOCK(pmap); } rw_runlock(lock); - rw_runlock(&pvh_global_lock); return (count); } @@ -2932,7 +2914,6 @@ pmap_remove_pages(pmap_t pmap) lock = NULL; SLIST_INIT(&free); - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { allfree = 1; @@ -3018,7 +2999,6 @@ pmap_remove_pages(pmap_t pmap) pmap_invalidate_all(pmap); if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(&free); } @@ -3039,7 +3019,6 @@ pmap_page_test_mappings(vm_page_t m, boo boolean_t rv; rv = FALSE; - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_rlock(lock); restart: @@ -3075,7 +3054,6 @@ restart: } out: rw_runlock(lock); - rw_runlock(&pvh_global_lock); return (rv); } @@ -3164,7 +3142,6 @@ pmap_remove_write(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(m->object); if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); retry_pv_loop: rw_wlock(lock); @@ -3196,7 +3173,6 @@ retry: } rw_wunlock(lock); vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_runlock(&pvh_global_lock); } static __inline boolean_t @@ -3238,7 +3214,6 @@ pmap_ts_referenced(vm_page_t m) cleared = 0; pa = VM_PAGE_TO_PHYS(m); lock = PHYS_TO_PV_LIST_LOCK(pa); - rw_rlock(&pvh_global_lock); rw_wlock(lock); retry: not_cleared = 0; @@ -3307,7 +3282,6 @@ retry: not_cleared < PMAP_TS_REFERENCED_MAX); out: rw_wunlock(lock); - rw_runlock(&pvh_global_lock); pmap_free_zero_pages(&free); return (cleared + not_cleared); } From owner-svn-src-head@freebsd.org Thu Aug 4 15:27:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1240DBAF1F8; Thu, 4 Aug 2016 15:27:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C00951921; Thu, 4 Aug 2016 15:27:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74FR9G1083061; Thu, 4 Aug 2016 15:27:09 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74FR9xo083057; Thu, 4 Aug 2016 15:27:09 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608041527.u74FR9xo083057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 4 Aug 2016 15:27:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303746 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 15:27:11 -0000 Author: pfg Date: Thu Aug 4 15:27:09 2016 New Revision: 303746 URL: https://svnweb.freebsd.org/changeset/base/303746 Log: indent(1): Use bsearch() for looking up type keywords. Reference: https://github.com/pstef/freebsd_indent/commit/f3b8e6e57fd47364b2360b44011a2fad5d11adc7 Submitted by: Piotr Stefaniak Differential Revision: https://reviews.freebsd.org/D6966 Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent.c head/usr.bin/indent/indent.h head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Thu Aug 4 14:34:33 2016 (r303745) +++ head/usr.bin/indent/args.c Thu Aug 4 15:27:09 2016 (r303746) @@ -298,7 +298,7 @@ found: char *str = strdup(param_start); if (str == NULL) err(1, NULL); - addkey(str, 4); + add_typename(str); } break; @@ -342,6 +342,7 @@ add_typedefs_from_file(const char *str) { FILE *file; char line[BUFSIZ]; + char *copy; if ((file = fopen(str, "r")) == NULL) { fprintf(stderr, "indent: cannot open file %s\n", str); @@ -349,8 +350,11 @@ add_typedefs_from_file(const char *str) } while ((fgets(line, BUFSIZ, file)) != NULL) { /* Remove trailing whitespace */ - *(line + strcspn(line, " \t\n\r")) = '\0'; - addkey(strdup(line), 4); + line[strcspn(line, " \t\n\r")] = '\0'; + if ((copy = strdup(line)) == NULL) { + err(1, NULL); + } + add_typename(copy); } fclose(file); } Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Thu Aug 4 14:34:33 2016 (r303745) +++ head/usr.bin/indent/indent.c Thu Aug 4 15:27:09 2016 (r303746) @@ -119,6 +119,7 @@ main(int argc, char **argv) tokenbuf = (char *) malloc(bufsize); if (tokenbuf == NULL) err(1, NULL); + alloc_typenames(); l_com = combuf + bufsize - 5; l_lab = labbuf + bufsize - 5; l_code = codebuf + bufsize - 5; Modified: head/usr.bin/indent/indent.h ============================================================================== --- head/usr.bin/indent/indent.h Thu Aug 4 14:34:33 2016 (r303745) +++ head/usr.bin/indent/indent.h Thu Aug 4 15:27:09 2016 (r303746) @@ -28,7 +28,8 @@ __FBSDID("$FreeBSD$"); #endif -void addkey(char *, int); +void add_typename(const char *); +void alloc_typenames(void); int compute_code_target(void); int compute_label_target(void); int count_spaces(int, char *); Modified: head/usr.bin/indent/lexi.c ============================================================================== --- head/usr.bin/indent/lexi.c Thu Aug 4 14:34:33 2016 (r303745) +++ head/usr.bin/indent/lexi.c Thu Aug 4 15:27:09 2016 (r303746) @@ -64,42 +64,49 @@ struct templ { int rwcode; }; -struct templ specials[16384] = +/* + * This table has to be sorted alphabetically, because it'll be used in binary + * search. For the same reason, string must be the first thing in struct templ. + */ +struct templ specials[] = { - {"switch", 7}, - {"case", 8}, {"break", 9}, - {"struct", 3}, - {"union", 3}, - {"enum", 3}, - {"default", 8}, - {"int", 4}, + {"case", 8}, {"char", 4}, - {"float", 4}, + {"const", 4}, + {"default", 8}, + {"do", 6}, {"double", 4}, + {"else", 6}, + {"enum", 3}, + {"extern", 4}, + {"float", 4}, + {"for", 5}, + {"global", 4}, + {"goto", 9}, + {"if", 5}, + {"int", 4}, {"long", 4}, + {"offsetof", 1}, + {"register", 4}, + {"return", 9}, {"short", 4}, + {"sizeof", 2}, + {"static", 4}, + {"struct", 3}, + {"switch", 7}, {"typedef", 4}, + {"union", 3}, {"unsigned", 4}, - {"register", 4}, - {"static", 4}, - {"global", 4}, - {"extern", 4}, {"void", 4}, - {"const", 4}, {"volatile", 4}, - {"goto", 9}, - {"return", 9}, - {"if", 5}, - {"while", 5}, - {"for", 5}, - {"else", 6}, - {"do", 6}, - {"sizeof", 2}, - {"offsetof", 1}, - {0, 0} + {"while", 5} }; +const char **typenames; +int typename_count; +int typename_top = -1; + char chartype[128] = { /* this is used to facilitate the decision of * what type (alphanumeric, operator) each @@ -122,6 +129,12 @@ char chartype[128] = 1, 1, 1, 0, 3, 0, 3, 0 }; +static int +strcmp_type(const void *e1, const void *e2) +{ + return (strcmp(e1, *(const char * const *)e2)); +} + int lexi(void) { @@ -150,9 +163,6 @@ lexi(void) /* * we have a character or number */ - const char *j; /* used for searching thru list of - * - * reserved words */ struct templ *p; if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) { @@ -247,37 +257,24 @@ lexi(void) last_code = ident; /* Remember that this is the code we will * return */ - if (auto_typedefs) { - const char *q = s_token; - size_t q_len = strlen(q); - /* Check if we have an "_t" in the end */ - if (q_len > 2 && - (strcmp(q + q_len - 2, "_t") == 0)) { - ps.keyword = 4; /* a type name */ + p = bsearch(s_token, + specials, + sizeof(specials) / sizeof(specials[0]), + sizeof(specials[0]), + strcmp_type); + if (p == NULL) { /* not a special keyword... */ + char *u; + + /* ... so maybe a type_t or a typedef */ + if ((auto_typedefs && ((u = strrchr(s_token, '_')) != NULL) && + strcmp(u, "_t") == 0) || (typename_top >= 0 && + bsearch(s_token, typenames, typename_top + 1, + sizeof(typenames[0]), strcmp_type))) { + ps.keyword = 4; /* a type name */ ps.last_u_d = true; - goto found_auto_typedef; + goto found_typename; } - } - - /* - * This loop will check if the token is a keyword. - */ - for (p = specials; (j = p->rwd) != NULL; p++) { - const char *q = s_token; /* point at scanned token */ - if (*j++ != *q++ || *j++ != *q++) - continue; /* This test depends on the fact that - * identifiers are always at least 1 character - * long (ie. the first two bytes of the - * identifier are always meaningful) */ - if (q[-1] == 0) - break; /* If its a one-character identifier */ - while (*q++ == *j) - if (*j++ == 0) - goto found_keyword; /* I wish that C had a multi-level - * break... */ - } - if (p->rwd) { /* we have a keyword */ - found_keyword: + } else { /* we have a keyword */ ps.keyword = p->rwcode; ps.last_u_d = true; switch (p->rwcode) { @@ -295,7 +292,7 @@ lexi(void) /* FALLTHROUGH */ case 4: /* one of the declaration keywords */ - found_auto_typedef: + found_typename: if (ps.p_l_follow) { /* inside parens: cast, param list, offsetof or sizeof */ ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.not_cast_mask; @@ -583,24 +580,43 @@ stop_lit: return (code); } -/* - * Add the given keyword to the keyword table, using val as the keyword type - */ void -addkey(char *key, int val) +alloc_typenames(void) +{ + + typenames = (const char **)malloc(sizeof(typenames[0]) * + (typename_count = 16)); + if (typenames == NULL) + err(1, NULL); +} + +void +add_typename(const char *key) { - struct templ *p = specials; - while (p->rwd) - if (p->rwd[0] == key[0] && strcmp(p->rwd, key) == 0) + int comparison; + + if (typename_top + 1 >= typename_count) { + typenames = realloc((void *)typenames, + sizeof(typenames[0]) * (typename_count *= 2)); + if (typenames == NULL) + err(1, NULL); + } + if (typename_top == -1) + typenames[++typename_top] = key; + else if ((comparison = strcmp(key, typenames[typename_top])) >= 0) { + /* take advantage of sorted input */ + if (comparison != 0) /* remove duplicates */ + typenames[++typename_top] = key; + } + else { + int p; + + for (p = 0; (comparison = strcmp(key, typenames[p])) >= 0; p++) + /* find place for the new key */; + if (comparison == 0) /* remove duplicates */ return; - else - p++; - if (p >= specials + sizeof(specials) / sizeof(specials[0])) { - fprintf(stderr, "indent: typedef table overflow\n"); - exit(1); + memmove(&typenames[p + 1], &typenames[p], + sizeof(typenames[0]) * (++typename_top - p)); + typenames[p] = key; } - p->rwd = key; - p->rwcode = val; - p[1].rwd = NULL; - p[1].rwcode = 0; } From owner-svn-src-head@freebsd.org Thu Aug 4 16:20:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09F63BAFF23; Thu, 4 Aug 2016 16:20:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C22D21A45; Thu, 4 Aug 2016 16:20:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74GKDrC002024; Thu, 4 Aug 2016 16:20:13 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74GKDOa002023; Thu, 4 Aug 2016 16:20:13 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201608041620.u74GKDOa002023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 4 Aug 2016 16:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303747 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 16:20:14 -0000 Author: alc Date: Thu Aug 4 16:20:12 2016 New Revision: 303747 URL: https://svnweb.freebsd.org/changeset/base/303747 Log: Clean up the comments and code style in and around vm_pageout_cluster(). In particular, fix factual, grammatical, and spelling errors in various comments, and remove comments that are out of place in this function. Reviewed by: kib, markj MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7410 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Thu Aug 4 15:27:09 2016 (r303746) +++ head/sys/vm/vm_pageout.c Thu Aug 4 16:20:12 2016 (r303747) @@ -355,41 +355,28 @@ vm_pageout_page_lock(vm_page_t m, vm_pag } /* - * vm_pageout_clean: - * - * Clean the page and remove it from the laundry. - * - * We set the busy bit to cause potential page faults on this page to - * block. Note the careful timing, however, the busy bit isn't set till - * late and we cannot do anything that will mess with the page. + * Scan for pages at adjacent offsets within the given page's object that are + * eligible for laundering, form a cluster of these pages and the given page, + * and launder that cluster. */ static int vm_pageout_cluster(vm_page_t m) { vm_object_t object; - vm_page_t mc[2*vm_pageout_page_count], pb, ps; - int pageout_count; - int ib, is, page_base; - vm_pindex_t pindex = m->pindex; + vm_page_t mc[2 * vm_pageout_page_count], p, pb, ps; + vm_pindex_t pindex; + int ib, is, page_base, pageout_count; - vm_page_lock_assert(m, MA_OWNED); + vm_page_assert_locked(m); object = m->object; VM_OBJECT_ASSERT_WLOCKED(object); + pindex = m->pindex; /* - * It doesn't cost us anything to pageout OBJT_DEFAULT or OBJT_SWAP - * with the new swapper, but we could have serious problems paging - * out other object types if there is insufficient memory. - * - * Unfortunately, checking free memory here is far too late, so the - * check has been moved up a procedural level. - */ - - /* - * Can't clean the page if it's busy or held. + * We can't clean the page if it is busy or held. */ vm_page_assert_unbusied(m); - KASSERT(m->hold_count == 0, ("vm_pageout_clean: page %p is held", m)); + KASSERT(m->hold_count == 0, ("page %p is held", m)); vm_page_unlock(m); mc[vm_pageout_page_count] = pb = ps = m; @@ -399,33 +386,23 @@ vm_pageout_cluster(vm_page_t m) is = 1; /* - * Scan object for clusterable pages. - * - * We can cluster ONLY if: ->> the page is NOT - * clean, wired, busy, held, or mapped into a - * buffer, and one of the following: - * 1) The page is inactive, or a seldom used - * active page. - * -or- - * 2) we force the issue. + * We can cluster only if the page is not clean, busy, or held, and + * the page is inactive. * * During heavy mmap/modification loads the pageout * daemon can really fragment the underlying file - * due to flushing pages out of order and not trying - * align the clusters (which leave sporatic out-of-order + * due to flushing pages out of order and not trying to + * align the clusters (which leaves sporadic out-of-order * holes). To solve this problem we do the reverse scan * first and attempt to align our cluster, then do a * forward scan if room remains. */ more: - while (ib && pageout_count < vm_pageout_page_count) { - vm_page_t p; - + while (ib != 0 && pageout_count < vm_pageout_page_count) { if (ib > pindex) { ib = 0; break; } - if ((p = vm_page_prev(pb)) == NULL || vm_page_busied(p)) { ib = 0; break; @@ -446,18 +423,16 @@ more: mc[--page_base] = pb = p; ++pageout_count; ++ib; + /* - * alignment boundary, stop here and switch directions. Do - * not clear ib. + * We are at an alignment boundary. Stop here, and switch + * directions. Do not clear ib. */ if ((pindex - (ib - 1)) % vm_pageout_page_count == 0) break; } - while (pageout_count < vm_pageout_page_count && pindex + is < object->size) { - vm_page_t p; - if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p)) break; vm_page_test_dirty(p); @@ -477,15 +452,12 @@ more: /* * If we exhausted our forward scan, continue with the reverse scan - * when possible, even past a page boundary. This catches boundary - * conditions. + * when possible, even past an alignment boundary. This catches + * boundary conditions. */ - if (ib && pageout_count < vm_pageout_page_count) + if (ib != 0 && pageout_count < vm_pageout_page_count) goto more; - /* - * we allow reads during pageouts... - */ return (vm_pageout_flush(&mc[page_base], pageout_count, 0, 0, NULL, NULL)); } From owner-svn-src-head@freebsd.org Thu Aug 4 17:29:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BDE0BAD01E; Thu, 4 Aug 2016 17:29:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 254581658; Thu, 4 Aug 2016 17:29:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74HTgpW028341; Thu, 4 Aug 2016 17:29:42 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74HTg4G028340; Thu, 4 Aug 2016 17:29:42 GMT (envelope-from np@FreeBSD.org) Message-Id: <201608041729.u74HTg4G028340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 4 Aug 2016 17:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303750 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 17:29:43 -0000 Author: np Date: Thu Aug 4 17:29:42 2016 New Revision: 303750 URL: https://svnweb.freebsd.org/changeset/base/303750 Log: cxgbe/t4_tom: The page pod arena allocates from pod address space and not index space. The minimum valid allocation out of this arena is the size of a single page pod. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_ddp.c Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Thu Aug 4 17:26:32 2016 (r303749) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Thu Aug 4 17:29:42 2016 (r303750) @@ -1087,7 +1087,7 @@ t4_init_ddp(struct adapter *sc, struct t td->ppod_start = sc->vres.ddp.start; td->ppod_arena = vmem_create("DDP page pods", sc->vres.ddp.start, - sc->vres.ddp.size, 1, 32, M_FIRSTFIT | M_NOWAIT); + sc->vres.ddp.size, PPOD_SIZE, 512, M_FIRSTFIT | M_NOWAIT); } void From owner-svn-src-head@freebsd.org Thu Aug 4 17:45:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81B09BAD615; Thu, 4 Aug 2016 17:45:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 433881469; Thu, 4 Aug 2016 17:45:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74HjaPU036193; Thu, 4 Aug 2016 17:45:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74HjaHA036188; Thu, 4 Aug 2016 17:45:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608041745.u74HjaHA036188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 4 Aug 2016 17:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303751 - in head/sys/dev/etherswitch: . arswitch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 17:45:37 -0000 Author: adrian Date: Thu Aug 4 17:45:35 2016 New Revision: 303751 URL: https://svnweb.freebsd.org/changeset/base/303751 Log: [etherswitch] add in an initial API for controlling per-port LED behaviour. This is just implemented for the AR8327 for now. Submitted by: Dan Nelson Modified: head/sys/dev/etherswitch/arswitch/arswitch.c head/sys/dev/etherswitch/arswitch/arswitch_8327.c head/sys/dev/etherswitch/arswitch/arswitch_8327.h head/sys/dev/etherswitch/arswitch/arswitchvar.h head/sys/dev/etherswitch/etherswitch.h Modified: head/sys/dev/etherswitch/arswitch/arswitch.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c Thu Aug 4 17:29:42 2016 (r303750) +++ head/sys/dev/etherswitch/arswitch/arswitch.c Thu Aug 4 17:45:35 2016 (r303751) @@ -77,6 +77,14 @@ static SYSCTL_NODE(_debug, OID_AUTO, arswitch, CTLFLAG_RD, 0, "arswitch"); #endif +/* Map ETHERSWITCH_PORT_LED_* to Atheros pattern codes */ +static int led_pattern_table[] = { + [ETHERSWITCH_PORT_LED_DEFAULT] = 0x3, + [ETHERSWITCH_PORT_LED_ON] = 0x2, + [ETHERSWITCH_PORT_LED_OFF] = 0x0, + [ETHERSWITCH_PORT_LED_BLINK] = 0x1 +}; + static inline int arswitch_portforphy(int phy); static void arswitch_tick(void *arg); static int arswitch_ifmedia_upd(struct ifnet *); @@ -85,6 +93,8 @@ static int ar8xxx_port_vlan_setup(struct etherswitch_port_t *p); static int ar8xxx_port_vlan_get(struct arswitch_softc *sc, etherswitch_port_t *p); +static int arswitch_setled(struct arswitch_softc *sc, int phy, int led, + int style); static int arswitch_probe(device_t dev) @@ -188,9 +198,23 @@ arswitch_attach_phys(struct arswitch_sof device_printf(sc->sc_dev, "attaching PHY %d failed\n", phy); + return (err); + } + + if (AR8X16_IS_SWITCH(sc, AR8327)) { + int led; + char ledname[IFNAMSIZ+4]; + + for (led = 0; led < 3; led++) { + sprintf(ledname, "%s%dled%d", name, + arswitch_portforphy(phy), led+1); + sc->dev_led[phy][led].sc = sc; + sc->dev_led[phy][led].phy = phy; + sc->dev_led[phy][led].lednum = led; + } } } - return (err); + return (0); } static int @@ -683,6 +707,38 @@ arswitch_getport(device_t dev, etherswit } else { return (ENXIO); } + + if (!arswitch_is_cpuport(sc, p->es_port) && + AR8X16_IS_SWITCH(sc, AR8327)) { + int led; + p->es_nleds = 3; + + for (led = 0; led < p->es_nleds; led++) + { + int style; + uint32_t val; + + /* Find the right style enum for our pattern */ + val = arswitch_readreg(dev, + ar8327_led_mapping[p->es_port-1][led].reg); + val = (val>>ar8327_led_mapping[p->es_port-1][led].shift)&0x03; + + for (style = 0; style < ETHERSWITCH_PORT_LED_MAX; style++) + { + if (led_pattern_table[style] == val) break; + } + + /* can't happen */ + if (style == ETHERSWITCH_PORT_LED_MAX) + style = ETHERSWITCH_PORT_LED_DEFAULT; + + p->es_led[led] = style; + } + } else + { + p->es_nleds = 0; + } + return (0); } @@ -727,7 +783,7 @@ ar8xxx_port_vlan_setup(struct arswitch_s static int arswitch_setport(device_t dev, etherswitch_port_t *p) { - int err; + int err, i; struct arswitch_softc *sc; struct ifmedia *ifm; struct mii_data *mii; @@ -744,9 +800,20 @@ arswitch_setport(device_t dev, etherswit return (err); } - /* Do not allow media changes on CPU port. */ + /* Do not allow media or led changes on CPU port. */ if (arswitch_is_cpuport(sc, p->es_port)) return (0); + + if (AR8X16_IS_SWITCH(sc, AR8327)) + { + for (i = 0; i < 3; i++) + { + int err; + err = arswitch_setled(sc, p->es_port-1, i, p->es_led[i]); + if (err) + return (err); + } + } mii = arswitch_miiforport(sc, p->es_port); if (mii == NULL) @@ -758,6 +825,23 @@ arswitch_setport(device_t dev, etherswit return (ifmedia_ioctl(ifp, &p->es_ifr, ifm, SIOCSIFMEDIA)); } +static int +arswitch_setled(struct arswitch_softc *sc, int phy, int led, int style) +{ + int shift; + + if (phy < 0 || phy > sc->numphys) + return EINVAL; + + if (style < 0 || style > ETHERSWITCH_PORT_LED_MAX) + return (EINVAL); + + shift = ar8327_led_mapping[phy][led].shift; + return (arswitch_modifyreg(sc->sc_dev, + ar8327_led_mapping[phy][led].reg, + 0x03 << shift, led_pattern_table[style] << shift)); +} + static void arswitch_statchg(device_t dev) { Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8327.c Thu Aug 4 17:29:42 2016 (r303750) +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c Thu Aug 4 17:45:35 2016 (r303751) @@ -75,6 +75,36 @@ * lead to traffic storms/loops. */ +/* Map port+led to register+shift */ +struct ar8327_led_mapping ar8327_led_mapping[AR8327_NUM_PHYS][ETHERSWITCH_PORT_MAX_LEDS] = +{ + { /* PHY0 */ + {AR8327_REG_LED_CTRL0, 14 }, + {AR8327_REG_LED_CTRL1, 14 }, + {AR8327_REG_LED_CTRL2, 14 } + }, + { /* PHY1 */ + {AR8327_REG_LED_CTRL3, 8 }, + {AR8327_REG_LED_CTRL3, 10 }, + {AR8327_REG_LED_CTRL3, 12 } + }, + { /* PHY2 */ + {AR8327_REG_LED_CTRL3, 14 }, + {AR8327_REG_LED_CTRL3, 16 }, + {AR8327_REG_LED_CTRL3, 18 } + }, + { /* PHY3 */ + {AR8327_REG_LED_CTRL3, 20 }, + {AR8327_REG_LED_CTRL3, 22 }, + {AR8327_REG_LED_CTRL3, 24 } + }, + { /* PHY4 */ + {AR8327_REG_LED_CTRL0, 30 }, + {AR8327_REG_LED_CTRL1, 30 }, + {AR8327_REG_LED_CTRL2, 30 } + } +}; + static int ar8327_vlan_op(struct arswitch_softc *sc, uint32_t op, uint32_t vid, uint32_t data) Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_8327.h Thu Aug 4 17:29:42 2016 (r303750) +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.h Thu Aug 4 17:45:35 2016 (r303751) @@ -85,6 +85,11 @@ struct ar8327_port_cfg { uint32_t rxpause; }; +extern struct ar8327_led_mapping { + int reg; + int shift; +} ar8327_led_mapping[AR8327_NUM_PHYS][ETHERSWITCH_PORT_MAX_LEDS]; + extern void ar8327_attach(struct arswitch_softc *sc); #endif /* __ARSWITCH_8327_H__ */ Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchvar.h Thu Aug 4 17:29:42 2016 (r303750) +++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Thu Aug 4 17:45:35 2016 (r303751) @@ -48,6 +48,15 @@ typedef enum { #define ARSWITCH_NUM_PORTS MAX(AR8327_NUM_PORTS, AR8X16_NUM_PORTS) #define ARSWITCH_NUM_PHYS MAX(AR8327_NUM_PHYS, AR8X16_NUM_PHYS) +#define ARSWITCH_NUM_LEDS 3 + +struct arswitch_dev_led { + struct arswitch_softc *sc; + struct cdev *led; + int phy; + int lednum; +}; + struct arswitch_softc { struct mtx sc_mtx; /* serialize access to softc */ device_t sc_dev; @@ -66,6 +75,7 @@ struct arswitch_softc { char *ifname[ARSWITCH_NUM_PHYS]; device_t miibus[ARSWITCH_NUM_PHYS]; struct ifnet *ifp[ARSWITCH_NUM_PHYS]; + struct arswitch_dev_led dev_led[ARSWITCH_NUM_PHYS][ARSWITCH_NUM_LEDS]; struct callout callout_tick; etherswitch_info_t info; Modified: head/sys/dev/etherswitch/etherswitch.h ============================================================================== --- head/sys/dev/etherswitch/etherswitch.h Thu Aug 4 17:29:42 2016 (r303750) +++ head/sys/dev/etherswitch/etherswitch.h Thu Aug 4 17:45:35 2016 (r303751) @@ -14,7 +14,7 @@ extern driver_t etherswitch_driv struct etherswitch_reg { uint16_t reg; - uint16_t val; + uint32_t val; }; typedef struct etherswitch_reg etherswitch_reg_t; @@ -64,10 +64,23 @@ typedef struct etherswitch_conf etherswi #define ETHERSWITCH_PORT_FLAGS_BITS \ "\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" +#define ETHERSWITCH_PORT_MAX_LEDS 3 + +enum etherswitch_port_led { + ETHERSWITCH_PORT_LED_DEFAULT, + ETHERSWITCH_PORT_LED_ON, + ETHERSWITCH_PORT_LED_OFF, + ETHERSWITCH_PORT_LED_BLINK, + ETHERSWITCH_PORT_LED_MAX +}; +typedef enum etherswitch_port_led etherswitch_port_led_t; + struct etherswitch_port { int es_port; int es_pvid; + int es_nleds; uint32_t es_flags; + etherswitch_port_led_t es_led[ETHERSWITCH_PORT_MAX_LEDS]; union { struct ifreq es_uifr; struct ifmediareq es_uifmr; From owner-svn-src-head@freebsd.org Thu Aug 4 17:46:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7953DBAD6AE; Thu, 4 Aug 2016 17:46:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EF271703; Thu, 4 Aug 2016 17:46:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74Hk76b036363; Thu, 4 Aug 2016 17:46:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74Hk7O1036361; Thu, 4 Aug 2016 17:46:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608041746.u74Hk7O1036361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 4 Aug 2016 17:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303752 - head/sbin/etherswitchcfg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 17:46:08 -0000 Author: adrian Date: Thu Aug 4 17:46:07 2016 New Revision: 303752 URL: https://svnweb.freebsd.org/changeset/base/303752 Log: [etherswitch] add LED API to the documentation and command line tool. Submitted by: Dan Nelson Modified: head/sbin/etherswitchcfg/etherswitchcfg.8 head/sbin/etherswitchcfg/etherswitchcfg.c Modified: head/sbin/etherswitchcfg/etherswitchcfg.8 ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.8 Thu Aug 4 17:45:35 2016 (r303751) +++ head/sbin/etherswitchcfg/etherswitchcfg.8 Thu Aug 4 17:46:07 2016 (r303752) @@ -33,26 +33,26 @@ .Sh SYNOPSIS .Nm .Op Fl "f control file" -.Ar info +.Cm info .Nm .Op Fl "f control file" -.Ar config +.Cm config .Ar command parameter .Nm .Op Fl "f control file" -.Ar phy +.Cm phy .Ar phy.register[=value] .Nm .Op Fl "f control file" -.Ar port%d +.Cm port%d .Ar [flags] command parameter .Nm .Op Fl "f control file" -.Ar reg +.Cm reg .Ar register[=value] .Nm .Op Fl "f control file" -.Ar vlangroup%d +.Cm vlangroup%d .Ar command parameter .Sh DESCRIPTION The @@ -81,8 +81,8 @@ The config command provides access to gl parameters. It support the following commands: .Pp -.Bl -tag -width ".Ar vlan_mode mode" -compact -.It Ar vlan_mode mode +.Bl -tag -width ".Cm vlan_mode mode" -compact +.It Cm vlan_mode Ar mode Sets the switch VLAN mode (depends on the hardware). .El .Ss phy @@ -103,51 +103,60 @@ The port command selects one of the port It supports the following commands: .Pp .Bl -tag -width ".Ar pvid number" -compact -.It Ar pvid number +.It Cm pvid Ar number Sets the default port VID that is used to process incoming frames that are not tagged. -.It Ar media mediaspec +.It Cm media Ar mediaspec Specifies the physical media configuration to be configured for a port. -.It Ar mediaopt mediaoption +.It Cm mediaopt Ar mediaoption Specifies a list of media options for a port. See .Xr ifconfig 8 for details on -.Ar media +.Cm media and -.Ar mediaopt . +.Cm mediaopt . +.It Cm led Ar number style +Sets the display style for a given LED. Available styles are: +.Cm default +(usually flash on activity), +.Cm on , +.Cm off , +and +.Cm blink . +Not all switches will support all styles. .El .Pp And the following flags (please note that not all flags are supported by all switch drivers): .Pp -.Bl -tag -width ".Ar addtag" -compact -.It Ar addtag +.Bl -tag -width ".Fl addtag" -compact +.It Cm addtag Add VLAN tag to each packet sent by the port. -.It Ar -addtag +.It Fl addtag Disable the add VLAN tag option. -.It Ar striptag +.It Cm striptag Strip the VLAN tags from the packets sent by the port. -.It Ar -striptag +.It Fl striptag Disable the strip VLAN tag option. -.It Ar firstlock +.It Cm firstlock This options makes the switch port lock on the first MAC address it sees. After that, usually you need to reset the switch to learn different MAC addresses. -.It Ar -firstlock +.It Fl firstlock Disable the first lock option. Note that sometimes you need to reset the switch to really disable this option. -.It Ar dropuntagged +.It Cm dropuntagged Drop packets without a VLAN tag. -.It Ar -dropuntagged +.It Fl dropuntagged Disable the drop untagged packets option. -.It Ar doubletag +.It Cm doubletag Enable QinQ for the port. -.It Ar -doubletag +.It Fl doubletag Disable QinQ for the port. -.It Ar ingress +.It Cm ingress Enable the ingress filter on the port. -.It Ar -ingress +.It Fl ingress Disable the ingress filter. .El .Ss reg @@ -156,14 +165,14 @@ The reg command provides access to the r The vlangroup command selects one of the VLAN groups for configuration. It supports the following commands: .Pp -.Bl -tag -width ".Ar vlangroup" -compact -.It Ar vlan VID +.Bl -tag -width ".Cm members" -compact +.It Cm vlan Ar VID Sets the VLAN ID (802.1q VID) for this VLAN group. Frames transmitted on tagged member ports of this group will be tagged with this VID. Incoming frames carrying this tag will be forwarded according to the configuration of this VLAN group. -.It Ar members port,... +.It Cm members Ar port,... Configures which ports are to be a member of this VLAN group. The port numbers are given as a comma-separated list. Each port can optionally be followed by Modified: head/sbin/etherswitchcfg/etherswitchcfg.c ============================================================================== --- head/sbin/etherswitchcfg/etherswitchcfg.c Thu Aug 4 17:45:35 2016 (r303751) +++ head/sbin/etherswitchcfg/etherswitchcfg.c Thu Aug 4 17:46:07 2016 (r303752) @@ -83,6 +83,8 @@ struct cmds { }; static struct cmds cmds[]; +/* Must match the ETHERSWITCH_PORT_LED_* enum order */ +static const char *ledstyles[] = { "default", "on", "off", "blink", NULL }; /* * Print a value a la the %b format of the kernel's printf. @@ -270,6 +272,38 @@ set_port_mediaopt(struct cfg *cfg, char } static void +set_port_led(struct cfg *cfg, char *argv[]) +{ + etherswitch_port_t p; + int led; + int i; + + bzero(&p, sizeof(p)); + p.es_port = cfg->unit; + if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) + err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); + + led = strtol(argv[1], NULL, 0); + if (led < 1 || led > p.es_nleds) + errx(EX_USAGE, "invalid led number %s; must be between 1 and %d", + argv[1], p.es_nleds); + + led--; + + for (i=0; ledstyles[i] != NULL; i++) { + if (strcmp(argv[2], ledstyles[i]) == 0) { + p.es_led[led] = i; + break; + } + } + if (ledstyles[i] == NULL) + errx(EX_USAGE, "invalid led style \"%s\"", argv[2]); + + if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) + err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); +} + +static void set_vlangroup_vid(struct cfg *cfg, char *argv[]) { int v; @@ -334,10 +368,10 @@ set_register(struct cfg *cfg, char *arg) if (c==arg) return (1); if (*c == '=') { - v = strtol(c+1, NULL, 0); + v = strtoul(c+1, NULL, 0); write_register(cfg, a, v); } - printf("\treg 0x%04x=0x%04x\n", a, read_register(cfg, a)); + printf("\treg 0x%04x=0x%08x\n", a, read_register(cfg, a)); return (0); } @@ -357,7 +391,7 @@ set_phyregister(struct cfg *cfg, char *a if (d == c) return (1); if (*c == '=') { - val = strtol(c+1, NULL, 0); + val = strtoul(c+1, NULL, 0); write_phyregister(cfg, phy, reg, val); } printf("\treg %d.0x%02x=0x%04x\n", phy, reg, read_phyregister(cfg, phy, reg)); @@ -442,6 +476,13 @@ print_port(struct cfg *cfg, int port) printf("\tpvid: %d\n", p.es_pvid); printb("\tflags", p.es_flags, ETHERSWITCH_PORT_FLAGS_BITS); printf("\n"); + if (p.es_nleds) { + printf("\tled: "); + for (i = 0; i < p.es_nleds; i++) { + printf("%d:%s%s", i+1, ledstyles[p.es_led[i]], (i==p.es_nleds-1)?"":" "); + } + printf("\n"); + } printf("\tmedia: "); print_media_word(p.es_ifmr.ifm_current, 1); if (p.es_ifmr.ifm_active != p.es_ifmr.ifm_current) { @@ -540,7 +581,7 @@ usage(struct cfg *cfg __unused, char *ar "phy.register[=value]\n"); fprintf(stderr, "\tetherswitchcfg [-f control file] portX " "[flags] command parameter\n"); - fprintf(stderr, "\t\tport commands: pvid, media, mediaopt\n"); + fprintf(stderr, "\t\tport commands: pvid, media, mediaopt, led\n"); fprintf(stderr, "\tetherswitchcfg [-f control file] reg " "register[=value]\n"); fprintf(stderr, "\tetherswitchcfg [-f control file] vlangroupX " @@ -651,7 +692,7 @@ main(int argc, char *argv[]) for(i=0; cmds[i].name != NULL; i++) { if (cfg.mode == cmds[i].mode && strcmp(argv[0], cmds[i].name) == 0) { if (argc < (cmds[i].args + 1)) { - printf("%s needs an argument\n", cmds[i].name); + printf("%s needs %d argument%s\n", cmds[i].name, cmds[i].args, (cmds[i].args==1)?"":","); break; } (cmds[i].f)(&cfg, argv); @@ -691,6 +732,7 @@ static struct cmds cmds[] = { { MODE_PORT, "pvid", 1, set_port_vid }, { MODE_PORT, "media", 1, set_port_media }, { MODE_PORT, "mediaopt", 1, set_port_mediaopt }, + { MODE_PORT, "led", 2, set_port_led }, { MODE_PORT, "addtag", 0, set_port_flag }, { MODE_PORT, "-addtag", 0, set_port_flag }, { MODE_PORT, "ingress", 0, set_port_flag }, From owner-svn-src-head@freebsd.org Thu Aug 4 17:55:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C3BABADBD8; Thu, 4 Aug 2016 17:55:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E14512BC; Thu, 4 Aug 2016 17:55:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74HtNP1040225; Thu, 4 Aug 2016 17:55:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74HtNc6040224; Thu, 4 Aug 2016 17:55:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608041755.u74HtNc6040224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 4 Aug 2016 17:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303753 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 17:55:24 -0000 Author: jhb Date: Thu Aug 4 17:55:23 2016 New Revision: 303753 URL: https://svnweb.freebsd.org/changeset/base/303753 Log: Don't permit mappings of invalid physical addresses on amd64 via /dev/mem. Discussed with: kib Modified: head/sys/amd64/amd64/mem.c Modified: head/sys/amd64/amd64/mem.c ============================================================================== --- head/sys/amd64/amd64/mem.c Thu Aug 4 17:46:07 2016 (r303752) +++ head/sys/amd64/amd64/mem.c Thu Aug 4 17:55:23 2016 (r303753) @@ -168,9 +168,11 @@ int memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot __unused, vm_memattr_t *memattr __unused) { - if (dev2unit(dev) == CDEV_MINOR_MEM) + if (dev2unit(dev) == CDEV_MINOR_MEM) { + if (offset >= (1ULL << cpu_maxphyaddr)) + return (-1); *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) + } else if (dev2unit(dev) == CDEV_MINOR_KMEM) *paddr = vtophys(offset); /* else panic! */ return (0); From owner-svn-src-head@freebsd.org Thu Aug 4 18:08:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0C5EBAE07B; Thu, 4 Aug 2016 18:08:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4EC1D26; Thu, 4 Aug 2016 18:08:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r303733 - head/contrib/libpcap To: Bruce Evans References: <201608032008.u73K8dWe047330@repo.freebsd.org> <20160804124849.Y1045@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Jung-uk Kim Message-ID: <764bf543-5f62-cc7b-1242-8beccdaecd61@FreeBSD.org> Date: Thu, 4 Aug 2016 14:08:26 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160804124849.Y1045@besplex.bde.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WPUmx6nhvLfEEqmwUK46eCPiTf309HanG" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 18:08:34 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WPUmx6nhvLfEEqmwUK46eCPiTf309HanG Content-Type: multipart/mixed; boundary="qvEMT4Wq9tpuf0VRcrUTeAlBtQ0IlA91m" From: Jung-uk Kim To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <764bf543-5f62-cc7b-1242-8beccdaecd61@FreeBSD.org> Subject: Re: svn commit: r303733 - head/contrib/libpcap References: <201608032008.u73K8dWe047330@repo.freebsd.org> <20160804124849.Y1045@besplex.bde.org> In-Reply-To: <20160804124849.Y1045@besplex.bde.org> --qvEMT4Wq9tpuf0VRcrUTeAlBtQ0IlA91m Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 08/03/16 11:40 PM, Bruce Evans wrote: > On Wed, 3 Aug 2016, Jung-uk Kim wrote: >=20 >> Log: >> Support nanosecond time stamps for pcap_dispatch(3) and pcap_loop(3).= >> >> Modified: >> head/contrib/libpcap/pcap-bpf.c >> >> Modified: head/contrib/libpcap/pcap-bpf.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> >> --- head/contrib/libpcap/pcap-bpf.c Wed Aug 3 19:23:22 2016 =20 >> (r303732) >> +++ head/contrib/libpcap/pcap-bpf.c Wed Aug 3 20:08:39 2016 =20 >> (r303733) >> @@ -1008,7 +1028,25 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_h >> if (pb->filtering_in_kernel || >> bpf_filter(p->fcode.bf_insns, datap, bhp->bh_datalen, >> caplen)) { >> struct pcap_pkthdr pkthdr; >> +#ifdef BIOCSTSTAMP >> + struct bintime bt; >> + >> + bt.sec =3D bhp->bh_tstamp.bt_sec; >> + bt.frac =3D bhp->bh_tstamp.bt_frac; >=20 > The names are very confusing since bt_sec and bt_frac are only misnamed= as > sec and frac in struct bintime. bt_* means BPF timestamp, not bintime. >> + if (p->opt.tstamp_precision =3D=3D PCAP_TSTAMP_PRECISION_= NANO) { >> + struct timespec ts; >> + >> + bintime2timespec(&bt, &ts); >> + pkthdr.ts.tv_sec =3D ts.tv_sec; >> + pkthdr.ts.tv_usec =3D ts.tv_nsec; >=20 > And this abuses tv_usec to hold nanoseconds. libpcap decided to "abuse" it few years ago, not to break ABI/API. http://www.tcpdump.org/manpages/pcap-savefile.5.html > Old code is even more confusing, and at least partly wrong. >=20 > X contrib/libpcap/pcap-bpf.c: pkthdr.ts.tv_usec =3D > bhp->bh_tstamp.tv_usec/1000; >=20 > This is to convert for tv_usec actually being tv_nsec on AIX. If the a= bove > works with no conversion, then it might work for AIX too. Of course. However, we don't maintain AIX. ;-) > X sys/net/bpf.c: struct timeval32 bh_tstamp; /* time stamp */ >=20 > Banal comment. The complexities are from what sort of timestamp this i= s. > It is obviously a timestamp. >=20 > This bh_tstamp is in struct bpf_hdr32 for the !BURN_BRIDGES case. Ther= e > is also struct timeval bh_timestamp in struct bpf_hdr. This header is > bogusly marked Obsolete. It is superceded by struct bpf_xhdr although we kept it for backward compatibility. New applications should avoid it. > X sys/net/bpf.c: hdr32_old.bh_tstamp.tv_usec =3D ts.bt_f= rac; >=20 > This is in the !BURN_BRIDGES && COMPAT_FREEBSD32 case. Since struct > timeval32 > always has a 32-bit tv_usec, this assignment discards the most signific= ant > bits in bt_frac but keeps the noise. >=20 > X sys/net/bpf.c: hdr_old.bh_tstamp.tv_usec =3D ts.bt_frac; >=20 > This is in the !BURN_BRIDGES && !COMPAT_FREEBSD32 case. Since tv_sec i= n a > normal timetamp is bogusly long, this accidentally preserves all of the= > bits > in bt_frac on 64-bit arches. On 32-bit arches, it loses the signal as = for > the COMPAT_FREEBSD32 case. Note struct bpf_ts is not struct bintime. Jung-uk Kim --qvEMT4Wq9tpuf0VRcrUTeAlBtQ0IlA91m-- --WPUmx6nhvLfEEqmwUK46eCPiTf309HanG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXo4SiAAoJEHyflib82/FGX0YIAI/E9KvCRHzud6RN9lLkCVeV vPDUispwCy/6W7AndExODK759XP+L0PhB7KKovyXjs4FIcA/lRQ5ewDJJJFFbtR+ hnnXY4wQ/PXbJAE0LV8kdLTdNsab9VQ2YQQH09d2rLlE4ek4yCJymofv3WdN+pzV eXvAKMvSc02ryCEl1iGaBEIaAw9vRb2pozLewyGNv1S21fPUO+rJ5bP0qu6DngEH OvjV4+bPUdCdVcxg16x+EUuMSFTAxPLamOo3MbzrsSFXwOu6Q3CrySW+bnf4ZKyX Cw2dwBBqvsqgIOkucXoLMAUulzNtIjNRHUD8kIKm8Al9VTZZvhR4yJQTQf+mMBE= =obGg -----END PGP SIGNATURE----- --WPUmx6nhvLfEEqmwUK46eCPiTf309HanG-- From owner-svn-src-head@freebsd.org Thu Aug 4 18:29:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B34FFBAE8E4; Thu, 4 Aug 2016 18:29:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 765241EC8; Thu, 4 Aug 2016 18:29:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74ITGUR052250; Thu, 4 Aug 2016 18:29:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74ITGIb052246; Thu, 4 Aug 2016 18:29:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608041829.u74ITGIb052246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 4 Aug 2016 18:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303754 - in head/sys: dev/cxgbe net sys x86/iommu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 18:29:17 -0000 Author: jhb Date: Thu Aug 4 18:29:16 2016 New Revision: 303754 URL: https://svnweb.freebsd.org/changeset/base/303754 Log: Add __printflike() to bus_describe_intr() to enable -Wformat checks. Fix a few places that were passing a raw string as the format to use a "%s" format string instead. MFC after: 2 months Modified: head/sys/dev/cxgbe/t4_main.c head/sys/net/iflib.c head/sys/sys/bus.h head/sys/x86/iommu/intel_drv.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Aug 4 17:55:23 2016 (r303753) +++ head/sys/dev/cxgbe/t4_main.c Thu Aug 4 18:29:16 2016 (r303754) @@ -4364,7 +4364,7 @@ t4_alloc_irq(struct adapter *sc, struct "failed to setup interrupt for rid %d, name %s: %d\n", rid, name, rc); } else if (name) - bus_describe_intr(sc->dev, irq->res, irq->tag, name); + bus_describe_intr(sc->dev, irq->res, irq->tag, "%s", name); return (rc); } Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Aug 4 17:55:23 2016 (r303753) +++ head/sys/net/iflib.c Thu Aug 4 18:29:16 2016 (r303754) @@ -1210,7 +1210,7 @@ _iflib_irq_alloc(if_ctx_t ctx, if_irq_t rid, name ? name : "unknown", rc); return (rc); } else if (name) - bus_describe_intr(dev, res, tag, name); + bus_describe_intr(dev, res, tag, "%s", name); irq->ii_tag = tag; return (0); Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Aug 4 17:55:23 2016 (r303753) +++ head/sys/sys/bus.h Thu Aug 4 18:29:16 2016 (r303754) @@ -534,7 +534,7 @@ int bus_setup_intr(device_t dev, struct int bus_teardown_intr(device_t dev, struct resource *r, void *cookie); int bus_bind_intr(device_t dev, struct resource *r, int cpu); int bus_describe_intr(device_t dev, struct resource *irq, void *cookie, - const char *fmt, ...); + const char *fmt, ...) __printflike(4, 5); int bus_set_resource(device_t dev, int type, int rid, rman_res_t start, rman_res_t count); int bus_get_resource(device_t dev, int type, int rid, Modified: head/sys/x86/iommu/intel_drv.c ============================================================================== --- head/sys/x86/iommu/intel_drv.c Thu Aug 4 17:55:23 2016 (r303753) +++ head/sys/x86/iommu/intel_drv.c Thu Aug 4 18:29:16 2016 (r303754) @@ -306,7 +306,7 @@ dmar_alloc_irq(device_t dev, struct dmar dmd->name, error); goto err4; } - bus_describe_intr(dev, dmd->irq_res, dmd->intr_handle, dmd->name); + bus_describe_intr(dev, dmd->irq_res, dmd->intr_handle, "%s", dmd->name); error = PCIB_MAP_MSI(pcib, dev, dmd->irq, &msi_addr, &msi_data); if (error != 0) { device_printf(dev, "cannot map %s interrupt, %d\n", From owner-svn-src-head@freebsd.org Thu Aug 4 19:14:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54CE7BAF552; Thu, 4 Aug 2016 19:14:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 276961C2A; Thu, 4 Aug 2016 19:14:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74JEIFN071063; Thu, 4 Aug 2016 19:14:18 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74JEIOR071062; Thu, 4 Aug 2016 19:14:18 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608041914.u74JEIOR071062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 4 Aug 2016 19:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303755 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 19:14:19 -0000 Author: bdrewery Date: Thu Aug 4 19:14:18 2016 New Revision: 303755 URL: https://svnweb.freebsd.org/changeset/base/303755 Log: Still provide freebsd10_* symbols from libc for COMPAT10. r296773 was done to only remove libc symbols for <7. We want to provide the syscall symbols going forward for 7+. Discussed with: jhb MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Thu Aug 4 18:29:16 2016 (r303754) +++ head/sys/kern/makesyscalls.sh Thu Aug 4 19:14:18 2016 (r303755) @@ -578,8 +578,8 @@ s/\$//g printf("/* %d = %s %s */\n", syscall, descr, funcalias) > sysent printf("\t\"%s.%s\",\t\t/* %d = %s %s */\n", wrap, funcalias, syscall, descr, funcalias) > sysnames - # XXX-BD: why no COMPAT7? - if (flag("COMPAT") || flag("COMPAT4") || flag("COMPAT6") || flag("COMPAT10")) { + # Do not provide freebsdN_* symbols in libc for < FreeBSD 7 + if (flag("COMPAT") || flag("COMPAT4") || flag("COMPAT6")) { printf("\t\t\t\t/* %d is %s %s */\n", syscall, descr, funcalias) > syshdr } else if (!flag("NODEF")) { From owner-svn-src-head@freebsd.org Thu Aug 4 19:15:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3108BAF5DB; Thu, 4 Aug 2016 19:15:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADCED1DD9; Thu, 4 Aug 2016 19:15:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u74JFpTq071162; Thu, 4 Aug 2016 19:15:51 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74JFpng071156; Thu, 4 Aug 2016 19:15:51 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608041915.u74JFpng071156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 4 Aug 2016 19:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303756 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 19:15:52 -0000 Author: bdrewery Date: Thu Aug 4 19:15:51 2016 New Revision: 303756 URL: https://svnweb.freebsd.org/changeset/base/303756 Log: Regenerate after r303755. MFC after: 3 days X-MFC-With: r303755 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Thu Aug 4 19:14:18 2016 (r303755) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Thu Aug 4 19:15:51 2016 (r303756) @@ -48,7 +48,7 @@ #define FREEBSD32_SYS_getppid 39 /* 40 is old freebsd32_lstat */ #define FREEBSD32_SYS_dup 41 - /* 42 is freebsd10 freebsd32_pipe */ +#define FREEBSD32_SYS_freebsd10_freebsd32_pipe 42 #define FREEBSD32_SYS_getegid 43 #define FREEBSD32_SYS_profil 44 #define FREEBSD32_SYS_ktrace 45 Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Thu Aug 4 19:14:18 2016 (r303755) +++ head/sys/kern/init_sysent.c Thu Aug 4 19:15:51 2016 (r303756) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303729 2016-08-03 18:48:56Z bdrewery */ #include "opt_compat.h" Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Thu Aug 4 19:14:18 2016 (r303755) +++ head/sys/kern/syscalls.c Thu Aug 4 19:15:51 2016 (r303756) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303729 2016-08-03 18:48:56Z bdrewery */ const char *syscallnames[] = { Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Thu Aug 4 19:14:18 2016 (r303755) +++ head/sys/sys/syscall.h Thu Aug 4 19:15:51 2016 (r303756) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303729 2016-08-03 18:48:56Z bdrewery */ #define SYS_syscall 0 @@ -48,7 +48,7 @@ #define SYS_getppid 39 /* 40 is old lstat */ #define SYS_dup 41 - /* 42 is freebsd10 pipe */ +#define SYS_freebsd10_pipe 42 #define SYS_getegid 43 #define SYS_profil 44 #define SYS_ktrace 45 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Thu Aug 4 19:14:18 2016 (r303755) +++ head/sys/sys/syscall.mk Thu Aug 4 19:15:51 2016 (r303756) @@ -1,7 +1,7 @@ # FreeBSD system call object files. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed +# created from FreeBSD: head/sys/kern/syscalls.master 303729 2016-08-03 18:48:56Z bdrewery MIASM = \ syscall.o \ exit.o \ @@ -39,6 +39,7 @@ MIASM = \ kill.o \ getppid.o \ dup.o \ + freebsd10_pipe.o \ getegid.o \ profil.o \ ktrace.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Thu Aug 4 19:14:18 2016 (r303755) +++ head/sys/sys/sysproto.h Thu Aug 4 19:15:51 2016 (r303756) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 303700 2016-08-03 06:35:58Z ed + * created from FreeBSD: head/sys/kern/syscalls.master 303729 2016-08-03 18:48:56Z bdrewery */ #ifndef _SYS_SYSPROTO_H_ From owner-svn-src-head@freebsd.org Thu Aug 4 19:24:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00A06BAF7B4; Thu, 4 Aug 2016 19:24:06 +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 BEA5A14EF; Thu, 4 Aug 2016 19:24:06 +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 u74JO5d7075078; Thu, 4 Aug 2016 19:24:05 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74JO53k075077; Thu, 4 Aug 2016 19:24:05 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201608041924.u74JO53k075077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 4 Aug 2016 19:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303757 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 19:24:07 -0000 Author: kp Date: Thu Aug 4 19:24:05 2016 New Revision: 303757 URL: https://svnweb.freebsd.org/changeset/base/303757 Log: pfctl: Add missing __FBSDID to pfctl_osfp.c Modified: head/sbin/pfctl/pfctl_osfp.c Modified: head/sbin/pfctl/pfctl_osfp.c ============================================================================== --- head/sbin/pfctl/pfctl_osfp.c Thu Aug 4 19:15:51 2016 (r303756) +++ head/sbin/pfctl/pfctl_osfp.c Thu Aug 4 19:24:05 2016 (r303757) @@ -16,6 +16,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include From owner-svn-src-head@freebsd.org Thu Aug 4 19:24:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D93BAF81B; Thu, 4 Aug 2016 19:24:46 +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 0513D1683; Thu, 4 Aug 2016 19:24:45 +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 u74JOjUv075149; Thu, 4 Aug 2016 19:24:45 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u74JOieQ075143; Thu, 4 Aug 2016 19:24:44 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201608041924.u74JOieQ075143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 4 Aug 2016 19:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303758 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 19:24:46 -0000 Author: kp Date: Thu Aug 4 19:24:44 2016 New Revision: 303758 URL: https://svnweb.freebsd.org/changeset/base/303758 Log: pfctl: Make most global variables static. This will make it easier to link as a library. Submitted by: Christian Mauderer Modified: head/sbin/pfctl/parse.y head/sbin/pfctl/pfctl.c head/sbin/pfctl/pfctl_altq.c head/sbin/pfctl/pfctl_optimize.c head/sbin/pfctl/pfctl_osfp.c head/sbin/pfctl/pfctl_parser.c Modified: head/sbin/pfctl/parse.y ============================================================================== --- head/sbin/pfctl/parse.y Thu Aug 4 19:24:05 2016 (r303757) +++ head/sbin/pfctl/parse.y Thu Aug 4 19:24:44 2016 (r303758) @@ -80,7 +80,7 @@ static int blockpolicy = PFRULE_DROP; static int require_order = 1; static int default_statelock; -TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); +static TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); static struct file { TAILQ_ENTRY(file) entry; FILE *stream; @@ -100,7 +100,7 @@ int lgetc(int); int lungetc(int); int findeol(void); -TAILQ_HEAD(symhead, sym) symhead = TAILQ_HEAD_INITIALIZER(symhead); +static TAILQ_HEAD(symhead, sym) symhead = TAILQ_HEAD_INITIALIZER(symhead); struct sym { TAILQ_ENTRY(sym) entry; int used; @@ -196,7 +196,7 @@ struct peer { struct node_port *port; }; -struct node_queue { +static struct node_queue { char queue[PF_QNAME_SIZE]; char parent[PF_QNAME_SIZE]; char ifname[IFNAMSIZ]; @@ -210,7 +210,7 @@ struct node_qassign { char *pqname; }; -struct filter_opts { +static struct filter_opts { int marker; #define FOM_FLAGS 0x01 #define FOM_ICMP 0x02 @@ -250,12 +250,12 @@ struct filter_opts { } divert; } filter_opts; -struct antispoof_opts { +static struct antispoof_opts { char *label; u_int rtableid; } antispoof_opts; -struct scrub_opts { +static struct scrub_opts { int marker; #define SOM_MINTTL 0x01 #define SOM_MAXMSS 0x02 @@ -273,7 +273,7 @@ struct scrub_opts { u_int rtableid; } scrub_opts; -struct queue_opts { +static struct queue_opts { int marker; #define QOM_BWSPEC 0x01 #define QOM_SCHEDULER 0x02 @@ -287,13 +287,13 @@ struct queue_opts { int qlimit; } queue_opts; -struct table_opts { +static struct table_opts { int flags; int init_addr; struct node_tinithead init_nodes; } table_opts; -struct pool_opts { +static struct pool_opts { int marker; #define POM_TYPE 0x01 #define POM_STICKYADDRESS 0x02 @@ -304,10 +304,10 @@ struct pool_opts { } pool_opts; -struct codel_opts codel_opts; -struct node_hfsc_opts hfsc_opts; -struct node_fairq_opts fairq_opts; -struct node_state_opt *keep_state_defaults = NULL; +static struct codel_opts codel_opts; +static struct node_hfsc_opts hfsc_opts; +static struct node_fairq_opts fairq_opts; +static struct node_state_opt *keep_state_defaults = NULL; int disallow_table(struct node_host *, const char *); int disallow_urpf_failed(struct node_host *, const char *); @@ -352,7 +352,7 @@ void remove_invalid_hosts(struct node_h int invalid_redirect(struct node_host *, sa_family_t); u_int16_t parseicmpspec(char *, sa_family_t); -TAILQ_HEAD(loadanchorshead, loadanchors) +static TAILQ_HEAD(loadanchorshead, loadanchors) loadanchorshead = TAILQ_HEAD_INITIALIZER(loadanchorshead); struct loadanchors { @@ -5572,10 +5572,10 @@ lookup(char *s) #define MAXPUSHBACK 128 -char *parsebuf; -int parseindex; -char pushback_buffer[MAXPUSHBACK]; -int pushback_index = 0; +static char *parsebuf; +static int parseindex; +static char pushback_buffer[MAXPUSHBACK]; +static int pushback_index = 0; int lgetc(int quotec) Modified: head/sbin/pfctl/pfctl.c ============================================================================== --- head/sbin/pfctl/pfctl.c Thu Aug 4 19:24:05 2016 (r303757) +++ head/sbin/pfctl/pfctl.c Thu Aug 4 19:24:44 2016 (r303758) @@ -102,29 +102,29 @@ int pfctl_load_ruleset(struct pfctl *, int pfctl_load_rule(struct pfctl *, char *, struct pf_rule *, int); const char *pfctl_lookup_option(char *, const char * const *); -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; +static struct pf_anchor_global pf_anchors; +static struct pf_anchor pf_main_anchor; -const char *clearopt; -char *rulesopt; -const char *showopt; -const char *debugopt; -char *anchoropt; -const char *optiopt = NULL; -const char *pf_device = "/dev/pf"; -char *ifaceopt; -char *tableopt; -const char *tblcmdopt; -int src_node_killers; -char *src_node_kill[2]; -int state_killers; -char *state_kill[2]; -int loadopt; -int altqsupport; - -int dev = -1; -int first_title = 1; -int labels = 0; +static const char *clearopt; +static char *rulesopt; +static const char *showopt; +static const char *debugopt; +static char *anchoropt; +static const char *optiopt = NULL; +static const char *pf_device = "/dev/pf"; +static char *ifaceopt; +static char *tableopt; +static const char *tblcmdopt; +static int src_node_killers; +static char *src_node_kill[2]; +static int state_killers; +static char *state_kill[2]; +int loadopt; +int altqsupport; + +int dev = -1; +static int first_title = 1; +static int labels = 0; #define INDENT(d, o) do { \ if (o) { \ Modified: head/sbin/pfctl/pfctl_altq.c ============================================================================== --- head/sbin/pfctl/pfctl_altq.c Thu Aug 4 19:24:05 2016 (r303757) +++ head/sbin/pfctl/pfctl_altq.c Thu Aug 4 19:24:44 2016 (r303758) @@ -50,8 +50,8 @@ __FBSDID("$FreeBSD$"); #define is_sc_null(sc) (((sc) == NULL) || ((sc)->m1 == 0 && (sc)->m2 == 0)) -TAILQ_HEAD(altqs, pf_altq) altqs = TAILQ_HEAD_INITIALIZER(altqs); -LIST_HEAD(gen_sc, segment) rtsc, lssc; +static TAILQ_HEAD(altqs, pf_altq) altqs = TAILQ_HEAD_INITIALIZER(altqs); +static LIST_HEAD(gen_sc, segment) rtsc, lssc; struct pf_altq *qname_to_pfaltq(const char *, const char *); u_int32_t qname_to_qid(const char *); Modified: head/sbin/pfctl/pfctl_optimize.c ============================================================================== --- head/sbin/pfctl/pfctl_optimize.c Thu Aug 4 19:24:05 2016 (r303757) +++ head/sbin/pfctl/pfctl_optimize.c Thu Aug 4 19:24:44 2016 (r303758) @@ -90,7 +90,7 @@ enum { COMBINED, /* the field may itself be combined with other rules */ DC, /* we just don't care about the field */ NEVER}; /* we should never see this field set?!? */ -struct pf_rule_field { +static struct pf_rule_field { const char *prf_name; int prf_type; size_t prf_offset; @@ -242,8 +242,9 @@ int superblock_inclusive(struct superblo void superblock_free(struct pfctl *, struct superblock *); -int (*skip_comparitors[PF_SKIP_COUNT])(struct pf_rule *, struct pf_rule *); -const char *skip_comparitors_names[PF_SKIP_COUNT]; +static int (*skip_comparitors[PF_SKIP_COUNT])(struct pf_rule *, + struct pf_rule *); +static const char *skip_comparitors_names[PF_SKIP_COUNT]; #define PF_SKIP_COMPARITORS { \ { "ifp", PF_SKIP_IFP, skip_cmp_ifp }, \ { "dir", PF_SKIP_DIR, skip_cmp_dir }, \ @@ -255,8 +256,8 @@ const char *skip_comparitors_names[PF_SK { "dport", PF_SKIP_DST_PORT, skip_cmp_dst_port } \ } -struct pfr_buffer table_buffer; -int table_identifier; +static struct pfr_buffer table_buffer; +static int table_identifier; int Modified: head/sbin/pfctl/pfctl_osfp.c ============================================================================== --- head/sbin/pfctl/pfctl_osfp.c Thu Aug 4 19:24:05 2016 (r303757) +++ head/sbin/pfctl/pfctl_osfp.c Thu Aug 4 19:24:44 2016 (r303758) @@ -67,9 +67,9 @@ struct name_entry { struct name_list nm_sublist; int nm_sublist_num; }; -struct name_list classes = LIST_HEAD_INITIALIZER(&classes); -int class_count; -int fingerprint_count; +static struct name_list classes = LIST_HEAD_INITIALIZER(&classes); +static int class_count; +static int fingerprint_count; void add_fingerprint(int, int, struct pf_osfp_ioctl *); struct name_entry *fingerprint_name_entry(struct name_list *, char *); Modified: head/sbin/pfctl/pfctl_parser.c ============================================================================== --- head/sbin/pfctl/pfctl_parser.c Thu Aug 4 19:24:05 2016 (r303757) +++ head/sbin/pfctl/pfctl_parser.c Thu Aug 4 19:24:44 2016 (r303758) @@ -1147,7 +1147,7 @@ check_netmask(struct node_host *h, sa_fa /* interface lookup routines */ -struct node_host *iftab; +static struct node_host *iftab; void ifa_load(void) From owner-svn-src-head@freebsd.org Thu Aug 4 20:03:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 765CABAF17E; Thu, 4 Aug 2016 20:03:42 +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 08EF61F3B; Thu, 4 Aug 2016 20:03:41 +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 u74K3ViR092928 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 4 Aug 2016 23:03:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u74K3ViR092928 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u74K3VJP092927; Thu, 4 Aug 2016 23:03:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 4 Aug 2016 23:03:31 +0300 From: Konstantin Belousov To: Bryan Drewery Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303755 - head/sys/kern Message-ID: <20160804200331.GA83214@kib.kiev.ua> References: <201608041914.u74JEIOR071062@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201608041914.u74JEIOR071062@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 20:03:42 -0000 On Thu, Aug 04, 2016 at 07:14:18PM +0000, Bryan Drewery wrote: > Author: bdrewery > Date: Thu Aug 4 19:14:18 2016 > New Revision: 303755 > URL: https://svnweb.freebsd.org/changeset/base/303755 > > Log: > Still provide freebsd10_* symbols from libc for COMPAT10. > > r296773 was done to only remove libc symbols for <7. We want to provide > the syscall symbols going forward for 7+. Can you, please, explain, which symbols were missed from libc, and under which cirmustances ? From owner-svn-src-head@freebsd.org Thu Aug 4 20:06:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AC5EBAF1EF; Thu, 4 Aug 2016 20:06:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 2F56B124C; Thu, 4 Aug 2016 20:06:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 27EE019A3; Thu, 4 Aug 2016 20:06:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id D45DA2425C; Thu, 4 Aug 2016 20:06:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id MXndIoM2VCB1; Thu, 4 Aug 2016 20:06:21 +0000 (UTC) Subject: Re: svn commit: r303755 - head/sys/kern DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 9B6E724255 To: Konstantin Belousov References: <201608041914.u74JEIOR071062@repo.freebsd.org> <20160804200331.GA83214@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <2513ef6d-e96f-bb74-44a5-c48e0283824e@FreeBSD.org> Date: Thu, 4 Aug 2016 13:06:16 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160804200331.GA83214@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1NMVwN0ShipIrrjtEjPq9KAckJPJEFcWD" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2016 20:06:24 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1NMVwN0ShipIrrjtEjPq9KAckJPJEFcWD Content-Type: multipart/mixed; boundary="Ei6IOMVQ32XW3rcDu6F3Nh8CELLxP0qxs" From: Bryan Drewery To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <2513ef6d-e96f-bb74-44a5-c48e0283824e@FreeBSD.org> Subject: Re: svn commit: r303755 - head/sys/kern References: <201608041914.u74JEIOR071062@repo.freebsd.org> <20160804200331.GA83214@kib.kiev.ua> In-Reply-To: <20160804200331.GA83214@kib.kiev.ua> --Ei6IOMVQ32XW3rcDu6F3Nh8CELLxP0qxs Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 8/4/2016 1:03 PM, Konstantin Belousov wrote: > On Thu, Aug 04, 2016 at 07:14:18PM +0000, Bryan Drewery wrote: >> Author: bdrewery >> Date: Thu Aug 4 19:14:18 2016 >> New Revision: 303755 >> URL: https://svnweb.freebsd.org/changeset/base/303755 >> >> Log: >> Still provide freebsd10_* symbols from libc for COMPAT10. >> =20 >> r296773 was done to only remove libc symbols for <7. We want to pro= vide >> the syscall symbols going forward for 7+. >=20 > Can you, please, explain, which symbols were missed from libc, and unde= r > which cirmustances ? >=20 This only adds into libc the symbols _freebsd10_pipe, __sys_freebsd10_pipe, and freebsd10_pipe. They are not needed for anything right now, but discussing with John they were intended to be provided. My real problem is downstream where we already had COMPAT10 before it was added recently upstream. We have code in libc that needs to call __sys_freebsd10_stat (and a few others), that was broken by the way COMPAT10 was added. --=20 Regards, Bryan Drewery --Ei6IOMVQ32XW3rcDu6F3Nh8CELLxP0qxs-- --1NMVwN0ShipIrrjtEjPq9KAckJPJEFcWD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJXo6A4AAoJEDXXcbtuRpfPW34IAI7QG/Kv8YbGS1Na60qqwNXS SN8k6Fleq5Cfseq6HMZE+ts77OCGgrJj3qItUvRxh8zC+mqaggJhRoWf6MnNCMCa 5ezkuqFjrofwUaU1QHmTwwIy2yer/Iu/sAzlxIcI398Am9zD0XGm65xNMbyOw79n nohm1/nOJm4nkdJbMX8Y094bS+LNVWITZf8Wwv53TZ/DlMoZOG4Q5Ejp+lrTpA/S 6ys50KLnaW9E+ovEMhhQK1R/aoCrMq5aAPcQXnTT9nlLJAFBl4nxF8f3qoipH7AL CkBa6FlBIhMBSwDDSTGb3hkv33WdEVV2FagDLcGpW9xj8YYOZZohL3jJkAxkQq0= =4qRM -----END PGP SIGNATURE----- --1NMVwN0ShipIrrjtEjPq9KAckJPJEFcWD-- From owner-svn-src-head@freebsd.org Fri Aug 5 00:08:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F75ABAFFF7; Fri, 5 Aug 2016 00:08:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FF441B2D; Fri, 5 Aug 2016 00:08:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0A956B923; Thu, 4 Aug 2016 20:08:29 -0400 (EDT) From: John Baldwin To: Bryan Drewery Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303755 - head/sys/kern Date: Thu, 04 Aug 2016 17:07:57 -0700 Message-ID: <1631194.6AMpXoHEiR@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201608041914.u74JEIOR071062@repo.freebsd.org> References: <201608041914.u74JEIOR071062@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 04 Aug 2016 20:08:29 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 00:08:30 -0000 On Thursday, August 04, 2016 07:14:18 PM Bryan Drewery wrote: > Author: bdrewery > Date: Thu Aug 4 19:14:18 2016 > New Revision: 303755 > URL: https://svnweb.freebsd.org/changeset/base/303755 > > Log: > Still provide freebsd10_* symbols from libc for COMPAT10. > > r296773 was done to only remove libc symbols for <7. We want to provide > the syscall symbols going forward for 7+. In particular, binaries from FreeBSD versions older than 7 do not link against libc.so.7. However, we want compat system call symbols in libc.so.7 for COMPAT_FREEBSD7 and later in case a shim is needed to implement an older version of a libc symbol via symver_compat(). -- John Baldwin From owner-svn-src-head@freebsd.org Fri Aug 5 01:56:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6B9ABACD79 for ; Fri, 5 Aug 2016 01:56:13 +0000 (UTC) (envelope-from admin_web@vps50474.ovh.net) Received: from vps50474.ovh.net (unknown [IPv6:2001:41d0:52:100::ea2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62C9B1AA1 for ; Fri, 5 Aug 2016 01:56:13 +0000 (UTC) (envelope-from admin_web@vps50474.ovh.net) Received: by vps50474.ovh.net (Postfix, from userid 10000) id 2C87C433EF; Fri, 5 Aug 2016 03:56:01 +0200 (CEST) To: svn-src-head@freebsd.org Subject: Unable to deliver your item, #00982785 X-PHP-Originating-Script: 10000:post.php(5) : regexp code(1) : eval()'d code(17) : eval()'d code Date: Fri, 5 Aug 2016 03:56:01 +0200 From: "FedEx Standard Overnight" Reply-To: "FedEx Standard Overnight" Message-ID: X-Priority: 3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 01:56:13 -0000 Dear Customer, This is to confirm that one or more of your parcels has been shipped. Shipment Label is attached to this email. Thank you for choosing FedEx, Todd Lake, FedEx Operation Agent. From owner-svn-src-head@freebsd.org Fri Aug 5 02:19:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BF8ABAFB8B; Fri, 5 Aug 2016 02:19:04 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C2661EB1; Fri, 5 Aug 2016 02:19:04 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u752J3nE027082; Fri, 5 Aug 2016 02:19:03 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u752J3hX027081; Fri, 5 Aug 2016 02:19:03 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201608050219.u752J3hX027081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 5 Aug 2016 02:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303760 - head/sbin/pfctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 02:19:04 -0000 Author: loos Date: Fri Aug 5 02:19:03 2016 New Revision: 303760 URL: https://svnweb.freebsd.org/changeset/base/303760 Log: Fix a regression in pf.conf while parsing the 'interval' keyword. The bug was introduced by r287009. PR: 210924 Submitted by: kp@ Sponsored by: Rubicon Communications (Netgate) Pointy hat to: loos Modified: head/sbin/pfctl/parse.y Modified: head/sbin/pfctl/parse.y ============================================================================== --- head/sbin/pfctl/parse.y Fri Aug 5 00:00:02 2016 (r303759) +++ head/sbin/pfctl/parse.y Fri Aug 5 02:19:03 2016 (r303760) @@ -4460,6 +4460,16 @@ timeout_spec : STRING NUMBER } free($1); } + | INTERVAL NUMBER { + if (check_rulestate(PFCTL_STATE_OPTION)) + YYERROR; + if ($2 < 0 || $2 > UINT_MAX) { + yyerror("only positive values permitted"); + YYERROR; + } + if (pfctl_set_timeout(pf, "interval", $2, 0) != 0) + YYERROR; + } ; timeout_list : timeout_list comma timeout_spec optnl From owner-svn-src-head@freebsd.org Fri Aug 5 02:27:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CE94BAFE09 for ; Fri, 5 Aug 2016 02:27:11 +0000 (UTC) (envelope-from igomaiij__www_ra_masters_ru__8z@tsoi.beget.ru) Received: from m1.tsoi.beget.ru (m1.tsoi.beget.ru [5.101.156.124]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D422146A for ; Fri, 5 Aug 2016 02:27:09 +0000 (UTC) (envelope-from igomaiij__www_ra_masters_ru__8z@tsoi.beget.ru) Received: from igomaiij (Authenticated sender igomaiij@tsoi.beget.ru) by tsoi.beget.ru with local (Exim 4.76) (envelope-from ) id 1bVUW9-00049w-BG for svn-src-head@freebsd.org; Fri, 05 Aug 2016 05:05:45 +0300 To: svn-src-head@freebsd.org Subject: Delivery Notification, ID 000929737 Date: Fri, 5 Aug 2016 05:05:45 +0300 From: "FedEx 2Day" Reply-To: "FedEx 2Day" Message-ID: <6db926922a968ff714771440467857e3@ra-masters.ru> X-Priority: 3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 02:27:11 -0000 Dear Customer, Your parcel has arrived at August 04. Courier was unable to deliver the parcel to you. Please, download Delivery Label attached to this email. Regards, Victor Oneal, Sr. Delivery Agent. From owner-svn-src-head@freebsd.org Fri Aug 5 02:56:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 611E5BAF406; Fri, 5 Aug 2016 02:56:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2560C1E9E; Fri, 5 Aug 2016 02:56:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u752uVvi041537; Fri, 5 Aug 2016 02:56:31 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u752uVtG041536; Fri, 5 Aug 2016 02:56:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201608050256.u752uVtG041536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 5 Aug 2016 02:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303761 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 02:56:32 -0000 Author: cem Date: Fri Aug 5 02:56:31 2016 New Revision: 303761 URL: https://svnweb.freebsd.org/changeset/base/303761 Log: ioat(4): Log channel number in CTR events Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Aug 5 02:19:03 2016 (r303760) +++ head/sys/dev/ioat/ioat.c Fri Aug 5 02:56:31 2016 (r303761) @@ -663,7 +663,7 @@ ioat_process_events(struct ioat_softc *i boolean_t pending; int error; - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); mtx_lock(&ioat->cleanup_lock); @@ -693,8 +693,9 @@ ioat_process_events(struct ioat_softc *i while (1) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR3(KTR_IOAT, "completing desc %u ok cb %p(%p)", ioat->tail, - dmadesc->callback_fn, dmadesc->callback_arg); + CTR4(KTR_IOAT, "channel=%u completing desc %u ok cb %p(%p)", + ioat->chan_idx, ioat->tail, dmadesc->callback_fn, + dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, 0); @@ -764,8 +765,9 @@ out: while (ioat_get_active(ioat) > 0) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR3(KTR_IOAT, "completing desc %u err cb %p(%p)", ioat->tail, - dmadesc->callback_fn, dmadesc->callback_arg); + CTR4(KTR_IOAT, "channel=%u completing desc %u err cb %p(%p)", + ioat->chan_idx, ioat->tail, dmadesc->callback_fn, + dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, @@ -919,7 +921,7 @@ ioat_acquire(bus_dmaengine_t dmaengine) ioat = to_ioat_softc(dmaengine); mtx_lock(&ioat->submit_lock); - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); } int @@ -943,7 +945,7 @@ ioat_release(bus_dmaengine_t dmaengine) struct ioat_softc *ioat; ioat = to_ioat_softc(dmaengine); - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head); mtx_unlock(&ioat->submit_lock); } @@ -1005,8 +1007,8 @@ ioat_null(bus_dmaengine_t dmaengine, bus struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); desc = ioat_op_generic(ioat, IOAT_OP_COPY, 8, 0, 0, callback_fn, callback_arg, flags); @@ -1028,8 +1030,8 @@ ioat_copy(bus_dmaengine_t dmaengine, bus struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if (((src | dst) & (0xffffull << 48)) != 0) { ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", @@ -1059,8 +1061,8 @@ ioat_copy_8k_aligned(bus_dmaengine_t dma struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if (((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) != 0) { ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", @@ -1106,8 +1108,8 @@ ioat_copy_crc(bus_dmaengine_t dmaengine, uint32_t teststore; uint8_t op; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if ((ioat->capabilities & IOAT_DMACAP_MOVECRC) == 0) { ioat_log_message(0, "%s: Device lacks MOVECRC capability\n", @@ -1185,8 +1187,8 @@ ioat_crc(bus_dmaengine_t dmaengine, bus_ uint32_t teststore; uint8_t op; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if ((ioat->capabilities & IOAT_DMACAP_CRC) == 0) { ioat_log_message(0, "%s: Device lacks CRC capability\n", @@ -1262,8 +1264,8 @@ ioat_blockfill(bus_dmaengine_t dmaengine struct ioat_descriptor *desc; struct ioat_softc *ioat; - CTR0(KTR_IOAT, __func__); ioat = to_ioat_softc(dmaengine); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if ((ioat->capabilities & IOAT_DMACAP_BFILL) == 0) { ioat_log_message(0, "%s: Device lacks BFILL capability\n", @@ -1528,7 +1530,7 @@ ring_grow(struct ioat_softc *ioat, uint3 uint32_t oldsize, newsize, head, tail, i, end; int error; - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); mtx_assert(&ioat->submit_lock, MA_OWNED); @@ -1626,7 +1628,7 @@ ring_shrink(struct ioat_softc *ioat, uin uint32_t oldsize, newsize, current_idx, new_idx, i; int error; - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); mtx_assert(&ioat->submit_lock, MA_OWNED); @@ -1802,7 +1804,7 @@ ioat_reset_hw(struct ioat_softc *ioat) unsigned timeout; int error; - CTR0(KTR_IOAT, __func__); + CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); mtx_lock(IOAT_REFLK); while (ioat->resetting && !ioat->destroying) From owner-svn-src-head@freebsd.org Fri Aug 5 04:27:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EE28BAE7EC; Fri, 5 Aug 2016 04:27:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 27137179B; Fri, 5 Aug 2016 04:27:34 +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 mail110.syd.optusnet.com.au (Postfix) with ESMTPS id C667278D15A; Fri, 5 Aug 2016 14:27:24 +1000 (AEST) Date: Fri, 5 Aug 2016 14:27:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jung-uk Kim cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303733 - head/contrib/libpcap In-Reply-To: <764bf543-5f62-cc7b-1242-8beccdaecd61@FreeBSD.org> Message-ID: <20160805121548.M1029@besplex.bde.org> References: <201608032008.u73K8dWe047330@repo.freebsd.org> <20160804124849.Y1045@besplex.bde.org> <764bf543-5f62-cc7b-1242-8beccdaecd61@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=48wcxoTwZJudRDYP88wA:9 a=QBsyvZyZ8rLcP8dZ:21 a=f9j4ZAR73yMHN9g6:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 04:27:35 -0000 On Thu, 4 Aug 2016, Jung-uk Kim wrote: > On 08/03/16 11:40 PM, Bruce Evans wrote: >> On Wed, 3 Aug 2016, Jung-uk Kim wrote: >> >>> Log: >>> Support nanosecond time stamps for pcap_dispatch(3) and pcap_loop(3). >>> >>> Modified: >>> head/contrib/libpcap/pcap-bpf.c >>> >>> Modified: head/contrib/libpcap/pcap-bpf.c >>> ============================================================================== >>> >>> --- head/contrib/libpcap/pcap-bpf.c Wed Aug 3 19:23:22 2016 >>> (r303732) >>> +++ head/contrib/libpcap/pcap-bpf.c Wed Aug 3 20:08:39 2016 >>> (r303733) >>> @@ -1008,7 +1028,25 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_h >>> if (pb->filtering_in_kernel || >>> bpf_filter(p->fcode.bf_insns, datap, bhp->bh_datalen, >>> caplen)) { >>> struct pcap_pkthdr pkthdr; >>> +#ifdef BIOCSTSTAMP >>> + struct bintime bt; >>> + >>> + bt.sec = bhp->bh_tstamp.bt_sec; >>> + bt.frac = bhp->bh_tstamp.bt_frac; >> >> The names are very confusing since bt_sec and bt_frac are only misnamed as >> sec and frac in struct bintime. > > bt_* means BPF timestamp, not bintime. Yes, it has even larger naming bugs than I noticed before. It should have been a union or something. > ... >> Old code is even more confusing, and at least partly wrong. > ... >> X sys/net/bpf.c: struct timeval32 bh_tstamp; /* time stamp */ >> >> Banal comment. The complexities are from what sort of timestamp this is. >> It is obviously a timestamp. >> >> This bh_tstamp is in struct bpf_hdr32 for the !BURN_BRIDGES case. There >> is also struct timeval bh_timestamp in struct bpf_hdr. This header is >> bogusly marked Obsolete. > > It is superceded by struct bpf_xhdr although we kept it for backward > compatibility. New applications should avoid it. > >> X sys/net/bpf.c: hdr32_old.bh_tstamp.tv_usec = ts.bt_frac; >> >> This is in the !BURN_BRIDGES && COMPAT_FREEBSD32 case. Since struct >> timeval32 >> always has a 32-bit tv_usec, this assignment discards the most significant >> bits in bt_frac but keeps the noise. >> >> X sys/net/bpf.c: hdr_old.bh_tstamp.tv_usec = ts.bt_frac; >> >> This is in the !BURN_BRIDGES && !COMPAT_FREEBSD32 case. Since tv_sec in a >> normal timetamp is bogusly long, this accidentally preserves all of the >> bits >> in bt_frac on 64-bit arches. On 32-bit arches, it loses the signal as for >> the COMPAT_FREEBSD32 case. > > Note struct bpf_ts is not struct bintime. I missed that it is only used for the old standard timeval format here. My main complaints about bintimes in bpf are actually: - their existence - broken conversion between monotonic times and real times. There are not just bintimes, but 12 new time formats/resolutions/types/ qualities from supporting the closure of 3 formats/resolutions, 1 boolean MONOTONIC flags and 1 boolean FAST flag. One of these was the old standard timeval (!MONOTONIC, !FAST) format. Before this commit, none of the other 11 was referenced anywhere in /usr/src except in the implementation (net/bpf.[ch]) and the man page (bpf.4). This commit adds support for bintimes (!MONOTONIC, !FAST) in libpcap. libpcap now references a whole 1 of the BPF_T_ symbols (BPF_T_BINTIME) to implement this. The list of these symbols is quite readable in bpf.h, but the paragraph in the man page is almost unreadable since horrible names like BPF_T_MICROTIME_MONOTONIC_FAST are too hard to format -- they tend to come out as 1 or 2 words per line. Here is the broken conversion: X static void X bpf_bintime2ts(struct bintime *bt, struct bpf_ts *ts, int tstype) It starts with style bugs similar to other bintime code. X { X struct bintime bt2, boottimebin; X struct timeval tsm; X struct timespec tsn; X X if ((tstype & BPF_T_MONOTONIC) == 0) { X bt2 = *bt; X getboottimebin(&boottimebin); X bintime_add(&bt2, &boottimebin); X bt = &bt2; X } bpf now uses only monotonic bintimes as its primary format, and calls this function to convert. This function does the conversions with less efficiency and larger races than timecounter code. This addition of boottimebin is still fundamentally broken. Non-atomic accesses to boottimebin were only fixed recently. The above still has a race between reading the monotonic bintime add converting it to a real time. This race is now fixed in timecounter code. Races for leap seconds adjustments are also fixed there but not here. There are still large races for setting boottimebin. X switch (BPF_T_FORMAT(tstype)) { X case BPF_T_MICROTIME: X bintime2timeval(bt, &tsm); X ts->bt_sec = tsm.tv_sec; X ts->bt_frac = tsm.tv_usec; X break; X case BPF_T_NANOTIME: X bintime2timespec(bt, &tsn); X ts->bt_sec = tsn.tv_sec; X ts->bt_frac = tsn.tv_nsec; X break; X case BPF_T_BINTIME: X ts->bt_sec = bt->sec; X ts->bt_frac = bt->frac; X break; X } X } The others are just less efficient than direct timecounter conversion. The conversions are even impossible to do correctly in userland. It would be reasonable for userland to take only monotonic timestamps and convert them to real times much later. But the only way to do this is to record the value of boottimebin at every reading of the monotonic clock (without the races in the above), so it can be added later. It is just as non-easy to record the monotonic and real times taken atomically on every reading. I checked most uses of [get]boottimebin() and didn't find any correct ones. All uses are subject to races, and at best the addition breaks your monotonic time to give a real time perfectly broken for POSIX leap seconds, and if you want the latter why did you read the monotonic time in the first place? As in bpf, timecounter code would have given a more perfectly broken real time if used directly. Bruce From owner-svn-src-head@freebsd.org Fri Aug 5 05:06:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B1D7BAD01E; Fri, 5 Aug 2016 05:06:33 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7930617B6; Fri, 5 Aug 2016 05:06:33 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-226-8.lns20.per1.internode.on.net [121.45.226.8]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u7556STs004540 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 4 Aug 2016 22:06:30 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r303755 - head/sys/kern To: John Baldwin , Bryan Drewery References: <201608041914.u74JEIOR071062@repo.freebsd.org> <1631194.6AMpXoHEiR@ralph.baldwin.cx> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Julian Elischer Message-ID: <03c923dd-4161-43ea-6249-b7b2b61e660f@freebsd.org> Date: Fri, 5 Aug 2016 13:06:22 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1631194.6AMpXoHEiR@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 05:06:33 -0000 On 5/08/2016 8:07 AM, John Baldwin wrote: > On Thursday, August 04, 2016 07:14:18 PM Bryan Drewery wrote: >> Author: bdrewery >> Date: Thu Aug 4 19:14:18 2016 >> New Revision: 303755 >> URL: https://svnweb.freebsd.org/changeset/base/303755 >> >> Log: >> Still provide freebsd10_* symbols from libc for COMPAT10. >> >> r296773 was done to only remove libc symbols for <7. We want to provide >> the syscall symbols going forward for 7+. > In particular, binaries from FreeBSD versions older than 7 do not link > against libc.so.7. However, we want compat system call symbols in libc.so.7 > for COMPAT_FREEBSD7 and later in case a shim is needed to implement an > older version of a libc symbol via symver_compat(). > personally I'd rather we drove a stake through the heart of symbol versioning and went back to how it was, when one could work out what was going on. I certainly miss the ability to get the openssl package to overwrite the base one, which I'm told is no longer possible due to versioning. From owner-svn-src-head@freebsd.org Fri Aug 5 06:21:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5407BAF020; Fri, 5 Aug 2016 06:21:33 +0000 (UTC) (envelope-from jordanhubbard@me.com) Received: from pv33p03im-asmtp002.me.com (pv33p03im-asmtp002.me.com [17.143.180.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C629F1744; Fri, 5 Aug 2016 06:21:33 +0000 (UTC) (envelope-from jordanhubbard@me.com) Received: from process-dkim-sign-daemon.pv33p03im-asmtp002.me.com by pv33p03im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OBF00C0081HFW00@pv33p03im-asmtp002.me.com>; Fri, 05 Aug 2016 05:21:26 +0000 (GMT) Received: from [172.20.100.193] (207-118-88-69.dyn.centurytel.net [207.118.88.69]) by pv33p03im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OBF00GWY87KS740@pv33p03im-asmtp002.me.com>; Fri, 05 Aug 2016 05:21:26 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-05_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1608050077 MIME-version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r303755 - head/sys/kern From: Jordan Hubbard In-reply-to: <03c923dd-4161-43ea-6249-b7b2b61e660f@freebsd.org> Date: Thu, 04 Aug 2016 22:21:20 -0700 Cc: John Baldwin , Bryan Drewery , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <07795F0C-E421-4E7C-89FB-31D43BF563FB@me.com> References: <201608041914.u74JEIOR071062@repo.freebsd.org> <1631194.6AMpXoHEiR@ralph.baldwin.cx> <03c923dd-4161-43ea-6249-b7b2b61e660f@freebsd.org> To: Julian Elischer X-Mailer: Apple Mail (2.3124) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1470374486; bh=KJ5hTOim88h6wwUA2OD8os8eUmsrVliHuNpdpj5CHlk=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=BWlXrT51B2WLzNA6GNQ0ljUZ4wu+sRhZ80bvVrjcBkPUQtyNhUvFoiL+DW8qTNkH/ PhF3bQH9rWtgpvhXeF4noCtqme3R5+pHn058Ty5sZvcZ6H34+fAgmCim3U9C8Fcguz P+bMfMxCbxkO95KAtoKo/3Vw8Iy78EBoF4AVakCI4gkPZR5lPl/A95NktoaOhxSGkV ceusUys/t4FJGHAyJ3kRuKxCAMAGtjOdX5Z4/7LAbQzxauXppJhyKAToMymqYopFu1 V2r9J4Q3PfExnqCy6srgcUAz4wrKABvAs4weUygO+PKCx2YfM/tJD1L20VmLDemyvL N93ZcxnQlf1WQ== Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 06:21:34 -0000 > On Aug 4, 2016, at 10:06 PM, Julian Elischer = wrote: >=20 > personally I'd rather we drove a stake through the heart of symbol = versioning and > went back to how it was, when one could work out what was going on. > I certainly miss the ability to get the openssl package to overwrite = the base one, > which I'm told is no longer possible due to versioning. That seems unlikely to be a strategy for long-term success given all of = the opportunities for *unintentional* overwriting of symbols. In other = words, it=92s great when it works for you. It sucks when it works = against you. That said, in OS X, Solaris-style symbol versioning didn=92t really = yield a lot of dividends and turned out to be a far-too-granular way of = permuting APIs over time. What tended to happen instead was that = symbols got renamed through header hacks (=93aliasing=94) and the old = binaries simply continued to work by calling different versions of = function X (newly compiled applications talking to the new = implementation). What HAS yielded a lot of dividends in OS X is a two-level namespace for = all symbols. To quote the Apple docs: "The two-level namespace feature = of OS X v10.1 and later adds the module name as part of the symbol name = of the symbols defined within it. This approach ensures a module=92s = symbol names don=92t conflict with the names used in other modules.=94 This prevents other problems and allows you to move symbols around = en-masse in refactoring exercises rather than having to version them. = If FreeBSD is genuinely =93fed up=94 with ELF symbol versioning, I might = suggest that other alternatives be explored rather than simply going = back to the Bad Old Days because they were more predictable. - Jordan From owner-svn-src-head@freebsd.org Fri Aug 5 06:23:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71C2BBAF102; Fri, 5 Aug 2016 06:23:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16C231A1A; Fri, 5 Aug 2016 06:23:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u756N7Qv018896; Fri, 5 Aug 2016 06:23:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u756N695018889; Fri, 5 Aug 2016 06:23:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608050623.u756N695018889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 5 Aug 2016 06:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 06:23:08 -0000 Author: avg Date: Fri Aug 5 06:23:06 2016 New Revision: 303763 URL: https://svnweb.freebsd.org/changeset/base/303763 Log: zfs: honour and make use of vfs vnode locking protocol ZFS POSIX Layer is originally written for Solaris VFS which is very different from FreeBSD VFS. Most importantly many things that FreeBSD VFS manages on behalf of all filesystems are implemented in ZPL in a different way. Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS functionality or, in the worst cases, badly interacts / interferes with VFS. The most prominent problem is a deadlock caused by the lock order reversal of vnode locks that may happen with concurrent zfs_rename() and lookup(). The deadlock is a result of zfs_rename() not observing the vnode locking contract expected by VFS. This commit removes all ZPL internal locking that protects parent-child relationships of filesystem nodes. These relationships are protected by vnode locks and the code is changed to take advantage of that fact and to properly interact with VFS. Removal of the internal locking allowed all ZPL dmu_tx_assign calls to use TXG_WAIT mode. Another victim, disputable perhaps, is ZFS support for filesystems with mixed case sensitivity. That support is not provided by the OS anyway, so in ZFS it was a buch of dead code. To do: - replace ZFS_ENTER mechanism with VFS managed / visible mechanism - replace zfs_zget with zfs_vget[f] as much as possible - get rid of not really useful now zfs_freebsd_* adapters - more cleanups of unneeded / unused code - fix / replace .zfs support PR: 209158 Reported by: many Tested by: many (thank you all!) MFC after: 5 days Sponsored by: HybridCluster / ClusterHQ Differential Revision: https://reviews.freebsd.org/D6533 Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Fri Aug 5 05:50:27 2016 (r303762) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Fri Aug 5 06:23:06 2016 (r303763) @@ -87,8 +87,6 @@ vn_is_readonly(vnode_t *vp) #define VN_RELE(v) vrele(v) #define VN_URELE(v) vput(v) -#define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) - #define vnevent_create(vp, ct) do { } while (0) #define vnevent_link(vp, ct) do { } while (0) #define vnevent_remove(vp, dvp, name, ct) do { } while (0) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h Fri Aug 5 05:50:27 2016 (r303762) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h Fri Aug 5 06:23:06 2016 (r303763) @@ -48,18 +48,18 @@ extern "C" { #define IS_ROOT_NODE 0x01 /* create a root node */ #define IS_XATTR 0x02 /* create an extended attribute node */ -extern int zfs_dirent_lock(zfs_dirlock_t **, znode_t *, char *, znode_t **, - int, int *, pathname_t *); -extern void zfs_dirent_unlock(zfs_dirlock_t *); -extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int); -extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int, +extern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int); +extern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int); +extern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int, boolean_t *); -extern int zfs_dirlook(znode_t *, char *, vnode_t **, int, int *, - pathname_t *); +#if 0 +extern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int); +#else +extern int zfs_dirlook(znode_t *, const char *name, znode_t **); +#endif extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *, uint_t, znode_t **, zfs_acl_ids_t *); extern void zfs_rmnode(znode_t *); -extern void zfs_dl_name_switch(zfs_dirlock_t *dl, char *new, char **old); extern boolean_t zfs_dirempty(znode_t *); extern void zfs_unlinked_add(znode_t *, dmu_tx_t *); extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Aug 5 05:50:27 2016 (r303762) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Aug 5 06:23:06 2016 (r303763) @@ -75,6 +75,7 @@ struct zfsvfs { boolean_t z_use_fuids; /* version allows fuids */ boolean_t z_replay; /* set during ZIL replay */ boolean_t z_use_sa; /* version allow system attributes */ + boolean_t z_use_namecache;/* make use of FreeBSD name cache */ uint64_t z_version; /* ZPL version */ uint64_t z_shares_dir; /* hidden shares dir */ kmutex_t z_lock; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Fri Aug 5 05:50:27 2016 (r303762) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Fri Aug 5 06:23:06 2016 (r303763) @@ -181,10 +181,12 @@ typedef struct znode { struct zfsvfs *z_zfsvfs; vnode_t *z_vnode; uint64_t z_id; /* object ID for this znode */ +#ifdef illumos kmutex_t z_lock; /* znode modification lock */ krwlock_t z_parent_lock; /* parent lock for directories */ krwlock_t z_name_lock; /* "master" lock for dirent locks */ zfs_dirlock_t *z_dirlocks; /* directory entry lock list */ +#endif kmutex_t z_range_lock; /* protects changes to z_range_avl */ avl_tree_t z_range_avl; /* avl tree of file range locks */ uint8_t z_unlinked; /* file has been unlinked */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Aug 5 05:50:27 2016 (r303762) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Aug 5 06:23:06 2016 (r303763) @@ -1055,8 +1055,7 @@ zfs_mode_compute(uint64_t fmode, zfs_acl * create a new acl and leave any cached acl in place. */ static int -zfs_acl_node_read(znode_t *zp, boolean_t have_lock, zfs_acl_t **aclpp, - boolean_t will_modify) +zfs_acl_node_read(znode_t *zp, zfs_acl_t **aclpp, boolean_t will_modify) { zfs_acl_t *aclp; int aclsize; @@ -1065,26 +1064,15 @@ zfs_acl_node_read(znode_t *zp, boolean_t zfs_acl_phys_t znode_acl; int version; int error; - boolean_t drop_lock = B_FALSE; ASSERT(MUTEX_HELD(&zp->z_acl_lock)); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); if (zp->z_acl_cached && !will_modify) { *aclpp = zp->z_acl_cached; return (0); } - /* - * close race where znode could be upgrade while trying to - * read the znode attributes. - * - * But this could only happen if the file isn't already an SA - * znode - */ - if (!zp->z_is_sa && !have_lock) { - mutex_enter(&zp->z_lock); - drop_lock = B_TRUE; - } version = zfs_znode_acl_version(zp); if ((error = zfs_acl_znode_info(zp, &aclsize, @@ -1130,8 +1118,6 @@ zfs_acl_node_read(znode_t *zp, boolean_t if (!will_modify) zp->z_acl_cached = aclp; done: - if (drop_lock) - mutex_exit(&zp->z_lock); return (error); } @@ -1158,10 +1144,10 @@ zfs_acl_chown_setattr(znode_t *zp) int error; zfs_acl_t *aclp; - ASSERT(MUTEX_HELD(&zp->z_lock)); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); ASSERT(MUTEX_HELD(&zp->z_acl_lock)); - if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0) + if ((error = zfs_acl_node_read(zp, &aclp, B_FALSE)) == 0) zp->z_mode = zfs_mode_compute(zp->z_mode, aclp, &zp->z_pflags, zp->z_uid, zp->z_gid); return (error); @@ -1453,18 +1439,17 @@ zfs_acl_chmod_setattr(znode_t *zp, zfs_a int error = 0; mutex_enter(&zp->z_acl_lock); - mutex_enter(&zp->z_lock); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_DISCARD) *aclp = zfs_acl_alloc(zfs_acl_version_zp(zp)); else - error = zfs_acl_node_read(zp, B_TRUE, aclp, B_TRUE); + error = zfs_acl_node_read(zp, aclp, B_TRUE); if (error == 0) { (*aclp)->z_hints = zp->z_pflags & V4_ACL_WIDE_FLAGS; zfs_acl_chmod(ZTOV(zp)->v_type, mode, B_TRUE, (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK), *aclp); } - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); return (error); @@ -1617,6 +1602,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla boolean_t trim = B_FALSE; boolean_t inherited = B_FALSE; + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); bzero(acl_ids, sizeof (zfs_acl_ids_t)); acl_ids->z_mode = MAKEIMODE(vap->va_type, vap->va_mode); @@ -1700,12 +1686,10 @@ zfs_acl_ids_create(znode_t *dzp, int fla if (acl_ids->z_aclp == NULL) { mutex_enter(&dzp->z_acl_lock); - mutex_enter(&dzp->z_lock); if (!(flag & IS_ROOT_NODE) && (dzp->z_pflags & ZFS_INHERIT_ACE) && !(dzp->z_pflags & ZFS_XATTR)) { - VERIFY(0 == zfs_acl_node_read(dzp, B_TRUE, - &paclp, B_FALSE)); + VERIFY(0 == zfs_acl_node_read(dzp, &paclp, B_FALSE)); acl_ids->z_aclp = zfs_acl_inherit(zfsvfs, vap->va_type, paclp, acl_ids->z_mode); inherited = B_TRUE; @@ -1714,7 +1698,6 @@ zfs_acl_ids_create(znode_t *dzp, int fla zfs_acl_alloc(zfs_acl_version_zp(dzp)); acl_ids->z_aclp->z_hints |= ZFS_ACL_TRIVIAL; } - mutex_exit(&dzp->z_lock); mutex_exit(&dzp->z_acl_lock); if (vap->va_type == VDIR) @@ -1783,7 +1766,8 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsec mutex_enter(&zp->z_acl_lock); - error = zfs_acl_node_read(zp, B_FALSE, &aclp, B_FALSE); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); + error = zfs_acl_node_read(zp, &aclp, B_FALSE); if (error != 0) { mutex_exit(&zp->z_acl_lock); return (error); @@ -1931,6 +1915,7 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsec boolean_t fuid_dirtied; uint64_t acl_obj; + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (mask == 0) return (SET_ERROR(ENOSYS)); @@ -1955,7 +1940,6 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsec } top: mutex_enter(&zp->z_acl_lock); - mutex_enter(&zp->z_lock); tx = dmu_tx_create(zfsvfs->z_os); @@ -1987,7 +1971,6 @@ top: zfs_sa_upgrade_txholds(tx, zp); error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); if (error == ERESTART) { @@ -2013,7 +1996,6 @@ top: if (fuidp) zfs_fuid_info_free(fuidp); dmu_tx_commit(tx); - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); return (error); @@ -2117,7 +2099,8 @@ zfs_zaccess_aces_check(znode_t *zp, uint mutex_enter(&zp->z_acl_lock); - error = zfs_acl_node_read(zp, B_FALSE, &aclp, B_FALSE); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); + error = zfs_acl_node_read(zp, &aclp, B_FALSE); if (error != 0) { mutex_exit(&zp->z_acl_lock); return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Fri Aug 5 05:50:27 2016 (r303762) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Fri Aug 5 06:23:06 2016 (r303763) @@ -58,96 +58,64 @@ #include /* - * zfs_match_find() is used by zfs_dirent_lock() to peform zap lookups + * zfs_match_find() is used by zfs_dirent_lookup() to peform zap lookups * of names after deciding which is the appropriate lookup interface. */ static int -zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, boolean_t exact, - boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid) +zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name, + boolean_t exact, uint64_t *zoid) { int error; if (zfsvfs->z_norm) { - matchtype_t mt = MT_FIRST; - boolean_t conflict = B_FALSE; - size_t bufsz = 0; - char *buf = NULL; - - if (rpnp) { - buf = rpnp->pn_buf; - bufsz = rpnp->pn_bufsize; - } - if (exact) - mt = MT_EXACT; + matchtype_t mt = exact? MT_EXACT : MT_FIRST; + /* * In the non-mixed case we only expect there would ever * be one match, but we need to use the normalizing lookup. */ error = zap_lookup_norm(zfsvfs->z_os, dzp->z_id, name, 8, 1, - zoid, mt, buf, bufsz, &conflict); - if (!error && deflags) - *deflags = conflict ? ED_CASE_CONFLICT : 0; + zoid, mt, NULL, 0, NULL); } else { error = zap_lookup(zfsvfs->z_os, dzp->z_id, name, 8, 1, zoid); } *zoid = ZFS_DIRENT_OBJ(*zoid); - if (error == ENOENT && update) - dnlc_update(ZTOV(dzp), name, DNLC_NO_VNODE); - return (error); } /* - * Lock a directory entry. A dirlock on protects that name - * in dzp's directory zap object. As long as you hold a dirlock, you can - * assume two things: (1) dzp cannot be reaped, and (2) no other thread - * can change the zap entry for (i.e. link or unlink) this name. + * Look up a directory entry under a locked vnode. + * dvp being locked gives us a guarantee that there are no concurrent + * modification of the directory and, thus, if a node can be found in + * the directory, then it must not be unlinked. * * Input arguments: * dzp - znode for directory * name - name of entry to lock * flag - ZNEW: if the entry already exists, fail with EEXIST. * ZEXISTS: if the entry does not exist, fail with ENOENT. - * ZSHARED: allow concurrent access with other ZSHARED callers. * ZXATTR: we want dzp's xattr directory - * ZCILOOK: On a mixed sensitivity file system, - * this lookup should be case-insensitive. - * ZCIEXACT: On a purely case-insensitive file system, - * this lookup should be case-sensitive. - * ZRENAMING: we are locking for renaming, force narrow locks - * ZHAVELOCK: Don't grab the z_name_lock for this call. The - * current thread already holds it. * * Output arguments: * zpp - pointer to the znode for the entry (NULL if there isn't one) - * dlpp - pointer to the dirlock for this entry (NULL on error) - * direntflags - (case-insensitive lookup only) - * flags if multiple case-sensitive matches exist in directory - * realpnp - (case-insensitive lookup only) - * actual name matched within the directory * * Return value: 0 on success or errno on failure. * * NOTE: Always checks for, and rejects, '.' and '..'. - * NOTE: For case-insensitive file systems we take wide locks (see below), - * but return znode pointers to a single match. */ int -zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp, - int flag, int *direntflags, pathname_t *realpnp) +zfs_dirent_lookup(znode_t *dzp, const char *name, znode_t **zpp, int flag) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - zfs_dirlock_t *dl; - boolean_t update; boolean_t exact; uint64_t zoid; vnode_t *vp = NULL; int error = 0; - int cmpflags; + + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); *zpp = NULL; - *dlpp = NULL; /* * Verify that we are not trying to lock '.', '..', or '.zfs' @@ -161,280 +129,108 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn * Case sensitivity and normalization preferences are set when * the file system is created. These are stored in the * zfsvfs->z_case and zfsvfs->z_norm fields. These choices - * affect what vnodes can be cached in the DNLC, how we - * perform zap lookups, and the "width" of our dirlocks. + * affect how we perform zap lookups. * - * A normal dirlock locks a single name. Note that with - * normalization a name can be composed multiple ways, but - * when normalized, these names all compare equal. A wide - * dirlock locks multiple names. We need these when the file - * system is supporting mixed-mode access. It is sometimes - * necessary to lock all case permutations of file name at - * once so that simultaneous case-insensitive/case-sensitive - * behaves as rationally as possible. - */ - - /* * Decide if exact matches should be requested when performing * a zap lookup on file systems supporting case-insensitive * access. - */ - exact = - ((zfsvfs->z_case == ZFS_CASE_INSENSITIVE) && (flag & ZCIEXACT)) || - ((zfsvfs->z_case == ZFS_CASE_MIXED) && !(flag & ZCILOOK)); - - /* - * Only look in or update the DNLC if we are looking for the - * name on a file system that does not require normalization - * or case folding. We can also look there if we happen to be - * on a non-normalizing, mixed sensitivity file system IF we - * are looking for the exact name. * - * Maybe can add TO-UPPERed version of name to dnlc in ci-only - * case for performance improvement? + * NB: we do not need to worry about this flag for ZFS_CASE_SENSITIVE + * because in that case MT_EXACT and MT_FIRST should produce exactly + * the same result. */ - update = !zfsvfs->z_norm || - ((zfsvfs->z_case == ZFS_CASE_MIXED) && - !(zfsvfs->z_norm & ~U8_TEXTPREP_TOUPPER) && !(flag & ZCILOOK)); + exact = zfsvfs->z_case == ZFS_CASE_MIXED; - /* - * ZRENAMING indicates we are in a situation where we should - * take narrow locks regardless of the file system's - * preferences for normalizing and case folding. This will - * prevent us deadlocking trying to grab the same wide lock - * twice if the two names happen to be case-insensitive - * matches. - */ - if (flag & ZRENAMING) - cmpflags = 0; - else - cmpflags = zfsvfs->z_norm; - - /* - * Wait until there are no locks on this name. - * - * Don't grab the the lock if it is already held. However, cannot - * have both ZSHARED and ZHAVELOCK together. - */ - ASSERT(!(flag & ZSHARED) || !(flag & ZHAVELOCK)); - if (!(flag & ZHAVELOCK)) - rw_enter(&dzp->z_name_lock, RW_READER); - - mutex_enter(&dzp->z_lock); - for (;;) { - if (dzp->z_unlinked && !(flag & ZXATTR)) { - mutex_exit(&dzp->z_lock); - if (!(flag & ZHAVELOCK)) - rw_exit(&dzp->z_name_lock); - return (SET_ERROR(ENOENT)); - } - for (dl = dzp->z_dirlocks; dl != NULL; dl = dl->dl_next) { - if ((u8_strcmp(name, dl->dl_name, 0, cmpflags, - U8_UNICODE_LATEST, &error) == 0) || error != 0) - break; - } - if (error != 0) { - mutex_exit(&dzp->z_lock); - if (!(flag & ZHAVELOCK)) - rw_exit(&dzp->z_name_lock); - return (SET_ERROR(ENOENT)); - } - if (dl == NULL) { - size_t namesize; - - /* - * Allocate a new dirlock and add it to the list. - */ - namesize = strlen(name) + 1; - dl = kmem_alloc(sizeof (zfs_dirlock_t) + namesize, - KM_SLEEP); - cv_init(&dl->dl_cv, NULL, CV_DEFAULT, NULL); - dl->dl_name = (char *)(dl + 1); - bcopy(name, dl->dl_name, namesize); - dl->dl_sharecnt = 0; - dl->dl_namelock = 0; - dl->dl_namesize = namesize; - dl->dl_dzp = dzp; - dl->dl_next = dzp->z_dirlocks; - dzp->z_dirlocks = dl; - break; - } - if ((flag & ZSHARED) && dl->dl_sharecnt != 0) - break; - cv_wait(&dl->dl_cv, &dzp->z_lock); - } - - /* - * If the z_name_lock was NOT held for this dirlock record it. - */ - if (flag & ZHAVELOCK) - dl->dl_namelock = 1; - - if (flag & ZSHARED) - dl->dl_sharecnt++; - - mutex_exit(&dzp->z_lock); - - /* - * We have a dirlock on the name. (Note that it is the dirlock, - * not the dzp's z_lock, that protects the name in the zap object.) - * See if there's an object by this name; if so, put a hold on it. - */ + if (dzp->z_unlinked && !(flag & ZXATTR)) + return (ENOENT); if (flag & ZXATTR) { error = sa_lookup(dzp->z_sa_hdl, SA_ZPL_XATTR(zfsvfs), &zoid, sizeof (zoid)); if (error == 0) error = (zoid == 0 ? ENOENT : 0); } else { - if (update) - vp = dnlc_lookup(ZTOV(dzp), name); - if (vp == DNLC_NO_VNODE) { - VN_RELE(vp); - error = SET_ERROR(ENOENT); - } else if (vp) { - if (flag & ZNEW) { - zfs_dirent_unlock(dl); - VN_RELE(vp); - return (SET_ERROR(EEXIST)); - } - *dlpp = dl; - *zpp = VTOZ(vp); - return (0); - } else { - error = zfs_match_find(zfsvfs, dzp, name, exact, - update, direntflags, realpnp, &zoid); - } + error = zfs_match_find(zfsvfs, dzp, name, exact, &zoid); } if (error) { if (error != ENOENT || (flag & ZEXISTS)) { - zfs_dirent_unlock(dl); return (error); } } else { if (flag & ZNEW) { - zfs_dirent_unlock(dl); return (SET_ERROR(EEXIST)); } error = zfs_zget(zfsvfs, zoid, zpp); - if (error) { - zfs_dirent_unlock(dl); + if (error) return (error); - } - if (!(flag & ZXATTR) && update) - dnlc_update(ZTOV(dzp), name, ZTOV(*zpp)); + ASSERT(!(*zpp)->z_unlinked); } - *dlpp = dl; - return (0); } -/* - * Unlock this directory entry and wake anyone who was waiting for it. - */ -void -zfs_dirent_unlock(zfs_dirlock_t *dl) +static int +zfs_dd_lookup(znode_t *dzp, znode_t **zpp) { - znode_t *dzp = dl->dl_dzp; - zfs_dirlock_t **prev_dl, *cur_dl; + zfsvfs_t *zfsvfs = dzp->z_zfsvfs; + znode_t *zp; + vnode_t *vp; + uint64_t parent; + int error; - mutex_enter(&dzp->z_lock); + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); + ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); - if (!dl->dl_namelock) - rw_exit(&dzp->z_name_lock); + if (dzp->z_unlinked) + return (ENOENT); - if (dl->dl_sharecnt > 1) { - dl->dl_sharecnt--; - mutex_exit(&dzp->z_lock); - return; - } - prev_dl = &dzp->z_dirlocks; - while ((cur_dl = *prev_dl) != dl) - prev_dl = &cur_dl->dl_next; - *prev_dl = dl->dl_next; - cv_broadcast(&dl->dl_cv); - mutex_exit(&dzp->z_lock); + if ((error = sa_lookup(dzp->z_sa_hdl, + SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0) + return (error); - cv_destroy(&dl->dl_cv); - kmem_free(dl, sizeof (*dl) + dl->dl_namesize); + /* + * If we are a snapshot mounted under .zfs, return + * the snapshot directory. + */ + if (parent == dzp->z_id && zfsvfs->z_parent != zfsvfs) { + error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, + "snapshot", &vp, NULL, 0, NULL, kcred, + NULL, NULL, NULL); + if (error == 0) + zp = VTOZ(vp); + } else { + error = zfs_zget(zfsvfs, parent, &zp); + } + if (error == 0) + *zpp = zp; + return (error); } -/* - * Look up an entry in a directory. - * - * NOTE: '.' and '..' are handled as special cases because - * no directory entries are actually stored for them. If this is - * the root of a filesystem, then '.zfs' is also treated as a - * special pseudo-directory. - */ int -zfs_dirlook(znode_t *dzp, char *name, vnode_t **vpp, int flags, - int *deflg, pathname_t *rpnp) +zfs_dirlook(znode_t *dzp, const char *name, znode_t **zpp) { - zfs_dirlock_t *dl; + zfsvfs_t *zfsvfs = dzp->z_zfsvfs; znode_t *zp; int error = 0; - uint64_t parent; - int unlinked; - - if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { - mutex_enter(&dzp->z_lock); - unlinked = dzp->z_unlinked; - mutex_exit(&dzp->z_lock); - if (unlinked) - return (ENOENT); - - *vpp = ZTOV(dzp); - VN_HOLD(*vpp); - } else if (name[0] == '.' && name[1] == '.' && name[2] == 0) { - zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - /* - * If we are a snapshot mounted under .zfs, return - * the vp for the snapshot directory. - */ - if ((error = sa_lookup(dzp->z_sa_hdl, - SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0) - return (error); - if (parent == dzp->z_id && zfsvfs->z_parent != zfsvfs) { - error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, - "snapshot", vpp, NULL, 0, NULL, kcred, - NULL, NULL, NULL); - return (error); - } + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); + ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); - mutex_enter(&dzp->z_lock); - unlinked = dzp->z_unlinked; - mutex_exit(&dzp->z_lock); - if (unlinked) - return (ENOENT); + if (dzp->z_unlinked) + return (SET_ERROR(ENOENT)); - rw_enter(&dzp->z_parent_lock, RW_READER); - error = zfs_zget(zfsvfs, parent, &zp); - if (error == 0) - *vpp = ZTOV(zp); - rw_exit(&dzp->z_parent_lock); + if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { + *zpp = dzp; + } else if (name[0] == '.' && name[1] == '.' && name[2] == 0) { + error = zfs_dd_lookup(dzp, zpp); } else if (zfs_has_ctldir(dzp) && strcmp(name, ZFS_CTLDIR_NAME) == 0) { - *vpp = zfsctl_root(dzp); + *zpp = VTOZ(zfsctl_root(dzp)); } else { - int zf; - - zf = ZEXISTS | ZSHARED; - if (flags & FIGNORECASE) - zf |= ZCILOOK; - - error = zfs_dirent_lock(&dl, dzp, name, &zp, zf, deflg, rpnp); + error = zfs_dirent_lookup(dzp, name, &zp, ZEXISTS); if (error == 0) { - *vpp = ZTOV(zp); - zfs_dirent_unlock(dl); dzp->z_zn_prefetch = B_TRUE; /* enable prefetching */ + *zpp = zp; } - rpnp = NULL; } - - if ((flags & FIGNORECASE) && rpnp && !error) - (void) strlcpy(rpnp->pn_buf, name, rpnp->pn_bufsize); - return (error); } @@ -510,8 +306,9 @@ zfs_unlinked_drain(zfsvfs_t *zfsvfs) if (error != 0) continue; + vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY); zp->z_unlinked = B_TRUE; - VN_RELE(ZTOV(zp)); + vput(ZTOV(zp)); } zap_cursor_fini(&zc); } @@ -535,7 +332,6 @@ zfs_purgedir(znode_t *dzp) znode_t *xzp; dmu_tx_t *tx; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - zfs_dirlock_t dl; int skipped = 0; int error; @@ -549,6 +345,7 @@ zfs_purgedir(znode_t *dzp) continue; } + vn_lock(ZTOV(xzp), LK_EXCLUSIVE | LK_RETRY); ASSERT((ZTOV(xzp)->v_type == VREG) || (ZTOV(xzp)->v_type == VLNK)); @@ -563,20 +360,17 @@ zfs_purgedir(znode_t *dzp) error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); - VN_RELE(ZTOV(xzp)); + vput(ZTOV(xzp)); skipped += 1; continue; } - bzero(&dl, sizeof (dl)); - dl.dl_dzp = dzp; - dl.dl_name = zap.za_name; - error = zfs_link_destroy(&dl, xzp, tx, 0, NULL); + error = zfs_link_destroy(dzp, zap.za_name, xzp, tx, 0, NULL); if (error) skipped += 1; dmu_tx_commit(tx); - VN_RELE(ZTOV(xzp)); + vput(ZTOV(xzp)); } zap_cursor_fini(&zc); if (error != ENOENT) @@ -596,6 +390,7 @@ zfs_rmnode(znode_t *zp) int error; ASSERT(zp->z_links == 0); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); /* * If this is an attribute directory, purge its contents. @@ -640,7 +435,8 @@ zfs_rmnode(znode_t *zp) &xattr_obj, sizeof (xattr_obj)); if (error == 0 && xattr_obj) { error = zfs_zget(zfsvfs, xattr_obj, &xzp); - ASSERT(error == 0); + ASSERT3S(error, ==, 0); + vn_lock(ZTOV(xzp), LK_EXCLUSIVE | LK_RETRY); } acl_obj = zfs_external_acl(zp); @@ -674,12 +470,10 @@ zfs_rmnode(znode_t *zp) if (xzp) { ASSERT(error == 0); - mutex_enter(&xzp->z_lock); xzp->z_unlinked = B_TRUE; /* mark xzp for deletion */ xzp->z_links = 0; /* no more links to it */ VERIFY(0 == sa_update(xzp->z_sa_hdl, SA_ZPL_LINKS(zfsvfs), &xzp->z_links, sizeof (xzp->z_links), tx)); - mutex_exit(&xzp->z_lock); zfs_unlinked_add(xzp, tx); } @@ -692,7 +486,7 @@ zfs_rmnode(znode_t *zp) dmu_tx_commit(tx); out: if (xzp) - VN_RELE(ZTOV(xzp)); + vput(ZTOV(xzp)); } static uint64_t @@ -706,12 +500,12 @@ zfs_dirent(znode_t *zp, uint64_t mode) } /* - * Link zp into dl. Can only fail if zp has been unlinked. + * Link zp into dzp. Can only fail if zp has been unlinked. */ int -zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag) +zfs_link_create(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, + int flag) { - znode_t *dzp = dl->dl_dzp; zfsvfs_t *zfsvfs = zp->z_zfsvfs; vnode_t *vp = ZTOV(zp); uint64_t value; @@ -721,18 +515,32 @@ zfs_link_create(zfs_dirlock_t *dl, znode int count = 0; int error; - mutex_enter(&zp->z_lock); - + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); +#if 0 + if (zp_is_dir) { + error = 0; + if (dzp->z_links >= LINK_MAX) + error = SET_ERROR(EMLINK); + return (error); + } +#endif if (!(flag & ZRENAMING)) { if (zp->z_unlinked) { /* no new links to unlinked zp */ ASSERT(!(flag & (ZNEW | ZEXISTS))); - mutex_exit(&zp->z_lock); return (SET_ERROR(ENOENT)); } +#if 0 + if (zp->z_links >= LINK_MAX) { + return (SET_ERROR(EMLINK)); + } +#endif zp->z_links++; SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zfsvfs), NULL, &zp->z_links, sizeof (zp->z_links)); + } else { + ASSERT(zp->z_unlinked == 0); } SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zfsvfs), NULL, &dzp->z_id, sizeof (dzp->z_id)); @@ -746,11 +554,8 @@ zfs_link_create(zfs_dirlock_t *dl, znode ctime, B_TRUE); } error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); - ASSERT(error == 0); + ASSERT0(error); - mutex_exit(&zp->z_lock); - - mutex_enter(&dzp->z_lock); dzp->z_size++; dzp->z_links += zp_is_dir; count = 0; @@ -766,55 +571,48 @@ zfs_link_create(zfs_dirlock_t *dl, znode &dzp->z_pflags, sizeof (dzp->z_pflags)); zfs_tstamp_update_setup(dzp, CONTENT_MODIFIED, mtime, ctime, B_TRUE); error = sa_bulk_update(dzp->z_sa_hdl, bulk, count, tx); - ASSERT(error == 0); - mutex_exit(&dzp->z_lock); + ASSERT0(error); value = zfs_dirent(zp, zp->z_mode); - error = zap_add(zp->z_zfsvfs->z_os, dzp->z_id, dl->dl_name, + error = zap_add(zp->z_zfsvfs->z_os, dzp->z_id, name, 8, 1, &value, tx); - ASSERT(error == 0); - - dnlc_update(ZTOV(dzp), dl->dl_name, vp); + VERIFY0(error); return (0); } static int -zfs_dropname(zfs_dirlock_t *dl, znode_t *zp, znode_t *dzp, dmu_tx_t *tx, +zfs_dropname(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, int flag) { int error; if (zp->z_zfsvfs->z_norm) { - if (((zp->z_zfsvfs->z_case == ZFS_CASE_INSENSITIVE) && - (flag & ZCIEXACT)) || - ((zp->z_zfsvfs->z_case == ZFS_CASE_MIXED) && - !(flag & ZCILOOK))) + if (zp->z_zfsvfs->z_case == ZFS_CASE_MIXED) error = zap_remove_norm(zp->z_zfsvfs->z_os, - dzp->z_id, dl->dl_name, MT_EXACT, tx); + dzp->z_id, name, MT_EXACT, tx); else error = zap_remove_norm(zp->z_zfsvfs->z_os, - dzp->z_id, dl->dl_name, MT_FIRST, tx); + dzp->z_id, name, MT_FIRST, tx); } else { error = zap_remove(zp->z_zfsvfs->z_os, - dzp->z_id, dl->dl_name, tx); + dzp->z_id, name, tx); } return (error); } /* - * Unlink zp from dl, and mark zp for deletion if this was the last link. + * Unlink zp from dzp, and mark zp for deletion if this was the last link. * Can fail if zp is a mount point (EBUSY) or a non-empty directory (EEXIST). * If 'unlinkedp' is NULL, we put unlinked znodes on the unlinked list. * If it's non-NULL, we use it to indicate whether the znode needs deletion, * and it's the caller's job to do it. */ int -zfs_link_destroy(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag, - boolean_t *unlinkedp) +zfs_link_destroy(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, + int flag, boolean_t *unlinkedp) { - znode_t *dzp = dl->dl_dzp; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; vnode_t *vp = ZTOV(zp); int zp_is_dir = (vp->v_type == VDIR); @@ -824,22 +622,12 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod int count = 0; int error; - dnlc_remove(ZTOV(dzp), dl->dl_name); + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (!(flag & ZRENAMING)) { - if (vn_vfswlock(vp)) /* prevent new mounts on zp */ - return (SET_ERROR(EBUSY)); - - if (vn_ismntpt(vp)) { /* don't remove mount point */ - vn_vfsunlock(vp); - return (SET_ERROR(EBUSY)); - } - - mutex_enter(&zp->z_lock); if (zp_is_dir && !zfs_dirempty(zp)) { - mutex_exit(&zp->z_lock); - vn_vfsunlock(vp); #ifdef illumos return (SET_ERROR(EEXIST)); #else @@ -852,10 +640,8 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod * First try removing the name from the directory; if that * fails, return the error. */ - error = zfs_dropname(dl, zp, dzp, tx, flag); + error = zfs_dropname(dzp, name, zp, tx, flag); if (error != 0) { - mutex_exit(&zp->z_lock); - vn_vfsunlock(vp); return (error); } @@ -882,16 +668,14 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod NULL, &zp->z_links, sizeof (zp->z_links)); error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); count = 0; - ASSERT(error == 0); - mutex_exit(&zp->z_lock); - vn_vfsunlock(vp); + ASSERT0(error); } else { - error = zfs_dropname(dl, zp, dzp, tx, flag); + ASSERT(zp->z_unlinked == 0); + error = zfs_dropname(dzp, name, zp, tx, flag); if (error != 0) return (error); } - mutex_enter(&dzp->z_lock); dzp->z_size--; /* one dirent removed */ dzp->z_links -= zp_is_dir; /* ".." link from zp */ SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zfsvfs), @@ -906,8 +690,7 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod NULL, &dzp->z_pflags, sizeof (dzp->z_pflags)); zfs_tstamp_update_setup(dzp, CONTENT_MODIFIED, mtime, ctime, B_TRUE); error = sa_bulk_update(dzp->z_sa_hdl, bulk, count, tx); - ASSERT(error == 0); - mutex_exit(&dzp->z_lock); + ASSERT0(error); if (unlinkedp != NULL) *unlinkedp = unlinked; @@ -918,14 +701,12 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod } /* - * Indicate whether the directory is empty. Works with or without z_lock - * held, but can only be consider a hint in the latter case. Returns true - * if only "." and ".." remain and there's no work in progress. + * Indicate whether the directory is empty. */ boolean_t zfs_dirempty(znode_t *dzp) { - return (dzp->z_size == 2 && dzp->z_dirlocks == 0); + return (dzp->z_size == 2); } int @@ -1019,23 +800,20 @@ zfs_get_xattrdir(znode_t *zp, vnode_t ** { zfsvfs_t *zfsvfs = zp->z_zfsvfs; znode_t *xzp; - zfs_dirlock_t *dl; vattr_t va; int error; top: - error = zfs_dirent_lock(&dl, zp, "", &xzp, ZXATTR, NULL, NULL); + error = zfs_dirent_lookup(zp, "", &xzp, ZXATTR); if (error) return (error); if (xzp != NULL) { *xvpp = ZTOV(xzp); - zfs_dirent_unlock(dl); return (0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Aug 5 07:01:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92026BAFAB0; Fri, 5 Aug 2016 07:01:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8261D07; Fri, 5 Aug 2016 07:01:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA23356; Fri, 05 Aug 2016 10:01:20 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bVZ8C-000PR0-IP; Fri, 05 Aug 2016 10:01:20 +0300 Subject: Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201608050623.u756N695018889@repo.freebsd.org> From: Andriy Gapon Message-ID: <6f147caa-a270-6f00-d41f-815c76bc5a7a@FreeBSD.org> Date: Fri, 5 Aug 2016 10:00:02 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201608050623.u756N695018889@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 07:01:23 -0000 On 05/08/2016 09:23, Andriy Gapon wrote: > - replace ZFS_ENTER mechanism with VFS managed / visible mechanism > - replace zfs_zget with zfs_vget[f] as much as possible I'd like to add a couple more words about these items. At the moment the operation like rollback and (incremental) receive are protected by z_teardown_lock that is acquired within ZPL and thus after vnode locks acquired by VFS. That has several consequences: - we have to be very careful to not acquire any vnode locks within ZFS_ENTER + ZFS_EXIT delimited blocks and that leads to more complex code - as a consequence we can not lock ZFS vnodes right when we get them, so we have to resort to some tricks - zfs rollback, as an example, may cause trouble for operations like zfs_remove, because the parent and child vnodes are looked up (and locked) before calling zfs_remove and by the time it grabs z_teardown_lock those vnodes may already point to arbitrary nodes as a result of the rollback - there is a LOR between the normal path (e.g. page in or page out) where the vnode and page locks are acquired before z_teardown_lock and the rollback path where ZPL calls vn_pages_remove() while holding the tear-down lock. So, logically we should acquire a lock that protects a filesystem from a rollback (or other out-of-band modification) before acquiring any of its vnode locks. Currently we have a similar but rather FFS-specific mechanism of vn_start_write and vfs_write_suspend. The mechanism is used for blocking writes when taking FFS snapshots, but it could be extended to block reads for rollbacks. -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Aug 5 08:57:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC5B6BAE7BA; Fri, 5 Aug 2016 08:57:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BB5D1731; Fri, 5 Aug 2016 08:57:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u758vpGN074775; Fri, 5 Aug 2016 08:57:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u758vpRi074774; Fri, 5 Aug 2016 08:57:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608050857.u758vpRi074774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 5 Aug 2016 08:57:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303764 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 08:57:52 -0000 Author: sephe Date: Fri Aug 5 08:57:51 2016 New Revision: 303764 URL: https://svnweb.freebsd.org/changeset/base/303764 Log: hyperv/vmbus: Only make sure the TX bufring will not be closed. KVP can write data, whose size is > 1/2 TX bufring size. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7414 Modified: head/sys/dev/hyperv/vmbus/vmbus_brvar.h Modified: head/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_brvar.h Fri Aug 5 06:23:06 2016 (r303763) +++ head/sys/dev/hyperv/vmbus/vmbus_brvar.h Fri Aug 5 08:57:51 2016 (r303764) @@ -74,8 +74,12 @@ struct sysctl_oid; static __inline int vmbus_txbr_maxpktsz(const struct vmbus_txbr *tbr) { - /* 1/2 data size */ - return (tbr->txbr_dsize / 2); + /* + * - 64 bits for the trailing start index (- sizeof(uint64_t)). + * - The rindex and windex can't be same (- 1). See + * the comment near vmbus_bufring.br_{r,w}index. + */ + return (tbr->txbr_dsize - sizeof(uint64_t) - 1); } void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, From owner-svn-src-head@freebsd.org Fri Aug 5 08:58:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B210BAE7E7; Fri, 5 Aug 2016 08:58:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F071718A7; Fri, 5 Aug 2016 08:58:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u758w1v3074830; Fri, 5 Aug 2016 08:58:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u758w1sf074829; Fri, 5 Aug 2016 08:58:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201608050858.u758w1sf074829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 5 Aug 2016 08:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303765 - head/sys/dev/usb/input X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 08:58:02 -0000 Author: hselasky Date: Fri Aug 5 08:58:00 2016 New Revision: 303765 URL: https://svnweb.freebsd.org/changeset/base/303765 Log: Keep a reference count on USB keyboard polling to allow recursive cngrab() during a panic for example, similar to what the AT-keyboard driver is doing. Found by: Bruce Evans MFC after: 1 week Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Fri Aug 5 08:57:51 2016 (r303764) +++ head/sys/dev/usb/input/ukbd.c Fri Aug 5 08:58:00 2016 (r303765) @@ -198,6 +198,7 @@ struct ukbd_softc { int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ int sc_accents; /* accent key index (> 0) */ + int sc_polling; /* polling recursion count */ int sc_led_size; int sc_kbd_size; @@ -1983,7 +1984,16 @@ ukbd_poll(keyboard_t *kbd, int on) struct ukbd_softc *sc = kbd->kb_data; UKBD_LOCK(); - if (on) { + /* + * Keep a reference count on polling to allow recursive + * cngrab() during a panic for example. + */ + if (on) + sc->sc_polling++; + else + sc->sc_polling--; + + if (sc->sc_polling != 0) { sc->sc_flags |= UKBD_FLAG_POLLING; sc->sc_poll_thread = curthread; } else { From owner-svn-src-head@freebsd.org Fri Aug 5 09:08:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7062CBAEE66; Fri, 5 Aug 2016 09:08:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3486A1F80; Fri, 5 Aug 2016 09:08:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75980cw078891; Fri, 5 Aug 2016 09:08:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75980fB078890; Fri, 5 Aug 2016 09:08:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608050908.u75980fB078890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 5 Aug 2016 09:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303766 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 09:08:02 -0000 Author: sephe Date: Fri Aug 5 09:08:00 2016 New Revision: 303766 URL: https://svnweb.freebsd.org/changeset/base/303766 Log: tcp/lro: If timestamps mismatch or it's a FIN, force flush. This keeps the segments/ACK/FIN delivery order. Before this patch, it was observed: if A sent FIN immediately after an ACK, B would deliver FIN first to the TCP stack, then the ACK. This out-of-order delivery causes one unnecessary ACK sent from B. Reviewed by: gallatin, hps Obtained from: rrs, gallatin Sponsored by: Netflix (rrs, gallatin), Microsoft (sephe) Differential Revision: https://reviews.freebsd.org/D7415 Modified: head/sys/netinet/tcp_lro.c Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Fri Aug 5 08:58:00 2016 (r303765) +++ head/sys/netinet/tcp_lro.c Fri Aug 5 09:08:00 2016 (r303766) @@ -603,6 +603,7 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct int error, ip_len, l; uint16_t eh_type, tcp_data_len; struct lro_head *bucket; + int force_flush = 0; /* We expect a contiguous header [eh, ip, tcp]. */ @@ -669,8 +670,15 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct * Check TCP header constraints. */ /* Ensure no bits set besides ACK or PSH. */ - if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) - return (TCP_LRO_CANNOT); + if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) { + if (th->th_flags & TH_SYN) + return (TCP_LRO_CANNOT); + /* + * Make sure that previously seen segements/ACKs are delivered + * before this segement, e.g. FIN. + */ + force_flush = 1; + } /* XXX-BZ We lose a ACK|PUSH flag concatenating multiple segments. */ /* XXX-BZ Ideally we'd flush on PUSH? */ @@ -686,8 +694,13 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct ts_ptr = (uint32_t *)(th + 1); if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) || (*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16| - TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) - return (TCP_LRO_CANNOT); + TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) { + /* + * Make sure that previously seen segements/ACKs are delivered + * before this segement. + */ + force_flush = 1; + } /* If the driver did not pass in the checksum, set it now. */ if (csum == 0x0000) @@ -754,6 +767,13 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct #endif } + if (force_flush) { + /* Timestamps mismatch; this is a FIN, etc */ + tcp_lro_active_remove(le); + tcp_lro_flush(lc, le); + return (TCP_LRO_CANNOT); + } + /* Flush now if appending will result in overflow. */ if (le->p_len > (lc->lro_length_lim - tcp_data_len)) { tcp_lro_active_remove(le); @@ -830,6 +850,14 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct return (0); } + if (force_flush) { + /* + * Nothing to flush, but this segment can not be further + * aggregated/delayed. + */ + return (TCP_LRO_CANNOT); + } + /* Try to find an empty slot. */ if (LIST_EMPTY(&lc->lro_free)) return (TCP_LRO_NO_ENTRIES); From owner-svn-src-head@freebsd.org Fri Aug 5 13:12:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A721CBB0F87; Fri, 5 Aug 2016 13:12:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80719121B; Fri, 5 Aug 2016 13:12:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 31806B93A; Fri, 5 Aug 2016 09:12:22 -0400 (EDT) From: John Baldwin To: Julian Elischer Cc: Bryan Drewery , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303755 - head/sys/kern Date: Fri, 05 Aug 2016 06:06:42 -0700 Message-ID: <2376311.cvfbdrNX43@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <03c923dd-4161-43ea-6249-b7b2b61e660f@freebsd.org> References: <201608041914.u74JEIOR071062@repo.freebsd.org> <1631194.6AMpXoHEiR@ralph.baldwin.cx> <03c923dd-4161-43ea-6249-b7b2b61e660f@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 05 Aug 2016 09:12:22 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 13:12:23 -0000 On Friday, August 05, 2016 01:06:22 PM Julian Elischer wrote: > On 5/08/2016 8:07 AM, John Baldwin wrote: > > On Thursday, August 04, 2016 07:14:18 PM Bryan Drewery wrote: > >> Author: bdrewery > >> Date: Thu Aug 4 19:14:18 2016 > >> New Revision: 303755 > >> URL: https://svnweb.freebsd.org/changeset/base/303755 > >> > >> Log: > >> Still provide freebsd10_* symbols from libc for COMPAT10. > >> > >> r296773 was done to only remove libc symbols for <7. We want to provide > >> the syscall symbols going forward for 7+. > > In particular, binaries from FreeBSD versions older than 7 do not link > > against libc.so.7. However, we want compat system call symbols in libc.so.7 > > for COMPAT_FREEBSD7 and later in case a shim is needed to implement an > > older version of a libc symbol via symver_compat(). > > > personally I'd rather we drove a stake through the heart of symbol > versioning and > went back to how it was, when one could work out what was going on. > I certainly miss the ability to get the openssl package to overwrite > the base one, > which I'm told is no longer possible due to versioning. It would be possible if both used the same versioning. Looks like base on my desktop (10.3) is not using versioning, so if the version map is provided by openssl we could in theory just use their version map when building base openssl. That is actually the far easier problem to solve (using upstream-maintained version map vs trying to maintain a local version map that has to be updated manually whenever upstream changes). -- John Baldwin From owner-svn-src-head@freebsd.org Fri Aug 5 13:53:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9918CBAFDBC; Fri, 5 Aug 2016 13:53:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D73E1BC6; Fri, 5 Aug 2016 13:53:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75DrS3x085257; Fri, 5 Aug 2016 13:53:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75DrSMA085253; Fri, 5 Aug 2016 13:53:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201608051353.u75DrSMA085253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 5 Aug 2016 13:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303767 - in head: share/man/man9 sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 13:53:29 -0000 Author: trasz Date: Fri Aug 5 13:53:28 2016 New Revision: 303767 URL: https://svnweb.freebsd.org/changeset/base/303767 Log: Remove lockmgr_waiters(9) and BUF_LOCKWAITERS(9); they were not used for anything. Reviewed by: kib@ MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D7420 Modified: head/share/man/man9/Makefile head/share/man/man9/lock.9 head/sys/sys/buf.h head/sys/sys/lockmgr.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Fri Aug 5 09:08:00 2016 (r303766) +++ head/share/man/man9/Makefile Fri Aug 5 13:53:28 2016 (r303767) @@ -1015,7 +1015,6 @@ MLINKS+=lock.9 lockdestroy.9 \ lock.9 lockmgr_printinfo.9 \ lock.9 lockmgr_recursed.9 \ lock.9 lockmgr_rw.9 \ - lock.9 lockmgr_waiters.9 \ lock.9 lockstatus.9 MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9 MLINKS+=make_dev.9 destroy_dev.9 \ Modified: head/share/man/man9/lock.9 ============================================================================== --- head/share/man/man9/lock.9 Fri Aug 5 09:08:00 2016 (r303766) +++ head/share/man/man9/lock.9 Fri Aug 5 13:53:28 2016 (r303767) @@ -39,7 +39,6 @@ .Nm lockmgr_printinfo , .Nm lockmgr_recursed , .Nm lockmgr_rw , -.Nm lockmgr_waiters , .Nm lockstatus , .Nm lockmgr_assert .Nd "lockmgr family of functions" @@ -66,8 +65,6 @@ .Ft int .Fn lockmgr_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" .Ft int -.Fn lockmgr_waiters "const struct lock *lkp" -.Ft int .Fn lockstatus "const struct lock *lkp" .Pp .Cd "options INVARIANTS" @@ -279,10 +276,6 @@ function returns true if the lock is rec otherwise. .Pp The -.Fn lockmgr_waiters -function returns true if the lock has waiters, 0 otherwise. -.Pp -The .Fn lockstatus function returns the status of the lock in relation to the current thread. .Pp Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Fri Aug 5 09:08:00 2016 (r303766) +++ head/sys/sys/buf.h Fri Aug 5 13:53:28 2016 (r303767) @@ -355,12 +355,6 @@ extern const char *buf_wmesg; /* Defaul _lockmgr_disown(&(bp)->b_lock, LOCK_FILE, LOCK_LINE) #endif -/* - * Find out if the lock has waiters or not. - */ -#define BUF_LOCKWAITERS(bp) \ - lockmgr_waiters(&(bp)->b_lock) - #endif /* _KERNEL */ struct buf_queue_head { Modified: head/sys/sys/lockmgr.h ============================================================================== --- head/sys/sys/lockmgr.h Fri Aug 5 09:08:00 2016 (r303766) +++ head/sys/sys/lockmgr.h Fri Aug 5 13:53:28 2016 (r303767) @@ -127,8 +127,6 @@ _lockmgr_args_rw(struct lock *lk, u_int #define lockmgr_rw(lk, flags, ilk) \ _lockmgr_args_rw((lk), (flags), (ilk), LK_WMESG_DEFAULT, \ LK_PRIO_DEFAULT, LK_TIMO_DEFAULT, LOCK_FILE, LOCK_LINE) -#define lockmgr_waiters(lk) \ - ((lk)->lk_lock & LK_ALL_WAITERS) #ifdef INVARIANTS #define lockmgr_assert(lk, what) \ _lockmgr_assert((lk), (what), LOCK_FILE, LOCK_LINE) From owner-svn-src-head@freebsd.org Fri Aug 5 14:23:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75231BB0D0D; Fri, 5 Aug 2016 14:23:28 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x235.google.com (mail-oi0-x235.google.com [IPv6:2607:f8b0:4003:c06::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 38BC81980; Fri, 5 Aug 2016 14:23:28 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x235.google.com with SMTP id l203so31420035oib.1; Fri, 05 Aug 2016 07:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0CPXxH5hTxsRiv3uWpVH3VsQ1CzA0n1zlbhqCePp9yA=; b=v55zpSBTBirBzHchahdIKn/XOwDPP2UnQHq+ExXKyyTxNsxdoqQbALB5IXHJDMQIS/ /rAq53FQvnM+hYpUTeYA0bW2UuXVdPqfAdvO9baYybB0gVQuF7J5lUqOXUOEUuSDpLWu 5pudCFnBC5bFXWESk/e04SKvFq8kNVfAX8x8o8DJdR64TosQbLG9MuX0ylbmdvZ3Scaz xh1bVuC4NzsQKF9jCFqWxhgB+bwpxchLa/vVrCZI7WY/2uaMmS2mbaPwS5XBcRHbWqLt umNnD33fW0UHrK/0A4VzlYAK32WYU2+TLZyPNYjNw0NnXkH6aFyGhNZ9l5nYx+91hKOw jtuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0CPXxH5hTxsRiv3uWpVH3VsQ1CzA0n1zlbhqCePp9yA=; b=iP3L9ExCvaL6MLG8DzqcCZDYFaTiKoRFiDbU0dqcVIDZNMezxrgvkXfTMZU15p0DvX 4JawE0lgoZCqmO5eK/vOgEzQgkhcowb/zh1oAk7IVcPy6bgQ2AyYkz6WwJtLwAzX+rjw ApSwgMyFl11Jg8BP5/G7iDDqq4iDXNI4+bLQbmju6MpFMUptTtROCk7jwIW5+BN4rvMU fCQVuRVYAhPlnLb6efw/Q4igPkiiz4c2Ttxf4bPjWi/vq5ejyzFtan0JjX48HfHNRsFL b5GBdGVH+vy9EcvrhcS/gMaOdreixrAQsv8lwyBkJJbHAvXA/7c9OjLfP6GTVg5EMar6 bqKA== X-Gm-Message-State: AEkooutrzF5AEeXL3KyDf5ZBwoN9fnfY4tTP/Nk8sBdEJXdLy0JrFfnnLGhdb3wjhkpI0WWam57rtHrPPCSpqQ== X-Received: by 10.157.24.7 with SMTP id b7mr1221128ote.35.1470407007231; Fri, 05 Aug 2016 07:23:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.11.145 with HTTP; Fri, 5 Aug 2016 07:23:26 -0700 (PDT) In-Reply-To: <2376311.cvfbdrNX43@ralph.baldwin.cx> References: <201608041914.u74JEIOR071062@repo.freebsd.org> <1631194.6AMpXoHEiR@ralph.baldwin.cx> <03c923dd-4161-43ea-6249-b7b2b61e660f@freebsd.org> <2376311.cvfbdrNX43@ralph.baldwin.cx> From: Benjamin Kaduk Date: Fri, 5 Aug 2016 09:23:26 -0500 Message-ID: Subject: Re: svn commit: r303755 - head/sys/kern To: John Baldwin Cc: Julian Elischer , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Bryan Drewery Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 14:23:28 -0000 On Fri, Aug 5, 2016 at 8:06 AM, John Baldwin wrote: > > It would be possible if both used the same versioning. Looks like > base on my desktop (10.3) is not using versioning, so if the version > map is provided by openssl we could in theory just use their version > map when building base openssl. That is actually the far easier > problem to solve (using upstream-maintained version map vs trying to > maintain a local version map that has to be updated manually whenever > upstream changes). > Upstream does not supply a version map for the 1.0.2 releases and older; it will be new in 1.1.0 (due out in a few weeks, last we heard). -Ben From owner-svn-src-head@freebsd.org Fri Aug 5 15:48:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2089BB0869; Fri, 5 Aug 2016 15:48:57 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B50F913A3; Fri, 5 Aug 2016 15:48:57 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75FmuEE026885; Fri, 5 Aug 2016 15:48:56 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75FmuD1026884; Fri, 5 Aug 2016 15:48:56 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201608051548.u75FmuD1026884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Fri, 5 Aug 2016 15:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303771 - head/sys/dev/xen/netfront X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 15:48:58 -0000 Author: royger Date: Fri Aug 5 15:48:56 2016 New Revision: 303771 URL: https://svnweb.freebsd.org/changeset/base/303771 Log: xen-netfront: improve the logic when handling nic features from ioctl Simplify the logic involved in changing the nic features on the fly, and only reset the frontend when really needed (when changing RX features). Also don't return from the ioctl until the interface has been properly reconfigured. While there, make sure XN_CSUM_FEATURES is used consistently. Reported by: julian MFC after: 5 days X-MFC-with: r303488 Sponsored by: Citrix Systems R&D Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Fri Aug 5 15:32:35 2016 (r303770) +++ head/sys/dev/xen/netfront/netfront.c Fri Aug 5 15:48:56 2016 (r303771) @@ -1760,7 +1760,7 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, #ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; #endif - int mask, error = 0; + int mask, error = 0, reinit; dev = sc->xbdev; @@ -1809,41 +1809,36 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, break; case SIOCSIFCAP: mask = ifr->ifr_reqcap ^ ifp->if_capenable; + reinit = 0; + if (mask & IFCAP_TXCSUM) { - if (IFCAP_TXCSUM & ifp->if_capenable) { - ifp->if_capenable &= ~(IFCAP_TXCSUM|IFCAP_TSO4); - ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP - | CSUM_IP | CSUM_TSO); - } else { - ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP - | CSUM_IP); - } - } - if (mask & IFCAP_RXCSUM) { - ifp->if_capenable ^= IFCAP_RXCSUM; + ifp->if_capenable ^= IFCAP_TXCSUM; + ifp->if_hwassist ^= XN_CSUM_FEATURES; } if (mask & IFCAP_TSO4) { - if (IFCAP_TSO4 & ifp->if_capenable) { - ifp->if_capenable &= ~IFCAP_TSO4; - ifp->if_hwassist &= ~CSUM_TSO; - } else if (IFCAP_TXCSUM & ifp->if_capenable) { - ifp->if_capenable |= IFCAP_TSO4; - ifp->if_hwassist |= CSUM_TSO; - } else { - IPRINTK("Xen requires tx checksum offload" - " be enabled to use TSO\n"); - error = EINVAL; - } + ifp->if_capenable ^= IFCAP_TSO4; + ifp->if_hwassist ^= CSUM_TSO; } - if (mask & IFCAP_LRO) { - ifp->if_capenable ^= IFCAP_LRO; + if (mask & (IFCAP_RXCSUM | IFCAP_LRO)) { + /* These Rx features require us to renegotiate. */ + reinit = 1; + + if (mask & IFCAP_RXCSUM) + ifp->if_capenable ^= IFCAP_RXCSUM; + if (mask & IFCAP_LRO) + ifp->if_capenable ^= IFCAP_LRO; } + + if (reinit == 0) + break; + /* * We must reset the interface so the backend picks up the * new features. */ + device_printf(sc->xbdev, + "performing interface reset due to feature change\n"); XN_LOCK(sc); netfront_carrier_off(sc); sc->xn_reset = true; @@ -1865,6 +1860,13 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, xs_rm(XST_NIL, xenbus_get_node(dev), "feature-gso-tcpv4"); xs_rm(XST_NIL, xenbus_get_node(dev), "feature-no-csum-offload"); xenbus_set_state(dev, XenbusStateClosing); + + /* + * Wait for the frontend to reconnect before returning + * from the ioctl. 30s should be more than enough for any + * sane backend to reconnect. + */ + error = tsleep(sc, 0, "xn_rst", 30*hz); break; case SIOCADDMULTI: case SIOCDELMULTI: @@ -1971,6 +1973,7 @@ xn_connect(struct netfront_info *np) * packets. */ netfront_carrier_on(np); + wakeup(np); return (0); } @@ -2085,7 +2088,7 @@ xn_configure_features(struct netfront_in #endif if ((ifp->if_capabilities & cap_enabled & IFCAP_TXCSUM) != 0) { ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= CSUM_TCP|CSUM_UDP; + ifp->if_hwassist |= XN_CSUM_FEATURES; } if ((ifp->if_capabilities & cap_enabled & IFCAP_RXCSUM) != 0) ifp->if_capenable |= IFCAP_RXCSUM; From owner-svn-src-head@freebsd.org Fri Aug 5 15:53:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24347BB0B7A; Fri, 5 Aug 2016 15:53:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 04ECB18FD; Fri, 5 Aug 2016 15:53:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id A59E5197F; Fri, 5 Aug 2016 15:53:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Fri, 5 Aug 2016 15:53:52 +0000 From: Glen Barber To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys Message-ID: <20160805155352.GO43509@FreeBSD.org> References: <201608050623.u756N695018889@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nb8zVy0QMK3AA1xu" Content-Disposition: inline In-Reply-To: <201608050623.u756N695018889@repo.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 15:53:55 -0000 --nb8zVy0QMK3AA1xu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 05, 2016 at 06:23:06AM +0000, Andriy Gapon wrote: > Author: avg > Date: Fri Aug 5 06:23:06 2016 > New Revision: 303763 > URL: https://svnweb.freebsd.org/changeset/base/303763 >=20 > Log: > zfs: honour and make use of vfs vnode locking protocol > =20 > ZFS POSIX Layer is originally written for Solaris VFS which is very > different from FreeBSD VFS. Most importantly many things that FreeBSD = VFS > manages on behalf of all filesystems are implemented in ZPL in a differ= ent > way. > Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS > functionality or, in the worst cases, badly interacts / interferes > with VFS. > =20 > The most prominent problem is a deadlock caused by the lock order rever= sal > of vnode locks that may happen with concurrent zfs_rename() and lookup(= ). > The deadlock is a result of zfs_rename() not observing the vnode locking > contract expected by VFS. > =20 > This commit removes all ZPL internal locking that protects parent-child > relationships of filesystem nodes. These relationships are protected > by vnode locks and the code is changed to take advantage of that fact > and to properly interact with VFS. > =20 > Removal of the internal locking allowed all ZPL dmu_tx_assign calls to > use TXG_WAIT mode. > =20 > Another victim, disputable perhaps, is ZFS support for filesystems with > mixed case sensitivity. That support is not provided by the OS anyway, > so in ZFS it was a buch of dead code. > =20 > To do: > - replace ZFS_ENTER mechanism with VFS managed / visible mechanism > - replace zfs_zget with zfs_vget[f] as much as possible > - get rid of not really useful now zfs_freebsd_* adapters > - more cleanups of unneeded / unused code > - fix / replace .zfs support > =20 > PR: 209158 > Reported by: many > Tested by: many (thank you all!) > MFC after: 5 days > Sponsored by: HybridCluster / ClusterHQ > Differential Revision: https://reviews.freebsd.org/D6533 >=20 Thank you very much for working on this. Glen --nb8zVy0QMK3AA1xu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXpLaQAAoJEAMUWKVHj+KT/aEP/1F1VHNqBotHGGTixpiZF9PM 1ptunhtBDZ6ypcUCmn5JpbMXZLdr7TafWn3GAERrnhhoq8Sfj7LKuKioO/QjBBbq b20FtOqVETiAxdv2bEPVx4Crq7QcnGk1/xXVXfiTAXsRbqx4oZ90KfC3mE5oAJ+c k79IzhJzIGYYqZShQadIcBP7grcI5q8NwxZ0N6XL2Xoc9r67885J0MD14XG9T/Mc ztrEl8P4EVPh01uF55ZED5bRUkDU8HxJ8yWGTZooAzhgF8t1wEZJ+F79rxb+XNDI 3EAgzzQeyaKuXnQDcu3nQHw08exbzIjmW7aN7JhcSYMP3J1T+AJNR11QlSUWA88W fKPA4tSKPrsxTarsOJ2O+kibxBTIlVi3lq8ZHX6bhe093MZruWH/efT0HAOCHDdG T2ZwBCAt8+HRyKKbdMWASBiiJdyt0VZM4RIM7CWoDuGlJ/eoRtXJpIxU/CbG+Ojg ASZETRlNFrNCsQH6DOP7kZcrNYvOtZYTHicdzg1ybTDu9Dr4n+wvfqyfcLNgNF/a lp5szum8+yN4EBNgvyaQyvGiEWHLrhPpiRew1dxO4AGLNSIAteGmB1oT0uBz0cvH SvKh4JRSedy9qb5D6Ki5T9qSZX1Cvu4AjlAJMyZ2liEfDTIRUB3oHExejCnM/PfU XjgJ8y//gn10w+5C57sk =2aYa -----END PGP SIGNATURE----- --nb8zVy0QMK3AA1xu-- From owner-svn-src-head@freebsd.org Fri Aug 5 16:23:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1795EBB022A; Fri, 5 Aug 2016 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id F11D01D5C; Fri, 5 Aug 2016 16:23:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id E5316135B; Fri, 5 Aug 2016 16:23:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 9E17524209; Fri, 5 Aug 2016 16:23:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 7OuIsVV8U_rH; Fri, 5 Aug 2016 16:23:27 +0000 (UTC) Subject: Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 038F8241F1 To: Andriy Gapon References: <201608050623.u756N695018889@repo.freebsd.org> <20160805155352.GO43509@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <6dd5a35d-4218-d054-2a55-f6250f2c7ad6@FreeBSD.org> Date: Fri, 5 Aug 2016 09:23:26 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160805155352.GO43509@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WFmLqA8kUXTLa7wxv8p2ENQU2XRwCw5uE" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 16:23:31 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WFmLqA8kUXTLa7wxv8p2ENQU2XRwCw5uE Content-Type: multipart/mixed; boundary="DFTbOav9PxOXc8mjDKit9H1DXVAjwIMtr" From: Bryan Drewery To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <6dd5a35d-4218-d054-2a55-f6250f2c7ad6@FreeBSD.org> Subject: Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys References: <201608050623.u756N695018889@repo.freebsd.org> <20160805155352.GO43509@FreeBSD.org> In-Reply-To: <20160805155352.GO43509@FreeBSD.org> --DFTbOav9PxOXc8mjDKit9H1DXVAjwIMtr Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 8/5/2016 8:53 AM, Glen Barber wrote: > On Fri, Aug 05, 2016 at 06:23:06AM +0000, Andriy Gapon wrote: >> Author: avg >> Date: Fri Aug 5 06:23:06 2016 >> New Revision: 303763 >> URL: https://svnweb.freebsd.org/changeset/base/303763 >> >> Log: >> zfs: honour and make use of vfs vnode locking protocol >> =20 >> ZFS POSIX Layer is originally written for Solaris VFS which is very >> different from FreeBSD VFS. Most importantly many things that FreeB= SD VFS >> manages on behalf of all filesystems are implemented in ZPL in a dif= ferent >> way. >> Thus, ZPL contains code that is redundant on FreeBSD or duplicates V= FS >> functionality or, in the worst cases, badly interacts / interferes >> with VFS. >> =20 >> The most prominent problem is a deadlock caused by the lock order re= versal >> of vnode locks that may happen with concurrent zfs_rename() and look= up(). >> The deadlock is a result of zfs_rename() not observing the vnode loc= king >> contract expected by VFS. >> =20 >> This commit removes all ZPL internal locking that protects parent-ch= ild >> relationships of filesystem nodes. These relationships are protecte= d >> by vnode locks and the code is changed to take advantage of that fac= t >> and to properly interact with VFS. >> =20 >> Removal of the internal locking allowed all ZPL dmu_tx_assign calls = to >> use TXG_WAIT mode. >> =20 >> Another victim, disputable perhaps, is ZFS support for filesystems w= ith >> mixed case sensitivity. That support is not provided by the OS anyw= ay, >> so in ZFS it was a buch of dead code. >> =20 >> To do: >> - replace ZFS_ENTER mechanism with VFS managed / visible mechanism >> - replace zfs_zget with zfs_vget[f] as much as possible >> - get rid of not really useful now zfs_freebsd_* adapters >> - more cleanups of unneeded / unused code >> - fix / replace .zfs support >> =20 >> PR: 209158 >> Reported by: many >> Tested by: many (thank you all!) >> MFC after: 5 days >> Sponsored by: HybridCluster / ClusterHQ >> Differential Revision: https://reviews.freebsd.org/D6533 >> >=20 > Thank you very much for working on this. >=20 Yes agreed. It scares me, but releasing with trivial deadlocks that we cannot EN due to that risk scares me more. FreeBSD's ZFS is a huge selling point for it and we want to maintain that. --=20 Regards, Bryan Drewery --DFTbOav9PxOXc8mjDKit9H1DXVAjwIMtr-- --WFmLqA8kUXTLa7wxv8p2ENQU2XRwCw5uE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJXpL1+AAoJEDXXcbtuRpfPF5MH/01vCg/Q9aDuvctDPse7hzkO MMT/DHSB+6nEnUtUrwOOzkT3GmTzVXS6jiju8GY1dr9n6ldf1Z+vkJgNchi4NA7L Df9GxXreS6S1oQgLmK6LloVMG8ivmJQYB20XGqqwb9qfdzwlY/Inmef/sffShqz3 cYudMEhvw0OlDiwcsnrGELVHvKNkEaT/pFW9cbIwC0Ofy4UPCwjLJddwfMMNYG3S uMogdcg7h7MZdM2SOAP0lkdEqQOahb8MW4t/yicts9CWR6GgawGKVXHjQHiNkGdf v/mgG3pCnwqZaxUfyrDBml0qJO5iAKyAA1Wz1cbrruzM0ZKmbCEWPkw7sHVzAe0= =Mj/m -----END PGP SIGNATURE----- --WFmLqA8kUXTLa7wxv8p2ENQU2XRwCw5uE-- From owner-svn-src-head@freebsd.org Fri Aug 5 16:44:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 777A6BB0631; Fri, 5 Aug 2016 16:44:12 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A9E2190D; Fri, 5 Aug 2016 16:44:12 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75GiB1L049414; Fri, 5 Aug 2016 16:44:11 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75GiBXA049413; Fri, 5 Aug 2016 16:44:11 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201608051644.u75GiBXA049413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 5 Aug 2016 16:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303773 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 16:44:12 -0000 Author: alc Date: Fri Aug 5 16:44:11 2016 New Revision: 303773 URL: https://svnweb.freebsd.org/changeset/base/303773 Log: Correct a spelling error. Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri Aug 5 16:32:09 2016 (r303772) +++ head/sys/vm/vm_pageout.c Fri Aug 5 16:44:11 2016 (r303773) @@ -247,7 +247,7 @@ static boolean_t vm_pageout_page_lock(vm /* * Initialize a dummy page for marking the caller's place in the specified * paging queue. In principle, this function only needs to set the flag - * PG_MARKER. Nonetheless, it wirte busies and initializes the hold count + * PG_MARKER. Nonetheless, it write busies and initializes the hold count * to one as safety precautions. */ static void From owner-svn-src-head@freebsd.org Fri Aug 5 17:16:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6477DBB0FC6; Fri, 5 Aug 2016 17:16:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA801F7C; Fri, 5 Aug 2016 17:16:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75HGZAq060710; Fri, 5 Aug 2016 17:16:35 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75HGZAl060709; Fri, 5 Aug 2016 17:16:35 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608051716.u75HGZAl060709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 5 Aug 2016 17:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303778 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 17:16:36 -0000 Author: adrian Date: Fri Aug 5 17:16:35 2016 New Revision: 303778 URL: https://svnweb.freebsd.org/changeset/base/303778 Log: [arge] add some extra MDIO debugging support * add an ANY debug level which will always echo the message if debugging is compiled in; * log MDIO transaction timeouts if debugging is compiled in; * the argemdio device is different to arge, so turning on MDIO debugging flags in arge->sc_debug doesn't help. Add a debug sysctl to argemdio as well so that MDIO transactions can be debugged. Tested: * AR9331 Modified: head/sys/mips/atheros/if_arge.c Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Fri Aug 5 17:14:45 2016 (r303777) +++ head/sys/mips/atheros/if_arge.c Fri Aug 5 17:16:35 2016 (r303778) @@ -108,6 +108,7 @@ typedef enum { ARGE_DBG_ERR = 0x00000010, ARGE_DBG_RESET = 0x00000020, ARGE_DBG_PLL = 0x00000040, + ARGE_DBG_ANY = 0xffffffff, } arge_debug_flags; static const char * arge_miicfg_str[] = { @@ -122,7 +123,7 @@ static const char * arge_miicfg_str[] = #ifdef ARGE_DEBUG #define ARGEDEBUG(_sc, _m, ...) \ do { \ - if ((_m) & (_sc)->arge_debug) \ + if (((_m) & (_sc)->arge_debug) || ((_m) == ARGE_DBG_ANY)) \ device_printf((_sc)->arge_dev, __VA_ARGS__); \ } while (0) #else @@ -1123,7 +1124,7 @@ arge_miibus_readreg(device_t dev, int ph if (arge_mdio_busy(sc) != 0) { mtx_unlock(&miibus_mtx); - ARGEDEBUG(sc, ARGE_DBG_MII, "%s timedout\n", __func__); + ARGEDEBUG(sc, ARGE_DBG_ANY, "%s timedout\n", __func__); /* XXX: return ERRNO istead? */ return (-1); } @@ -1160,7 +1161,7 @@ arge_miibus_writereg(device_t dev, int p if (arge_mdio_busy(sc) != 0) { mtx_unlock(&miibus_mtx); - ARGEDEBUG(sc, ARGE_DBG_MII, "%s timedout\n", __func__); + ARGEDEBUG(sc, ARGE_DBG_ANY, "%s timedout\n", __func__); /* XXX: return ERRNO istead? */ return (-1); } @@ -2690,7 +2691,10 @@ argemdio_attach(device_t dev) { struct arge_softc *sc; int error = 0; - +#ifdef ARGE_DEBUG + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; +#endif sc = device_get_softc(dev); sc->arge_dev = dev; sc->arge_mac_unit = device_get_unit(dev); @@ -2703,6 +2707,14 @@ argemdio_attach(device_t dev) goto fail; } +#ifdef ARGE_DEBUG + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "debug", CTLFLAG_RW, &sc->arge_debug, 0, + "argemdio interface debugging flags"); +#endif + /* Reset MAC - required for AR71xx MDIO to successfully occur */ arge_reset_mac(sc); /* Reset MII bus */ From owner-svn-src-head@freebsd.org Fri Aug 5 17:17:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C5D1BAF074; Fri, 5 Aug 2016 17:17:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 199F5132D; Fri, 5 Aug 2016 17:17:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75HHaBd060786; Fri, 5 Aug 2016 17:17:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75HHaKk060785; Fri, 5 Aug 2016 17:17:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201608051717.u75HHaKk060785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 5 Aug 2016 17:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303779 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 17:17:37 -0000 Author: adrian Date: Fri Aug 5 17:17:36 2016 New Revision: 303779 URL: https://svnweb.freebsd.org/changeset/base/303779 Log: [ar934x] add tap/tun as modules, for people who wish to use VPNs. Modified: head/sys/mips/conf/std.AR934X Modified: head/sys/mips/conf/std.AR934X ============================================================================== --- head/sys/mips/conf/std.AR934X Fri Aug 5 17:16:35 2016 (r303778) +++ head/sys/mips/conf/std.AR934X Fri Aug 5 17:17:36 2016 (r303779) @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR934X_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_vlan if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_ahb hwpmc ipfw ipfw_nat libalias urtwn urtwnfw otus otusfw" +makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 urtwn urtwnfw otus otusfw" # makeoptions MODULES_OVERRIDE="" options DDB From owner-svn-src-head@freebsd.org Fri Aug 5 19:00:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7058ABB0DD0; Fri, 5 Aug 2016 19:00:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40C5F1345; Fri, 5 Aug 2016 19:00:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75J0jNH098849; Fri, 5 Aug 2016 19:00:45 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75J0jSF098848; Fri, 5 Aug 2016 19:00:45 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201608051900.u75J0jSF098848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 5 Aug 2016 19:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303782 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 19:00:46 -0000 Author: gjb Date: Fri Aug 5 19:00:45 2016 New Revision: 303782 URL: https://svnweb.freebsd.org/changeset/base/303782 Log: Fix GCE image publication. The gcutil utility is deprecated in favor of gcloud. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile.gce Modified: head/release/Makefile.gce ============================================================================== --- head/release/Makefile.gce Fri Aug 5 18:41:51 2016 (r303781) +++ head/release/Makefile.gce Fri Aug 5 19:00:45 2016 (r303782) @@ -35,7 +35,7 @@ gce-check-depends: @false . endif .endfor -.if !exists(/usr/local/bin/gcutil) +.if !exists(/usr/local/bin/gcloud) . if !exists(${PORTSDIR}/net/google-cloud-sdk/Makefile) . if !exists(/usr/local/sbin/pkg-static) env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf @@ -63,7 +63,7 @@ gce-do-upload: /usr/local/bin/gsutil mb gs://${GCE_BUCKET} || true /usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET}.tar.gz \ gs://${GCE_BUCKET}/ - /usr/local/bin/gcutil addimage ${GCE_TARGET} \ - gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz + /usr/local/bin/gcloud compute images create ${GCE_TARGET} \ + --source-uri gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz touch ${.OBJDIR}/${.TARGET} From owner-svn-src-head@freebsd.org Fri Aug 5 19:14:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FC21BB0007; Fri, 5 Aug 2016 19:14:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B4C31D24; Fri, 5 Aug 2016 19:14:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75JEtK1006026; Fri, 5 Aug 2016 19:14:55 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75JEt1f006025; Fri, 5 Aug 2016 19:14:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608051914.u75JEt1f006025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 5 Aug 2016 19:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303783 - head/usr.bin/sdiff X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 19:14:56 -0000 Author: bapt Date: Fri Aug 5 19:14:55 2016 New Revision: 303783 URL: https://svnweb.freebsd.org/changeset/base/303783 Log: sdiff: remove non finish/function code 2 extra options not available neither on other BSD nor in GNU sdiff: --diff-pid and --pipe-fd were present in the SoC code, none were usable Just remove it Modified: head/usr.bin/sdiff/sdiff.c Modified: head/usr.bin/sdiff/sdiff.c ============================================================================== --- head/usr.bin/sdiff/sdiff.c Fri Aug 5 19:00:45 2016 (r303782) +++ head/usr.bin/sdiff/sdiff.c Fri Aug 5 19:14:55 2016 (r303783) @@ -104,9 +104,6 @@ enum { HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, - PIPE_FD, - /* pid from the diff parent (if applicable) */ - DIFF_PID, NOOP_OPT, }; @@ -120,8 +117,6 @@ static struct option longopts[] = { { "output", required_argument, NULL, 'o' }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, - { "pipe-fd", required_argument, NULL, PIPE_FD }, - { "diff-pid", required_argument, NULL, DIFF_PID }, /* Options processed by diff. */ { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT }, { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT }, @@ -236,7 +231,7 @@ main(int argc, char **argv) FILE *diffpipe=NULL, *file1, *file2; size_t diffargc = 0, wflag = WIDTH; int ch, fd[2] = {-1}, status; - pid_t pid=0; pid_t ppid =-1; + pid_t pid=0; const char *outfile = NULL; struct option *popt; char **diffargv, *diffprog = DIFF_PATH, *filename1, *filename2, @@ -319,11 +314,6 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; - case DIFF_PID: - ppid = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(2, "diff pid value is %s: %s", errstr, optarg); - break; case HELP_OPT: for (i = 0; help_msg[i] != NULL; i++) printf("%s\n", help_msg[i]); @@ -392,35 +382,34 @@ main(int argc, char **argv) errx(2, "width is too large: %zu", width); line_width = width * 2 + 3; - if (ppid == -1 ) { - if (pipe(fd)) - err(2, "pipe"); - - switch (pid = fork()) { - case 0: - /* child */ - /* We don't read from the pipe. */ - close(fd[0]); - if (dup2(fd[1], STDOUT_FILENO) == -1) - err(2, "child could not duplicate descriptor"); - /* Free unused descriptor. */ - close(fd[1]); - execvp(diffprog, diffargv); - err(2, "could not execute diff: %s", diffprog); - break; - case -1: - err(2, "could not fork"); - break; - } + if (pipe(fd)) + err(2, "pipe"); - /* parent */ - /* We don't write to the pipe. */ + switch (pid = fork()) { + case 0: + /* child */ + /* We don't read from the pipe. */ + close(fd[0]); + if (dup2(fd[1], STDOUT_FILENO) == -1) + err(2, "child could not duplicate descriptor"); + /* Free unused descriptor. */ close(fd[1]); - - /* Open pipe to diff command. */ - if ((diffpipe = fdopen(fd[0], "r")) == NULL) - err(2, "could not open diff pipe"); + execvp(diffprog, diffargv); + err(2, "could not execute diff: %s", diffprog); + break; + case -1: + err(2, "could not fork"); + break; } + + /* parent */ + /* We don't write to the pipe. */ + close(fd[1]); + + /* Open pipe to diff command. */ + if ((diffpipe = fdopen(fd[0], "r")) == NULL) + err(2, "could not open diff pipe"); + if ((file1 = fopen(filename1, "r")) == NULL) err(2, "could not open %s", filename1); if ((file2 = fopen(filename2, "r")) == NULL) From owner-svn-src-head@freebsd.org Fri Aug 5 19:22:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C87DABB0679; Fri, 5 Aug 2016 19:22:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 818E31833; Fri, 5 Aug 2016 19:22:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75JMXje009562; Fri, 5 Aug 2016 19:22:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75JMXVt009561; Fri, 5 Aug 2016 19:22:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608051922.u75JMXVt009561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 5 Aug 2016 19:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303784 - head/usr.sbin/etcupdate X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 19:22:34 -0000 Author: bapt Date: Fri Aug 5 19:22:33 2016 New Revision: 303784 URL: https://svnweb.freebsd.org/changeset/base/303784 Log: etcupdate: directly use diff3(1) instead of merge(1) During the last attempt to rmeove GNU rcs, 2 blockers were spotted: We need an ident(1) and etcupdate(8) uses merge(1). Now nothing should prevent to remove rcs from base Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D7401 Modified: head/usr.sbin/etcupdate/etcupdate.sh Modified: head/usr.sbin/etcupdate/etcupdate.sh ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.sh Fri Aug 5 19:14:55 2016 (r303783) +++ head/usr.sbin/etcupdate/etcupdate.sh Fri Aug 5 19:22:33 2016 (r303784) @@ -814,15 +814,17 @@ merge_file() local res # Try the merge to see if there is a conflict. - merge -q -p ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 >/dev/null 2>&3 + diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > /dev/null 2>&3 res=$? case $res in 0) # No conflicts, so just redo the merge to the # real file. - log "merge ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1" + log "diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1" if [ -z "$dryrun" ]; then - merge ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 + temp=$(mktemp -t etcupdate) + diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > ${temp} + mv -f ${temp} ${DESTDIR}$1 fi post_install_file $1 echo " M $1" @@ -832,10 +834,10 @@ merge_file() # the conflicts directory. if [ -z "$dryrun" ]; then install_dirs $NEWTREE $CONFLICTS $1 - log "cp -Rp ${DESTDIR}$1 ${CONFLICTS}$1" - cp -Rp ${DESTDIR}$1 ${CONFLICTS}$1 >&3 2>&1 - merge -A -q -L "yours" -L "original" -L "new" \ - ${CONFLICTS}$1 ${OLDTREE}$1 ${NEWTREE}$1 + log "diff3 -m -A ${DESTDIR}$1 ${CONFLICTS}$1" + diff3 -m -A -L "yours" -L "original" -L "new" \ + ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > \ + ${CONFLICTS}$1 fi echo " C $1" ;; From owner-svn-src-head@freebsd.org Fri Aug 5 19:24:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C519BB070F; Fri, 5 Aug 2016 19:24:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44C8F19F0; Fri, 5 Aug 2016 19:24:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75JOqc7009678; Fri, 5 Aug 2016 19:24:52 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75JOqQ8009676; Fri, 5 Aug 2016 19:24:52 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608051924.u75JOqQ8009676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 5 Aug 2016 19:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303785 - in head: tools/build/mk usr.sbin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 19:24:53 -0000 Author: bapt Date: Fri Aug 5 19:24:52 2016 New Revision: 303785 URL: https://svnweb.freebsd.org/changeset/base/303785 Log: always install etcupdate Now that etcupdate does not depend on rcs anymore there is no need to conditionnally install it Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/Makefile Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Aug 5 19:22:33 2016 (r303784) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Aug 5 19:24:52 2016 (r303785) @@ -6800,7 +6800,6 @@ OLD_FILES+=usr/bin/rcsdiff OLD_FILES+=usr/bin/rcsfreeze OLD_FILES+=usr/bin/rcsmerge OLD_FILES+=usr/bin/rlog -OLD_FILES+=usr/sbin/etcupdate OLD_FILES+=usr/share/man/man1/ci.1.gz OLD_FILES+=usr/share/man/man1/co.1.gz OLD_FILES+=usr/share/man/man1/merge.1.gz @@ -6812,16 +6811,6 @@ OLD_FILES+=usr/share/man/man1/rcsintro.1 OLD_FILES+=usr/share/man/man1/rcsmerge.1.gz OLD_FILES+=usr/share/man/man1/rlog.1.gz OLD_FILES+=usr/share/man/man5/rcsfile.5.gz -OLD_FILES+=usr/share/man/man8/etcupdate.8.gz -OLD_FILES+=usr/tests/usr.sbin/etcupdate/Kyuafile -OLD_FILES+=usr/tests/usr.sbin/etcupdate/always_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/conflicts_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/fbsdid_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/ignore_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/preworld_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/tests_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/tzsetup_test -OLD_DIRS+=usr/tests/usr.sbin/etcupdate .endif #.if ${MK_RESCUE} == no Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Fri Aug 5 19:22:33 2016 (r303784) +++ head/usr.sbin/Makefile Fri Aug 5 19:24:52 2016 (r303785) @@ -25,6 +25,7 @@ SUBDIR= adduser \ digictl \ diskinfo \ dumpcis \ + etcupdate \ extattr \ extattrctl \ fifolog \ @@ -188,7 +189,6 @@ SUBDIR.${MK_QUOTAS}+= edquota SUBDIR.${MK_QUOTAS}+= quotaon SUBDIR.${MK_QUOTAS}+= repquota SUBDIR.${MK_RCMDS}+= rwhod -SUBDIR.${MK_RCS}+= etcupdate SUBDIR.${MK_SENDMAIL}+= editmap SUBDIR.${MK_SENDMAIL}+= mailstats SUBDIR.${MK_SENDMAIL}+= makemap From owner-svn-src-head@freebsd.org Fri Aug 5 21:11:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7187BB0087; Fri, 5 Aug 2016 21:11:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93F341EED; Fri, 5 Aug 2016 21:11:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 648F4B93A; Fri, 5 Aug 2016 17:11:38 -0400 (EDT) From: John Baldwin To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303784 - head/usr.sbin/etcupdate Date: Fri, 05 Aug 2016 14:11:04 -0700 Message-ID: <3736754.gl7IgcC6z2@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201608051922.u75JMXVt009561@repo.freebsd.org> References: <201608051922.u75JMXVt009561@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 05 Aug 2016 17:11:38 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 21:11:39 -0000 On Friday, August 05, 2016 07:22:33 PM Baptiste Daroussin wrote: > Author: bapt > Date: Fri Aug 5 19:22:33 2016 > New Revision: 303784 > URL: https://svnweb.freebsd.org/changeset/base/303784 > > Log: > etcupdate: directly use diff3(1) instead of merge(1) > > During the last attempt to rmeove GNU rcs, 2 blockers were spotted: > We need an ident(1) and etcupdate(8) uses merge(1). > > Now nothing should prevent to remove rcs from base > > Reviewed by: jhb > Differential Revision: https://reviews.freebsd.org/D7401 Thanks for cleaning this up! -- John Baldwin From owner-svn-src-head@freebsd.org Fri Aug 5 21:34:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E462BB0642; Fri, 5 Aug 2016 21:34:11 +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 BB4361E44; Fri, 5 Aug 2016 21:34:10 +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 u75LYAGs058367; Fri, 5 Aug 2016 21:34:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75LY96j058365; Fri, 5 Aug 2016 21:34:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608052134.u75LY96j058365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 5 Aug 2016 21:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303786 - head/sys/ofed/drivers/infiniband/hw/mthca X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 21:34:11 -0000 Author: markj Date: Fri Aug 5 21:34:09 2016 New Revision: 303786 URL: https://svnweb.freebsd.org/changeset/base/303786 Log: mthca: Add a wrapper for the firmware's DIAG_RPRT command. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.h Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c Fri Aug 5 19:24:52 2016 (r303785) +++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c Fri Aug 5 21:34:09 2016 (r303786) @@ -1927,6 +1927,13 @@ int mthca_MGID_HASH(struct mthca_dev *de return err; } +int mthca_DIAG_RPRT(struct mthca_dev *dev, int mod, + struct mthca_mailbox *mailbox, u8 *status) +{ + return mthca_cmd_box(dev, 0, mailbox->dma, 0, mod, CMD_DIAG_RPRT, + CMD_TIME_CLASS_A, status); +} + int mthca_NOP(struct mthca_dev *dev, u8 *status) { return mthca_cmd(dev, 0, 0x1f, 0, CMD_NOP, msecs_to_jiffies(100), status); Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.h ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.h Fri Aug 5 19:24:52 2016 (r303785) +++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.h Fri Aug 5 21:34:09 2016 (r303786) @@ -112,6 +112,15 @@ enum { DEV_LIM_FLAG_UD_MULTI = 1 << 21, }; +enum { + DIAG_RPRT_Q_XPRT_CIERR = 2, + DIAG_RPRT_QR_XPRT_CIERR = 3, + DIAG_RPRT_Q_PERF = 4, + DIAG_RPRT_QR_PERF = 5, + DIAG_RPRT_Q_MISC = 6, + DIAG_RPRT_QR_MISC = 7, +}; + struct mthca_mailbox { dma_addr_t dma; void *buf; @@ -325,6 +334,8 @@ int mthca_WRITE_MGM(struct mthca_dev *de struct mthca_mailbox *mailbox, u8 *status); int mthca_MGID_HASH(struct mthca_dev *dev, struct mthca_mailbox *mailbox, u16 *hash, u8 *status); +int mthca_DIAG_RPRT(struct mthca_dev *dev, int mod, + struct mthca_mailbox *mailbox, u8 *status); int mthca_NOP(struct mthca_dev *dev, u8 *status); #endif /* MTHCA_CMD_H */ From owner-svn-src-head@freebsd.org Fri Aug 5 23:23:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A262FBB0AFC; Fri, 5 Aug 2016 23:23:49 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 616BA1EDC; Fri, 5 Aug 2016 23:23:49 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75NNmhb099625; Fri, 5 Aug 2016 23:23:48 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75NNmD2099623; Fri, 5 Aug 2016 23:23:48 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201608052323.u75NNmD2099623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 5 Aug 2016 23:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303788 - in head: sys/dev/pci usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 23:23:49 -0000 Author: vangyzen Date: Fri Aug 5 23:23:48 2016 New Revision: 303788 URL: https://svnweb.freebsd.org/changeset/base/303788 Log: Fix some logic in PCIe HotPlug; display EI status The interpretation of the Electromechanical Interlock Status was inverted, so we disengaged the EI if a card was inserted. Fix it to engage the EI if a card is inserted. When displaying the slot capabilites/status with pciconf: - We inverted the sense of the Power Controller Control bit, saying the power was off when it was really on (according to this bit). Fix that. - Display the status of the Electromechanical Interlock: EI(engaged) EI(disengaged) Reviewed by: jhb MFC after: 3 days Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D7426 Modified: head/sys/dev/pci/pci_pci.c head/usr.sbin/pciconf/cap.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Fri Aug 5 22:23:04 2016 (r303787) +++ head/sys/dev/pci/pci_pci.c Fri Aug 5 23:23:48 2016 (r303788) @@ -1057,7 +1057,7 @@ static void pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask, bool schedule_task) { - bool card_inserted; + bool card_inserted, ei_engaged; /* Clear DETACHING if Present Detect has cleared. */ if ((sc->pcie_slot_sta & (PCIEM_SLOT_STA_PDC | PCIEM_SLOT_STA_PDS)) == @@ -1094,8 +1094,8 @@ pcib_pcie_hotplug_update(struct pcib_sof */ if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) { mask |= PCIEM_SLOT_CTL_EIC; - if (card_inserted != - !(sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS)) + ei_engaged = (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) != 0; + if (card_inserted != ei_engaged) val |= PCIEM_SLOT_CTL_EIC; } @@ -1122,7 +1122,7 @@ pcib_pcie_hotplug_update(struct pcib_sof pcib_pcie_hotplug_command(sc, val, mask); /* - * During attach the child "pci" device is added sychronously; + * During attach the child "pci" device is added synchronously; * otherwise, the task is scheduled to manage the child * device. */ Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Fri Aug 5 22:23:04 2016 (r303787) +++ head/usr.sbin/pciconf/cap.c Fri Aug 5 23:23:48 2016 (r303788) @@ -529,10 +529,13 @@ cap_express(int fd, struct pci_conf *p, if (cap & PCIEM_SLOT_CAP_APB) printf(" Attn Button"); if (cap & PCIEM_SLOT_CAP_PCP) - printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "on" : "off"); + printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "off" : "on"); if (cap & PCIEM_SLOT_CAP_MRLSP) printf(" MRL(%s)", sta & PCIEM_SLOT_STA_MRLSS ? "open" : "closed"); + if (cap & PCIEM_SLOT_CAP_EIP) + printf(" EI(%s)", sta & PCIEM_SLOT_STA_EIS ? "engaged" : + "disengaged"); } static void From owner-svn-src-head@freebsd.org Fri Aug 5 23:42:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 778B5BB0E10; Fri, 5 Aug 2016 23:42:05 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 357001729; Fri, 5 Aug 2016 23:42:05 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22b.google.com with SMTP id f6so37801278ith.0; Fri, 05 Aug 2016 16:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BfSuyefOK6CYMmePLDKn/OuHkYN6AqDsnxa/5d3Q6+U=; b=DVhcIh2COMkSrs4FDQld0XxIa6zCsPR5g+bEEmPDsWZ+nfq/ssdFbpaUq2/ahD9JWS AiDV1KMDQERgp6bYw5yghWV+rBRFYByENedS+Re8UL/6/MJN+YGo1GZ4iKcNXWWfEnxn SlOeEkETIYQpWlw1e2Rto42PC+kezkVeyW5jXXYpR6RH9500+wklE4pzgcEBlV/dRQZY v2WGeOMvPcwQm6T2UIaslKEV1GDAh+Mb/SRG9tLgGLDpHUmvhTxE/dI8Hhx23uVutBBH ek1AvdboBJfZcwAvE9/o7o8RvL3bGDnWiigUObojswg9S99Tg8eEL11UsA46PwL+Bg+x vLvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BfSuyefOK6CYMmePLDKn/OuHkYN6AqDsnxa/5d3Q6+U=; b=kVw8QpsjolFBO7CrIJppGOl31JCeRuIEXwJn8VlNJvqV5h0GN7i77/LdOVyLzcEXiR Q2nQr7u1z3UX/oMVcRxW8CowoFL44Tiy1KUGsVBgByN8WnWiXmyzk+BWzj3nUGZpRh+O GEozF0uW1mKomQ+M8XBD8/CxLigJ+eFtyO08hY3oVx5FdoyCqVLVzilRbHmv/ynJiFPt 2G9X1amHOKIUgUXgkTEnF4Sj1lj+UHYzXDQKbCmJhzQ0/Ey2pnFqSucGK7uF0ZWejrJC ITGZLGOMnBiPbztK53+bAgbk0eJAbfVVL15WYARZmtSO/m1ILMibWOHZImwWNODZYLU0 42sg== X-Gm-Message-State: AEkooust4Ih5X0PsUa3H+Wj83xsM56X4ydcw/rDSVM+IcgE8e2SrMaLhQx+PP1eu17Eiuqh9CKEIJ8ZGPutIoQ== X-Received: by 10.36.101.195 with SMTP id u186mr6884559itb.80.1470440524418; Fri, 05 Aug 2016 16:42:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.141.129 with HTTP; Fri, 5 Aug 2016 16:42:03 -0700 (PDT) In-Reply-To: References: <201605212321.u4LNLgDI029432@repo.freebsd.org> From: Adrian Chadd Date: Fri, 5 Aug 2016 16:42:03 -0700 Message-ID: Subject: Re: svn commit: r300383 - head/sys/net80211 To: Andriy Voskoboinyk Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 23:42:05 -0000 Hi, Just a reminder and notice to others - yeah, I've found that this actually stops scan from working well and reliably. Notably, I've found that we get a scan completion notification and then we can't restart a subsequent scan for some reason. I may have to revert this and put in something slightly more explicit - eg, we put on an explicit full scan timeout and we explicitly complete the scan if we don't finish it in time. -adrian On 21 May 2016 at 16:24, Andriy Voskoboinyk wrote: > Tested with wpi(4) and urtwn(4) in STA mode. > From owner-svn-src-head@freebsd.org Fri Aug 5 23:45:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D1B7BB0F4A; Fri, 5 Aug 2016 23:45:50 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F30F19DF; Fri, 5 Aug 2016 23:45:50 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x234.google.com with SMTP id q83so314071098iod.1; Fri, 05 Aug 2016 16:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gHFkZ3y4ngwpDwiKW5a9GUqUm9Mc04Yd0OCkjjwJnLw=; b=SOy35J6Nd3PiYkPRMBGK+Sk2a6mB0q5VVof64n/A8sW07J+/KreFMKUlfv2K8Pr7T6 VX7EMFafTWlA43tDYLsZqAzt2r3KpgJAL1HrAc9QPgYgqGbxnDbIgDYFMnjb4rs1k4GW rOFhagfU9Cdojona09oFvl5Q9Jg8pCevrA8SThPRQtJevfgq5l6BX6msJ+KS/kzX5Nxz R6vrX+ocjD3AWpCnOx1evDGDyNboHLWzZh1rgKP5j24m18bj4Z06PNMAIzR/7DCptEtM zPI05bHSQjT2+1+J/GTrvKGmpjEpWZRQrbnrqsbqMzfQR6fOfnNOAzJwdntn38/35c67 QTwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gHFkZ3y4ngwpDwiKW5a9GUqUm9Mc04Yd0OCkjjwJnLw=; b=SEzAYkFzCGGjAAFdBF/dMU84EeC0XzZuXv/iuz1E/1gJa39d5pr6UsTtBRk3az3nzo fWA3JWkE7nVehlmvbkDqU4OyX0aTfvsu9O8Yjb6wsn7bX5jgZ2EEr3lVJ+ows4bSnU1f +Il3ZJu4Tx3TZzbCPkIbcaCjulB9qaiCsycZLGLHqFaz0AWUdgkWMlr9+a80vnqSwd+6 y5DrN9ADIHw4WU6pa3k8kkQFkUCWREXIzkjDFM7RfI5CT4KiX3Cdkdm8UkfAxo/SMIlz AODhLA1vG5mwem7y7jptV61kZkO0sXy1o98cZgsHYnoBBNWVc6mp2Y4/QxfwPIxXIpN/ 52/Q== X-Gm-Message-State: AEkoouvIljfHLrNasSymRE0S1WF0D1Z7g9XBpKHDHwTwMdPVm92AUsRJaMW+JiAiO/dnWud9wptxHBt4M/XVAg== X-Received: by 10.107.136.138 with SMTP id s10mr27280829ioi.75.1470440749637; Fri, 05 Aug 2016 16:45:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.141.129 with HTTP; Fri, 5 Aug 2016 16:45:48 -0700 (PDT) In-Reply-To: References: <201605212321.u4LNLgDI029432@repo.freebsd.org> From: Adrian Chadd Date: Fri, 5 Aug 2016 16:45:48 -0700 Message-ID: Subject: Re: svn commit: r300383 - head/sys/net80211 To: Andriy Voskoboinyk , "freebsd-wireless@freebsd.org" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 23:45:50 -0000 Also, the scan code now also seems to alternate between g and n channels on 2ghz; and it never seems to update the chanlist if it's interrupted. So yeah, hm. Avos, any ideas? -adrian On 5 August 2016 at 16:42, Adrian Chadd wrote: > Hi, > > Just a reminder and notice to others - yeah, I've found that this > actually stops scan from working well and reliably. > > Notably, I've found that we get a scan completion notification and > then we can't restart a subsequent scan for some reason. > > I may have to revert this and put in something slightly more explicit > - eg, we put on an explicit full scan timeout and we explicitly > complete the scan if we don't finish it in time. > > > -adrian > > > On 21 May 2016 at 16:24, Andriy Voskoboinyk wrote: >> Tested with wpi(4) and urtwn(4) in STA mode. >> From owner-svn-src-head@freebsd.org Sat Aug 6 11:02:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A6ACBAFC28; Sat, 6 Aug 2016 11:02:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1279C11C3; Sat, 6 Aug 2016 11:02:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76B28U4059082; Sat, 6 Aug 2016 11:02:08 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76B28tO059080; Sat, 6 Aug 2016 11:02:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608061102.u76B28tO059080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 6 Aug 2016 11:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303791 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 11:02:09 -0000 Author: avg Date: Sat Aug 6 11:02:07 2016 New Revision: 303791 URL: https://svnweb.freebsd.org/changeset/base/303791 Log: fix .zfs-related cases in zfs_lookup that were broken by r303763 The problem is that the special .zfs nodes are not represented by znodes but by special gfs-based nodes. r303763 changed interface of zfs_dirlook such that started operating on znodes rather than on vnodes and, thus, the function became unsuitable for handling .zfs entities. The solution is to move the handling of the special cases to zfs_lookup, the only consumer of zfs_dirlook. I already had this solution applied in D7421, but for different reasons. Reported by: asomers MFC after: 3 days X-MFC with: r303763 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Sat Aug 6 08:23:36 2016 (r303790) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Sat Aug 6 11:02:07 2016 (r303791) @@ -173,7 +173,6 @@ zfs_dd_lookup(znode_t *dzp, znode_t **zp { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; znode_t *zp; - vnode_t *vp; uint64_t parent; int error; @@ -187,19 +186,7 @@ zfs_dd_lookup(znode_t *dzp, znode_t **zp SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0) return (error); - /* - * If we are a snapshot mounted under .zfs, return - * the snapshot directory. - */ - if (parent == dzp->z_id && zfsvfs->z_parent != zfsvfs) { - error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, - "snapshot", &vp, NULL, 0, NULL, kcred, - NULL, NULL, NULL); - if (error == 0) - zp = VTOZ(vp); - } else { - error = zfs_zget(zfsvfs, parent, &zp); - } + error = zfs_zget(zfsvfs, parent, &zp); if (error == 0) *zpp = zp; return (error); @@ -222,8 +209,6 @@ zfs_dirlook(znode_t *dzp, const char *na *zpp = dzp; } else if (name[0] == '.' && name[1] == '.' && name[2] == 0) { error = zfs_dd_lookup(dzp, zpp); - } else if (zfs_has_ctldir(dzp) && strcmp(name, ZFS_CTLDIR_NAME) == 0) { - *zpp = VTOZ(zfsctl_root(dzp)); } else { error = zfs_dirent_lookup(dzp, name, &zp, ZEXISTS); if (error == 0) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Aug 6 08:23:36 2016 (r303790) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Aug 6 11:02:07 2016 (r303791) @@ -1605,6 +1605,39 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode return (SET_ERROR(EILSEQ)); } + + /* + * First handle the special cases. + */ + if ((cnp->cn_flags & ISDOTDOT) != 0) { + /* + * If we are a snapshot mounted under .zfs, return + * the vp for the snapshot directory. + */ + if (zdp->z_id == zfsvfs->z_root && zfsvfs->z_parent != zfsvfs) { + error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, + "snapshot", vpp, NULL, 0, NULL, kcred, + NULL, NULL, NULL); + ZFS_EXIT(zfsvfs); + if (error == 0) { + error = zfs_lookup_lock(dvp, *vpp, nm, + cnp->cn_lkflags); + } + goto out; + } + } + if (zfs_has_ctldir(zdp) && strcmp(nm, ZFS_CTLDIR_NAME) == 0) { + error = 0; + if ((cnp->cn_flags & ISLASTCN) != 0 && nameiop != LOOKUP) + error = SET_ERROR(ENOTSUP); + else + *vpp = zfsctl_root(zdp); + ZFS_EXIT(zfsvfs); + if (error == 0) + error = zfs_lookup_lock(dvp, *vpp, nm, cnp->cn_lkflags); + goto out; + } + /* * The loop is retry the lookup if the parent-child relationship * changes during the dot-dot locking complexities. @@ -1653,6 +1686,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode vput(ZTOV(zp)); } +out: if (error != 0) *vpp = NULL; From owner-svn-src-head@freebsd.org Sat Aug 6 12:33:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7402FBAF10F; Sat, 6 Aug 2016 12:33:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CE671510; Sat, 6 Aug 2016 12:33:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76CXGPt092480; Sat, 6 Aug 2016 12:33:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76CXGUp092475; Sat, 6 Aug 2016 12:33:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201608061233.u76CXGUp092475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 6 Aug 2016 12:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303792 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 12:33:17 -0000 Author: tuexen Date: Sat Aug 6 12:33:15 2016 New Revision: 303792 URL: https://svnweb.freebsd.org/changeset/base/303792 Log: Fix various bugs in relation to the I-DATA chunk support This is joint work with rrs. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_ss_functions.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Aug 6 11:02:07 2016 (r303791) +++ head/sys/netinet/sctp_indata.c Sat Aug 6 12:33:15 2016 (r303792) @@ -64,7 +64,7 @@ sctp_add_chk_to_control(struct sctp_queu struct sctp_stream_in *strm, struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_tmit_chunk *chk); + struct sctp_tmit_chunk *chk, int lock_held); void @@ -448,7 +448,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stc } static void -clean_up_control(struct sctp_tcb *stcb, struct sctp_queued_to_read *control) +sctp_clean_up_control(struct sctp_tcb *stcb, struct sctp_queued_to_read *control) { /* * The control could not be placed and must be cleaned. @@ -612,7 +612,7 @@ protocol_error: snprintf(msg, sizeof(msg), "Queue to str msg_id: %u duplicate", control->msg_id); - clean_up_control(stcb, control); + sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -739,9 +739,28 @@ sctp_build_readq_entry_from_ctl(struct s nc->port_from = control->port_from; } +static void +sctp_reset_a_control(struct sctp_queued_to_read *control, + struct sctp_inpcb *inp, uint32_t tsn) +{ + control->fsn_included = tsn; + if (control->on_read_q) { + /* + * We have to purge it from there, hopefully this will work + * :-) + */ + TAILQ_REMOVE(&inp->read_queue, control, next); + control->on_read_q = 0; + } +} + static int -sctp_handle_old_data(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_in *strm, - struct sctp_queued_to_read *control, uint32_t pd_point) +sctp_handle_old_unordered_data(struct sctp_tcb *stcb, + struct sctp_association *asoc, + struct sctp_stream_in *strm, + struct sctp_queued_to_read *control, + uint32_t pd_point, + int inp_read_lock_held) { /* * Special handling for the old un-ordered data chunk. All the @@ -774,7 +793,7 @@ restart: } memset(nc, 0, sizeof(struct sctp_queued_to_read)); TAILQ_REMOVE(&control->reasm, chk, sctp_next); - sctp_add_chk_to_control(control, strm, stcb, asoc, chk); + sctp_add_chk_to_control(control, strm, stcb, asoc, chk, SCTP_READ_LOCK_NOT_HELD); fsn++; cnt_added++; chk = NULL; @@ -793,6 +812,8 @@ restart: nc->first_frag_seen = 1; nc->fsn_included = tchk->rec.data.fsn_num; nc->data = tchk->data; + nc->sinfo_ppid = tchk->rec.data.payloadtype; + nc->sinfo_tsn = tchk->rec.data.TSN_seq; sctp_mark_non_revokable(asoc, tchk->rec.data.TSN_seq); tchk->data = NULL; sctp_free_a_chunk(stcb, tchk, SCTP_SO_NOT_LOCKED); @@ -828,7 +849,7 @@ restart: if (control->on_read_q == 0) { sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + inp_read_lock_held, SCTP_SO_NOT_LOCKED); } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); if ((nc->first_frag_seen) && !TAILQ_EMPTY(&nc->reasm)) { @@ -839,7 +860,9 @@ restart: control = nc; goto restart; } else { - sctp_free_a_readq(stcb, nc); + if (nc->on_strm_q == 0) { + sctp_free_a_readq(stcb, nc); + } } return (1); } else { @@ -855,7 +878,7 @@ restart: control->pdapi_started = 1; sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + inp_read_lock_held, SCTP_SO_NOT_LOCKED); sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (0); } else { @@ -864,13 +887,14 @@ restart: } static void -sctp_inject_old_data_unordered(struct sctp_tcb *stcb, struct sctp_association *asoc, +sctp_inject_old_unordered_data(struct sctp_tcb *stcb, + struct sctp_association *asoc, struct sctp_queued_to_read *control, struct sctp_tmit_chunk *chk, int *abort_flag) { struct sctp_tmit_chunk *at; - int inserted = 0; + int inserted; /* * Here we need to place the chunk into the control structure sorted @@ -926,18 +950,29 @@ sctp_inject_old_data_unordered(struct sc tdata = control->data; control->data = chk->data; chk->data = tdata; - /* Swap the lengths */ - tmp = control->length; - control->length = chk->send_size; - chk->send_size = tmp; + /* Save the lengths */ + chk->send_size = control->length; + /* Recompute length of control and tail pointer */ + sctp_setup_tail_pointer(control); /* Fix the FSN included */ tmp = control->fsn_included; control->fsn_included = chk->rec.data.fsn_num; chk->rec.data.fsn_num = tmp; + /* Fix the TSN included */ + tmp = control->sinfo_tsn; + control->sinfo_tsn = chk->rec.data.TSN_seq; + chk->rec.data.TSN_seq = tmp; + /* Fix the PPID included */ + tmp = control->sinfo_ppid; + control->sinfo_ppid = chk->rec.data.payloadtype; + chk->rec.data.payloadtype = tmp; + /* Fix tail pointer */ goto place_chunk; } control->first_frag_seen = 1; control->top_fsn = control->fsn_included = chk->rec.data.fsn_num; + control->sinfo_tsn = chk->rec.data.TSN_seq; + control->sinfo_ppid = chk->rec.data.payloadtype; control->data = chk->data; sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); chk->data = NULL; @@ -946,12 +981,7 @@ sctp_inject_old_data_unordered(struct sc return; } place_chunk: - if (TAILQ_EMPTY(&control->reasm)) { - TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next); - asoc->size_on_reasm_queue += chk->send_size; - sctp_ucount_incr(asoc->cnt_on_reasm_queue); - return; - } + inserted = 0; TAILQ_FOREACH(at, &control->reasm, sctp_next) { if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) { /* @@ -985,7 +1015,8 @@ place_chunk: } static int -sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_in *strm) +sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, + struct sctp_stream_in *strm, int inp_read_lock_held) { /* * Given a stream, strm, see if any of the SSN's on it that are @@ -1005,10 +1036,11 @@ sctp_deliver_reasm_check(struct sctp_tcb pd_point = stcb->sctp_ep->partial_delivery_point; } control = TAILQ_FIRST(&strm->uno_inqueue); + if ((control) && (asoc->idata_supported == 0)) { /* Special handling needed for "old" data format */ - if (sctp_handle_old_data(stcb, asoc, strm, control, pd_point)) { + if (sctp_handle_old_unordered_data(stcb, asoc, strm, control, pd_point, inp_read_lock_held)) { goto done_un; } } @@ -1037,7 +1069,7 @@ sctp_deliver_reasm_check(struct sctp_tcb sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + inp_read_lock_held, SCTP_SO_NOT_LOCKED); } } else { /* Can we do a PD-API for this un-ordered guy? */ @@ -1047,7 +1079,7 @@ sctp_deliver_reasm_check(struct sctp_tcb sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + inp_read_lock_held, SCTP_SO_NOT_LOCKED); break; } @@ -1096,7 +1128,7 @@ done_un: sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + inp_read_lock_held, SCTP_SO_NOT_LOCKED); } control = nctl; } @@ -1160,7 +1192,7 @@ deliver_more: sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + inp_read_lock_held, SCTP_SO_NOT_LOCKED); } strm->last_sequence_delivered = next_to_del; if (done) { @@ -1177,11 +1209,12 @@ out: return (ret); } + void sctp_add_chk_to_control(struct sctp_queued_to_read *control, struct sctp_stream_in *strm, struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_tmit_chunk *chk) + struct sctp_tmit_chunk *chk, int hold_rlock) { /* * Given a control and a chunk, merge the data from the chk onto the @@ -1189,7 +1222,7 @@ sctp_add_chk_to_control(struct sctp_queu */ int i_locked = 0; - if (control->on_read_q) { + if (control->on_read_q && (hold_rlock == 0)) { /* * Its being pd-api'd so we must do some locks. */ @@ -1271,7 +1304,7 @@ sctp_queue_data_for_reasm(struct sctp_tc if (created_control) { if (sctp_place_control_in_stream(strm, asoc, control)) { /* Duplicate SSN? */ - clean_up_control(stcb, control); + sctp_clean_up_control(stcb, control); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_6); @@ -1292,7 +1325,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } } if ((asoc->idata_supported == 0) && (unordered == 1)) { - sctp_inject_old_data_unordered(stcb, asoc, control, chk, abort_flag); + sctp_inject_old_unordered_data(stcb, asoc, control, chk, abort_flag); return; } /* @@ -1482,7 +1515,7 @@ sctp_queue_data_for_reasm(struct sctp_tc at->rec.data.fsn_num, next_fsn, control->fsn_included); TAILQ_REMOVE(&control->reasm, at, sctp_next); - sctp_add_chk_to_control(control, strm, stcb, asoc, at); + sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD); if (control->on_read_q) { do_wakeup = 1; } @@ -1513,7 +1546,7 @@ sctp_queue_data_for_reasm(struct sctp_tc } static struct sctp_queued_to_read * -find_reasm_entry(struct sctp_stream_in *strm, uint32_t msg_id, int ordered, int old) +sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t msg_id, int ordered, int old) { struct sctp_queued_to_read *control; @@ -1573,6 +1606,7 @@ sctp_process_a_data_chunk(struct sctp_tc clen = sizeof(struct sctp_idata_chunk); tsn = ntohl(ch->dp.tsn); msg_id = ntohl(nch->dp.msg_id); + protocol_id = nch->dp.ppid_fsn.protocol_id; if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG) fsn = 0; else @@ -1582,6 +1616,7 @@ sctp_process_a_data_chunk(struct sctp_tc ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf); tsn = ntohl(ch->dp.tsn); + protocol_id = ch->dp.protocol_id; clen = sizeof(struct sctp_data_chunk); fsn = tsn; msg_id = (uint32_t) (ntohs(ch->dp.stream_sequence)); @@ -1602,7 +1637,6 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chunk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { asoc->send_sack = 1; } - protocol_id = ch->dp.protocol_id; ordered = ((chunk_flags & SCTP_DATA_UNORDERED) == 0); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS); @@ -1722,7 +1756,7 @@ sctp_process_a_data_chunk(struct sctp_tc } if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { /* See if we can find the re-assembly entity */ - control = find_reasm_entry(strm, msg_id, ordered, old_data); + control = sctp_find_reasm_entry(strm, msg_id, ordered, old_data); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", chunk_flags, control); if (control) { @@ -1758,7 +1792,7 @@ sctp_process_a_data_chunk(struct sctp_tc */ SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for msg in case we have dup\n", chunk_flags); - if (find_reasm_entry(strm, msg_id, ordered, old_data)) { + if (sctp_find_reasm_entry(strm, msg_id, ordered, old_data)) { SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on msg_id: %u\n", chunk_flags, msg_id); @@ -2179,12 +2213,12 @@ finish_express_del: * Now service re-assembly to pick up anything that has been * held on reassembly queue? */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm); + (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); need_reasm_check = 0; } if (need_reasm_check) { /* Another one waits ? */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm); + (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); } return (1); } @@ -4152,28 +4186,8 @@ again: if ((asoc->stream_queue_cnt == 1) && ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED)) && - (asoc->locked_on_sending) - ) { - struct sctp_stream_queue_pending *sp; - - /* - * I may be in a state where we got all across.. but - * cannot write more due to a shutdown... we abort - * since the user did not indicate EOR in this case. - * The sp will be cleaned during free of the asoc. - */ - sp = TAILQ_LAST(&((asoc->locked_on_sending)->outqueue), - sctp_streamhead); - if ((sp) && (sp->length == 0)) { - /* Let cleanup code purge it */ - if (sp->msg_is_complete) { - asoc->stream_queue_cnt--; - } else { - asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; - asoc->locked_on_sending = NULL; - asoc->stream_queue_cnt--; - } - } + ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) { + asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && (asoc->stream_queue_cnt == 0)) { @@ -4868,26 +4882,8 @@ hopeless_peer: if ((asoc->stream_queue_cnt == 1) && ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED)) && - (asoc->locked_on_sending) - ) { - struct sctp_stream_queue_pending *sp; - - /* - * I may be in a state where we got all across.. but - * cannot write more due to a shutdown... we abort - * since the user did not indicate EOR in this case. - */ - sp = TAILQ_LAST(&((asoc->locked_on_sending)->outqueue), - sctp_streamhead); - if ((sp) && (sp->length == 0)) { - asoc->locked_on_sending = NULL; - if (sp->msg_is_complete) { - asoc->stream_queue_cnt--; - } else { - asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; - asoc->stream_queue_cnt--; - } - } + ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) { + asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && (asoc->stream_queue_cnt == 0)) { @@ -5215,7 +5211,7 @@ sctp_kick_prsctp_reorder_queue(struct sc if (need_reasm_check) { int ret; - ret = sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin); + ret = sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin, SCTP_READ_LOCK_HELD); if (SCTP_MSGID_GT(old, tt, strmin->last_sequence_delivered)) { /* Restore the next to deliver unless we are ahead */ strmin->last_sequence_delivered = tt; @@ -5279,19 +5275,21 @@ sctp_kick_prsctp_reorder_queue(struct sc } } if (need_reasm_check) { - (void)sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin); + (void)sctp_deliver_reasm_check(stcb, &stcb->asoc, strmin, SCTP_READ_LOCK_HELD); } } + static void sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, struct sctp_association *asoc, - uint16_t stream, uint32_t seq, int ordered, int old) + uint16_t stream, uint32_t seq, int ordered, int old, uint32_t cumtsn) { struct sctp_queued_to_read *control; struct sctp_stream_in *strm; struct sctp_tmit_chunk *chk, *nchk; + int cnt_removed = 0; /* * For now large messages held on the stream reasm that are complete @@ -5302,13 +5300,19 @@ sctp_flush_reassm_for_str_seq(struct sct * queue. */ strm = &asoc->strmin[stream]; - control = find_reasm_entry(strm, (uint32_t) seq, ordered, old); + control = sctp_find_reasm_entry(strm, (uint32_t) seq, ordered, old); if (control == NULL) { /* Not found */ return; } TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { /* Purge hanging chunks */ + if (old && (ordered == 0)) { + if (SCTP_TSN_GT(chk->rec.data.TSN_seq, cumtsn)) { + break; + } + } + cnt_removed++; TAILQ_REMOVE(&control->reasm, chk, sctp_next); asoc->size_on_reasm_queue -= chk->send_size; sctp_ucount_decr(asoc->cnt_on_reasm_queue); @@ -5318,7 +5322,35 @@ sctp_flush_reassm_for_str_seq(struct sct } sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } - TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (!TAILQ_EMPTY(&control->reasm)) { + /* This has to be old data, unordered */ + if (control->data) { + sctp_m_freem(control->data); + control->data = NULL; + } + sctp_reset_a_control(control, stcb->sctp_ep, cumtsn); + chk = TAILQ_FIRST(&control->reasm); + if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { + TAILQ_REMOVE(&control->reasm, chk, sctp_next); + sctp_add_chk_to_control(control, strm, stcb, asoc, + chk, SCTP_READ_LOCK_HELD); + } + sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_HELD); + return; + } + if (control->on_strm_q == SCTP_ON_ORDERED) { + TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + control->on_strm_q = 0; + } else if (control->on_strm_q == SCTP_ON_UNORDERED) { + TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); + control->on_strm_q = 0; +#ifdef INVARIANTS + } else if (control->on_strm_q) { + panic("strm: %p ctl: %p unknown %d", + strm, control, control->on_strm_q); +#endif + } + control->on_strm_q = 0; if (control->on_read_q == 0) { sctp_free_remote_addr(control->whoFrom); if (control->data) { @@ -5329,7 +5361,6 @@ sctp_flush_reassm_for_str_seq(struct sct } } - void sctp_handle_forward_tsn(struct sctp_tcb *stcb, struct sctp_forward_tsn_chunk *fwd, @@ -5423,7 +5454,16 @@ sctp_handle_forward_tsn(struct sctp_tcb /*************************************************************/ /* This is now done as part of clearing up the stream/seq */ + if (asoc->idata_supported == 0) { + uint16_t sid; + /* Flush all the un-ordered data based on cum-tsn */ + SCTP_INP_READ_LOCK(stcb->sctp_ep); + for (sid = 0; sid < asoc->streamincnt; sid++) { + sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, 1, new_cum_tsn); + } + SCTP_INP_READ_UNLOCK(stcb->sctp_ep); + } /*******************************************************/ /* 3. Update the PR-stream re-ordering queues and fix */ /* delivery issues as needed. */ @@ -5502,7 +5542,19 @@ sctp_handle_forward_tsn(struct sctp_tcb asoc->fragmented_delivery_inprogress = 0; } strm = &asoc->strmin[stream]; - sctp_flush_reassm_for_str_seq(stcb, asoc, stream, sequence, ordered, old); + if (asoc->idata_supported == 0) { + uint16_t strm_at; + + for (strm_at = strm->last_sequence_delivered; SCTP_MSGID_GE(1, sequence, strm_at); strm_at++) { + sctp_flush_reassm_for_str_seq(stcb, asoc, stream, strm_at, ordered, old, new_cum_tsn); + } + } else { + uint32_t strm_at; + + for (strm_at = strm->last_sequence_delivered; SCTP_MSGID_GE(0, sequence, strm_at); strm_at++) { + sctp_flush_reassm_for_str_seq(stcb, asoc, stream, strm_at, ordered, old, new_cum_tsn); + } + } TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) { if ((ctl->sinfo_stream == stream) && (ctl->sinfo_ssn == sequence)) { Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Aug 6 11:02:07 2016 (r303791) +++ head/sys/netinet/sctp_output.c Sat Aug 6 12:33:15 2016 (r303792) @@ -3657,7 +3657,7 @@ sctp_process_cmsgs_for_init(struct sctp_ stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; - stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL); + stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); } } break; @@ -6694,7 +6694,7 @@ sctp_sendall_iterator(struct sctp_inpcb if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && (cnt == 0)) { - if (asoc->locked_on_sending) { + if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } /* @@ -6736,18 +6736,8 @@ sctp_sendall_iterator(struct sctp_inpcb if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { - if (asoc->locked_on_sending) { - /* - * Locked to send out the - * data - */ - struct sctp_stream_queue_pending *sp; - - sp = TAILQ_LAST(&asoc->locked_on_sending->outqueue, sctp_streamhead); - if (sp) { - if ((sp->length == 0) && (sp->msg_is_complete == 0)) - asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; - } + if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { + asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; } asoc->state |= SCTP_STATE_SHUTDOWN_PENDING; if (TAILQ_EMPTY(&asoc->send_queue) && @@ -7170,7 +7160,6 @@ sctp_move_to_outqueue(struct sctp_tcb *s struct sctp_stream_out *strq, uint32_t goal_mtu, uint32_t frag_point, - int *locked, int *giveup, int eeor_mode, int *bail, @@ -7196,10 +7185,8 @@ sctp_move_to_outqueue(struct sctp_tcb *s asoc = &stcb->asoc; one_more_time: /* sa_ignore FREED_MEMORY */ - *locked = 0; sp = TAILQ_FIRST(&strq->outqueue); if (sp == NULL) { - *locked = 0; if (send_lock_up == 0) { SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; @@ -7261,8 +7248,6 @@ one_more_time: } sctp_free_a_strmoq(stcb, sp, so_locked); /* we can't be locked to it */ - *locked = 0; - stcb->asoc.locked_on_sending = NULL; if (send_lock_up) { SCTP_TCB_SEND_UNLOCK(stcb); send_lock_up = 0; @@ -7274,8 +7259,6 @@ one_more_time: * sender just finished this but still holds a * reference */ - if (stcb->asoc.idata_supported == 0) - *locked = 1; *giveup = 1; to_move = 0; goto out_of; @@ -7284,8 +7267,6 @@ one_more_time: /* is there some to get */ if (sp->length == 0) { /* no */ - if (stcb->asoc.idata_supported == 0) - *locked = 1; *giveup = 1; to_move = 0; goto out_of; @@ -7308,8 +7289,6 @@ one_more_time: } sp->length = 0; sp->some_taken = 1; - if (stcb->asoc.idata_supported == 0) - *locked = 1; *giveup = 1; to_move = 0; goto out_of; @@ -7373,10 +7352,6 @@ re_look: } } else { /* Nothing to take. */ - if ((sp->some_taken) && - (stcb->asoc.idata_supported == 0)) { - *locked = 1; - } *giveup = 1; to_move = 0; goto out_of; @@ -7716,14 +7691,6 @@ dont_do_it: sp->data = NULL; } sctp_free_a_strmoq(stcb, sp, so_locked); - - /* we can't be locked to it */ - *locked = 0; - stcb->asoc.locked_on_sending = NULL; - } else { - /* more to go, we are locked */ - if (stcb->asoc.idata_supported == 0) - *locked = 1; } asoc->chunks_on_out_queue++; strq->chunks_on_queues++; @@ -7748,7 +7715,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb struct sctp_association *asoc; struct sctp_stream_out *strq; int goal_mtu, moved_how_much, total_moved = 0, bail = 0; - int locked, giveup; + int giveup; SCTP_TCB_LOCK_ASSERT(stcb); asoc = &stcb->asoc; @@ -7777,36 +7744,20 @@ sctp_fill_outqueue(struct sctp_tcb *stcb /* must make even word boundary */ goal_mtu &= 0xfffffffc; - if (asoc->locked_on_sending) { - /* We are stuck on one stream until the message completes. */ - strq = asoc->locked_on_sending; - locked = 1; - } else { - strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); - locked = 0; - } + strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); while ((goal_mtu > 0) && strq) { giveup = 0; bail = 0; - moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, &locked, + moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, &giveup, eeor_mode, &bail, so_locked); - if (moved_how_much) - stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much); + stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much); - if (locked) { - asoc->locked_on_sending = strq; - if ((moved_how_much == 0) || (giveup) || bail) - /* no more to move for now */ - break; - } else { - asoc->locked_on_sending = NULL; - if ((giveup) || bail) { - break; - } - strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); - if (strq == NULL) { - break; - } + if ((giveup) || bail) { + break; + } + strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); + if (strq == NULL) { + break; } total_moved += moved_how_much; goal_mtu -= (moved_how_much + sizeof(struct sctp_data_chunk)); @@ -10227,9 +10178,8 @@ do_it_again: un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) && - (stcb->asoc.total_flight > 0) && - ((stcb->asoc.locked_on_sending == NULL) || - sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) { + (stcb->asoc.total_flight > 0)) { +/* && sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) {*/ break; } } @@ -12262,19 +12212,18 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].state = oldstream[i].state; - stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], &oldstream[i]); + /* FIX ME FIX ME */ + /* + * This should be a SS_COPY operation FIX ME STREAM + * SCHEDULER EXPERT + */ + stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { TAILQ_REMOVE(&oldstream[i].outqueue, sp, next); TAILQ_INSERT_TAIL(&stcb->asoc.strmout[i].outqueue, sp, next); } - /* Now move assoc pointers too */ - if (stcb->asoc.last_out_stream == &oldstream[i]) { - stcb->asoc.last_out_stream = &stcb->asoc.strmout[i]; - } - if (stcb->asoc.locked_on_sending == &oldstream[i]) { - stcb->asoc.locked_on_sending = &stcb->asoc.strmout[i]; - } + } /* now the new streams */ stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); @@ -12294,7 +12243,7 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.strmout[i].next_mid_unordered = 0; stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; - stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL); + stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); stcb->asoc.strmout[i].state = SCTP_STREAM_CLOSED; } stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt + adding_o; @@ -13518,7 +13467,7 @@ dataless_eof: if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && (cnt == 0)) { - if (asoc->locked_on_sending) { + if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } /* there is nothing queued to send, so I'm done... */ @@ -13563,15 +13512,8 @@ dataless_eof: SCTP_TCB_LOCK(stcb); hold_tcblock = 1; } - if (asoc->locked_on_sending) { - /* Locked to send out the data */ - struct sctp_stream_queue_pending *sp; - - sp = TAILQ_LAST(&asoc->locked_on_sending->outqueue, sctp_streamhead); - if (sp) { - if ((sp->length == 0) && (sp->msg_is_complete == 0)) - asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; - } + if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { + asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; } asoc->state |= SCTP_STATE_SHUTDOWN_PENDING; if (TAILQ_EMPTY(&asoc->send_queue) && Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Aug 6 11:02:07 2016 (r303791) +++ head/sys/netinet/sctp_pcb.c Sat Aug 6 12:33:15 2016 (r303792) @@ -3444,7 +3444,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, } else if (TAILQ_EMPTY(&asoc->asoc.send_queue) && TAILQ_EMPTY(&asoc->asoc.sent_queue) && (asoc->asoc.stream_queue_cnt == 0)) { - if (asoc->asoc.locked_on_sending) { + if ((*asoc->asoc.ss_functions.sctp_ss_is_user_msgs_incomplete) (asoc, &asoc->asoc)) { goto abort_anyway; } if ((SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_SHUTDOWN_SENT) && @@ -3476,22 +3476,11 @@ sctp_inpcb_free(struct sctp_inpcb *inp, } } else { /* mark into shutdown pending */ - struct sctp_stream_queue_pending *sp; - asoc->asoc.state |= SCTP_STATE_SHUTDOWN_PENDING; sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, asoc->asoc.primary_destination); - if (asoc->asoc.locked_on_sending) { - sp = TAILQ_LAST(&((asoc->asoc.locked_on_sending)->outqueue), - sctp_streamhead); - if (sp == NULL) { - SCTP_PRINTF("Error, sp is NULL, locked on sending is %p strm:%d\n", - (void *)asoc->asoc.locked_on_sending, - asoc->asoc.locked_on_sending->stream_no); - } else { - if ((sp->length == 0) && (sp->msg_is_complete == 0)) - asoc->asoc.state |= SCTP_STATE_PARTIAL_MSG_LEFT; - } + if ((*asoc->asoc.ss_functions.sctp_ss_is_user_msgs_incomplete) (asoc, &asoc->asoc)) { + asoc->asoc.state |= SCTP_STATE_PARTIAL_MSG_LEFT; } if (TAILQ_EMPTY(&asoc->asoc.send_queue) && TAILQ_EMPTY(&asoc->asoc.sent_queue) && @@ -6874,6 +6863,15 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) /* Ok that was fun, now we will drain all the inbound streams? */ for (strmat = 0; strmat < asoc->streamincnt; strmat++) { TAILQ_FOREACH_SAFE(ctl, &asoc->strmin[strmat].inqueue, next_instrm, nctl) { +#ifdef INVARIANTS + if (ctl->on_strm_q != SCTP_ON_ORDERED) { + panic("Huh control: %p on_q: %d -- not ordered?", + ctl, ctl->on_strm_q); + } +#endif + if (ctl->on_read_q) { + continue; + } if (SCTP_TSN_GT(ctl->sinfo_tsn, cumulative_tsn_p1)) { /* Yep it is above cum-ack */ cnt++; @@ -6881,7 +6879,12 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) asoc->size_on_all_streams = sctp_sbspace_sub(asoc->size_on_all_streams, ctl->length); sctp_ucount_decr(asoc->cnt_on_all_streams); SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); + if (ctl->on_read_q) { + TAILQ_REMOVE(&stcb->sctp_ep->read_queue, ctl, next); + ctl->on_read_q = 0; + } TAILQ_REMOVE(&asoc->strmin[strmat].inqueue, ctl, next_instrm); + ctl->on_strm_q = 0; if (ctl->data) { sctp_m_freem(ctl->data); ctl->data = NULL; @@ -6905,6 +6908,12 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) } } TAILQ_FOREACH_SAFE(ctl, &asoc->strmin[strmat].uno_inqueue, next_instrm, nctl) { +#ifdef INVARIANTS + if (ctl->on_strm_q != SCTP_ON_UNORDERED) { + panic("Huh control: %p on_q: %d -- not unordered?", + ctl, ctl->on_strm_q); + } +#endif if (SCTP_TSN_GT(ctl->sinfo_tsn, cumulative_tsn_p1)) { /* Yep it is above cum-ack */ cnt++; @@ -6912,7 +6921,12 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) asoc->size_on_all_streams = sctp_sbspace_sub(asoc->size_on_all_streams, ctl->length); sctp_ucount_decr(asoc->cnt_on_all_streams); SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); + if (ctl->on_read_q) { + TAILQ_REMOVE(&stcb->sctp_ep->read_queue, ctl, next); + ctl->on_read_q = 0; + } TAILQ_REMOVE(&asoc->strmin[strmat].uno_inqueue, ctl, next_instrm); + ctl->on_strm_q = 0; if (ctl->data) { sctp_m_freem(ctl->data); ctl->data = NULL; Modified: head/sys/netinet/sctp_ss_functions.c ============================================================================== --- head/sys/netinet/sctp_ss_functions.c Sat Aug 6 11:02:07 2016 (r303791) +++ head/sys/netinet/sctp_ss_functions.c Sat Aug 6 12:33:15 2016 (r303792) @@ -52,7 +52,9 @@ sctp_ss_default_init(struct sctp_tcb *st { uint16_t i; - TAILQ_INIT(&asoc->ss_data.out_wheel); + asoc->ss_data.locked_on_sending = NULL; + asoc->ss_data.last_out_stream = NULL; + TAILQ_INIT(&asoc->ss_data.out.wheel); /* * If there is data in the stream queues already, the scheduler of * an existing association has been changed. We need to add all @@ -73,14 +75,14 @@ sctp_ss_default_clear(struct sctp_tcb *s if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } - while (!TAILQ_EMPTY(&asoc->ss_data.out_wheel)) { - struct sctp_stream_out *strq = TAILQ_FIRST(&asoc->ss_data.out_wheel); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { + struct sctp_stream_out *strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); - TAILQ_REMOVE(&asoc->ss_data.out_wheel, TAILQ_FIRST(&asoc->ss_data.out_wheel), ss_params.rr.next_spoke); + TAILQ_REMOVE(&asoc->ss_data.out.wheel, TAILQ_FIRST(&asoc->ss_data.out.wheel), ss_params.rr.next_spoke); strq->ss_params.rr.next_spoke.tqe_next = NULL; strq->ss_params.rr.next_spoke.tqe_prev = NULL; } - asoc->last_out_stream = NULL; + asoc->ss_data.last_out_stream = NULL; if (holds_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); } @@ -88,8 +90,16 @@ sctp_ss_default_clear(struct sctp_tcb *s } static void -sctp_ss_default_init_stream(struct sctp_stream_out *strq, struct sctp_stream_out *with_strq SCTP_UNUSED) +sctp_ss_default_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq) { + if (with_strq != NULL) { + if (stcb->asoc.ss_data.locked_on_sending == with_strq) { + stcb->asoc.ss_data.locked_on_sending = strq; + } + if (stcb->asoc.ss_data.last_out_stream == with_strq) { + stcb->asoc.ss_data.last_out_stream = strq; + } + } strq->ss_params.rr.next_spoke.tqe_next = NULL; strq->ss_params.rr.next_spoke.tqe_prev = NULL; return; @@ -107,7 +117,7 @@ sctp_ss_default_add(struct sctp_tcb *stc if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next == NULL) && (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { - TAILQ_INSERT_TAIL(&asoc->ss_data.out_wheel, + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); } if (holds_lock == 0) { @@ -119,7 +129,7 @@ sctp_ss_default_add(struct sctp_tcb *stc static int sctp_ss_default_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { - if (TAILQ_EMPTY(&asoc->ss_data.out_wheel)) { + if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { return (1); } else { return (0); @@ -141,19 +151,19 @@ sctp_ss_default_remove(struct sctp_tcb * if (TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next != NULL || strq->ss_params.rr.next_spoke.tqe_prev != NULL)) { - if (asoc->last_out_stream == strq) { - asoc->last_out_stream = TAILQ_PREV(asoc->last_out_stream, + if (asoc->ss_data.last_out_stream == strq) { + asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, ss_params.rr.next_spoke); - if (asoc->last_out_stream == NULL) { - asoc->last_out_stream = TAILQ_LAST(&asoc->ss_data.out_wheel, + if (asoc->ss_data.last_out_stream == NULL) { + asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); } - if (asoc->last_out_stream == strq) { - asoc->last_out_stream = NULL; + if (asoc->ss_data.last_out_stream == strq) { + asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out_wheel, strq, ss_params.rr.next_spoke); + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); strq->ss_params.rr.next_spoke.tqe_next = NULL; strq->ss_params.rr.next_spoke.tqe_prev = NULL; } @@ -170,15 +180,18 @@ sctp_ss_default_select(struct sctp_tcb * { struct sctp_stream_out *strq, *strqt; - strqt = asoc->last_out_stream; + if (asoc->ss_data.locked_on_sending) { + return (asoc->ss_data.locked_on_sending); + } + strqt = asoc->ss_data.last_out_stream; default_again: /* Find the next stream to use */ if (strqt == NULL) { - strq = TAILQ_FIRST(&asoc->ss_data.out_wheel); + strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { strq = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); if (strq == NULL) { - strq = TAILQ_FIRST(&asoc->ss_data.out_wheel); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Aug 6 12:51:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C68E1BAF5DB; Sat, 6 Aug 2016 12:51:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F2301CC1; Sat, 6 Aug 2016 12:51:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76Cp7Jp097103; Sat, 6 Aug 2016 12:51:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76Cp7bk097102; Sat, 6 Aug 2016 12:51:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201608061251.u76Cp7bk097102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 6 Aug 2016 12:51:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303793 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 12:51:08 -0000 Author: tuexen Date: Sat Aug 6 12:51:07 2016 New Revision: 303793 URL: https://svnweb.freebsd.org/changeset/base/303793 Log: Mark an unused parameter as such. MFC after: 3 days Modified: head/sys/netinet/sctp_ss_functions.c Modified: head/sys/netinet/sctp_ss_functions.c ============================================================================== --- head/sys/netinet/sctp_ss_functions.c Sat Aug 6 12:33:15 2016 (r303792) +++ head/sys/netinet/sctp_ss_functions.c Sat Aug 6 12:51:07 2016 (r303793) @@ -221,9 +221,11 @@ default_again: } static void -sctp_ss_default_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, +sctp_ss_default_scheduled(struct sctp_tcb *stcb, + struct sctp_nets *net SCTP_UNUSED, struct sctp_association *asoc, - struct sctp_stream_out *strq, int moved_how_much) + struct sctp_stream_out *strq, + int moved_how_much SCTP_UNUSED) { struct sctp_stream_queue_pending *sp; From owner-svn-src-head@freebsd.org Sat Aug 6 13:28:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3BEDBAFF3A; Sat, 6 Aug 2016 13:28:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9446711C1; Sat, 6 Aug 2016 13:28:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76DSwem011619; Sat, 6 Aug 2016 13:28:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76DSwGO011618; Sat, 6 Aug 2016 13:28:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608061328.u76DSwGO011618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 6 Aug 2016 13:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303794 - head/lib/libc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 13:28:59 -0000 Author: kib Date: Sat Aug 6 13:28:58 2016 New Revision: 303794 URL: https://svnweb.freebsd.org/changeset/base/303794 Log: Create namespace for the symbols added during 12-CURRENT cycle. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/lib/libc/Versions.def Modified: head/lib/libc/Versions.def ============================================================================== --- head/lib/libc/Versions.def Sat Aug 6 12:51:07 2016 (r303793) +++ head/lib/libc/Versions.def Sat Aug 6 13:28:58 2016 (r303794) @@ -27,6 +27,10 @@ FBSD_1.3 { FBSD_1.4 { } FBSD_1.3; +# This version was first added to 12.0-current. +FBSD_1.5 { +} FBSD_1.4; + # This is our private namespace. Any global interfaces that are # strictly for use only by other FreeBSD applications and libraries @@ -35,4 +39,4 @@ FBSD_1.4 { # # Please do NOT increment the version of this namespace. FBSDprivate_1.0 { -} FBSD_1.4; +} FBSD_1.5; From owner-svn-src-head@freebsd.org Sat Aug 6 13:32:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C22D6BB038B; Sat, 6 Aug 2016 13:32:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91450166F; Sat, 6 Aug 2016 13:32:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76DWfFV015026; Sat, 6 Aug 2016 13:32:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76DWe25015016; Sat, 6 Aug 2016 13:32:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608061332.u76DWe25015016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 6 Aug 2016 13:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303795 - in head/lib: libc/include libc/stdlib libc/tests/stdlib libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 13:32:42 -0000 Author: kib Date: Sat Aug 6 13:32:40 2016 New Revision: 303795 URL: https://svnweb.freebsd.org/changeset/base/303795 Log: Add __cxa_thread_atexit(3) API implementation. This is the backing feature to implement C++11 thread storage duration specified by the thread_local keyword. A destructor for given thread-local object is registered to be executed at the thread termination time using __cxa_thread_atexit(). Libc calls the __cxa_thread_calls_dtors() during exit(3), before finalizers and atexit functions, and libthr calls the function at the thread termination time, after the stack unwinding and thread-specific key destruction. There are several uncertainties in the API which lacks a formal specification. Among them: - is it allowed to register destructors during destructing; we allow, but limiting the nesting level. If too many iterations detected, a diagnostic is issued to stderr and thread forcibly terminates for now. - how to handle destructors which belong to an unloading dso; for now, we ignore destructor calls for such entries, and issue a diagnostic. Linux does prevent dso unload until all threads with destructors from the dso terminated. It is supposed that the diagnostics allow to detect real-world applications relying on the above details and possibly adjust our implementation. Right now the choices were to provide the slim API (but that rarely stands the practice test). Tests are added to check generic functionality and to specify some of the above implementation choices. Submitted by: Mahdi Mokhtari Reviewed by: theraven Discussed with: dim (detection of -std=c++11 supoort for tests) Sponsored by: The FreeBSD Foundation (my involvement) MFC after: 2 weeks Differential revisions: https://reviews.freebsd.org/D7224, https://reviews.freebsd.org/D7427 Added: head/lib/libc/stdlib/cxa_thread_atexit.c (contents, props changed) head/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc (contents, props changed) head/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc (contents, props changed) Modified: head/lib/libc/include/libc_private.h head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/Symbol.map head/lib/libc/stdlib/exit.c head/lib/libc/tests/stdlib/Makefile head/lib/libc/tests/stdlib/Makefile.depend head/lib/libthr/thread/thr_exit.c Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libc/include/libc_private.h Sat Aug 6 13:32:40 2016 (r303795) @@ -267,6 +267,12 @@ extern const char *__progname; void _malloc_thread_cleanup(void); /* + * This function is used by the threading libraries to notify libc that a + * thread is exiting, so its thread-local dtors should be called. + */ +void __cxa_thread_call_dtors(void); + +/* * These functions are used by the threading libraries in order to protect * malloc across fork(). */ Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libc/stdlib/Makefile.inc Sat Aug 6 13:32:40 2016 (r303795) @@ -5,7 +5,7 @@ .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ - bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \ + bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \ hsearch_r.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ Modified: head/lib/libc/stdlib/Symbol.map ============================================================================== --- head/lib/libc/stdlib/Symbol.map Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libc/stdlib/Symbol.map Sat Aug 6 13:32:40 2016 (r303795) @@ -116,8 +116,13 @@ FBSD_1.4 { reallocarray; }; +FBSD_1.5 { + __cxa_thread_atexit; +}; + FBSDprivate_1.0 { __system; _system; __libc_system; + __cxa_thread_call_dtors; }; Added: head/lib/libc/stdlib/cxa_thread_atexit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/cxa_thread_atexit.c Sat Aug 6 13:32:40 2016 (r303795) @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2016 Mahdi Mokhtari + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" + +/* + * C++11 introduces the thread_local scope (like __thread with some + * additions). As a key-feature it should support non-trivial + * destructors, registered with __cxa_thread_atexit() to be executed + * at the thread termination. + * + * The implemention keeps a _Thread_local list of destructors per each + * thread, and calls __cxa_thread_call_dtors() on each thread's exit + * to do cleanup. For a thread calling exit(3), in particular, for + * the initial thread returning from main(), we call + * __cxa_thread_call_dtors() inside exit(). + * + * It could be possible that a dynamically loaded library, use + * thread_local variable but is dlclose()'d before thread exit. The + * destructor of this variable will then try to access the address, + * for calling it but it's unloaded, so it'll crash. We're using + * __elf_phdr_match_addr() to detect and prevent such cases and so + * prevent the crash. + */ + +#define CXA_DTORS_ITERATIONS 4 + +struct cxa_thread_dtor { + void *obj; + void (*func)(void *); + void *dso; + LIST_ENTRY(cxa_thread_dtor) entry; +}; +static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors = + LIST_HEAD_INITIALIZER(dtors); + +int +__cxa_thread_atexit(void (*dtor_func)(void *), void *obj, void *dso_symbol) +{ + struct cxa_thread_dtor *new_dtor; + + new_dtor = malloc(sizeof(*new_dtor)); + if (new_dtor == NULL) { + errno = ENOMEM; /* forcibly override malloc(3) error */ + return (-1); + } + + new_dtor->obj = obj; + new_dtor->func = dtor_func; + new_dtor->dso = dso_symbol; + LIST_INSERT_HEAD(&dtors, new_dtor, entry); + return (0); +} + +static void +walk_cb_call(struct cxa_thread_dtor *dtor) +{ + struct dl_phdr_info phdr_info; + + if (_rtld_addr_phdr(dtor->dso, &phdr_info) && + __elf_phdr_match_addr(&phdr_info, dtor->func)) + dtor->func(dtor->obj); + else + fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from " + "unloaded dso, skipping\n", (void *)(dtor->func)); +} + +static void +walk_cb_nocall(struct cxa_thread_dtor *dtor __unused) +{ +} + +static void +cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *)) +{ + struct cxa_thread_dtor *dtor, *tdtor; + + LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) { + LIST_REMOVE(dtor, entry); + cb(dtor); + free(dtor); + } +} + +/* + * This is the callback function we use to call destructors, once for + * each thread. It is called in exit(3) in libc/stdlib/exit.c and + * before exit_thread() in libthr/thread/thr_exit.c. + */ +void +__cxa_thread_call_dtors(void) +{ + int i; + + for (i = 0; i < CXA_DTORS_ITERATIONS && !LIST_EMPTY(&dtors); i++) + cxa_thread_walk(walk_cb_call); + + if (!LIST_EMPTY(&dtors)) { + fprintf(stderr, "Thread %p is exiting with more " + "thread-specific dtors created after %d iterations " + "of destructor calls\n", + _pthread_self(), i); + cxa_thread_walk(walk_cb_nocall); + } +} Modified: head/lib/libc/stdlib/exit.c ============================================================================== --- head/lib/libc/stdlib/exit.c Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libc/stdlib/exit.c Sat Aug 6 13:32:40 2016 (r303795) @@ -63,6 +63,12 @@ exit(int status) _thread_autoinit_dummy_decl = 1; + /* + * We're dealing with cleaning up thread_local destructors in the case of + * the process termination through main() exit. + * Other cases are handled elsewhere. + */ + __cxa_thread_call_dtors(); __cxa_finalize(NULL); if (__cleanup) (*__cleanup)(); Modified: head/lib/libc/tests/stdlib/Makefile ============================================================================== --- head/lib/libc/tests/stdlib/Makefile Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libc/tests/stdlib/Makefile Sat Aug 6 13:32:40 2016 (r303795) @@ -1,9 +1,15 @@ # $FreeBSD$ +.include + ATF_TESTS_C+= heapsort_test ATF_TESTS_C+= mergesort_test ATF_TESTS_C+= qsort_test ATF_TESTS_C+= tsearch_test +.if ${COMPILER_FEATURES:Mc++11} +ATF_TESTS_CXX+= cxa_thread_atexit_test +ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test +.endif # TODO: t_getenv_thread, t_mi_vector_hash NETBSD_ATF_TESTS_C+= abs_test @@ -33,6 +39,10 @@ PROGS+= h_getopt h_getopt_long CFLAGS+= -I${.CURDIR} +CXXFLAGS.cxa_thread_atexit_test+= -std=c++11 +CXXFLAGS.cxa_thread_atexit_nothr_test+= -std=c++11 +LIBADD.cxa_thread_atexit_test+= pthread + .for t in h_getopt h_getopt_long CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR} Modified: head/lib/libc/tests/stdlib/Makefile.depend ============================================================================== --- head/lib/libc/tests/stdlib/Makefile.depend Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libc/tests/stdlib/Makefile.depend Sat Aug 6 13:32:40 2016 (r303795) @@ -8,7 +8,10 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/atf/libatf-c \ + lib/atf/libatf-c++ \ lib/libc \ + lib/libc++ \ + lib/libthr \ lib/libcompiler_rt \ lib/libnetbsd \ lib/libutil \ Added: head/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc Sat Aug 6 13:32:40 2016 (r303795) @@ -0,0 +1,102 @@ +/*- + * Copyright (c) 2016 Mahdi Mokhtari + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static FILE *output = NULL; + +struct Foo { + Foo() { ATF_REQUIRE(fprintf(output, "Created\n") > 0); } + ~Foo() { ATF_REQUIRE(fprintf(output, "Destroyed\n") > 0); } + void use() { ATF_REQUIRE(fprintf(output, "Used\n") > 0); } +}; + +static thread_local Foo f; + +/* + * This test must not be linked to libpthread. + */ +ATF_TEST_CASE_WITHOUT_HEAD(cxx__nothr); +ATF_TEST_CASE_BODY(cxx__nothr) +{ + void *libthr_handle; + + /* Avoid coredump during f construction. */ + output = stderr; + + libthr_handle = dlopen("libthr.so.3", RTLD_LAZY | RTLD_GLOBAL | + RTLD_NOLOAD); + ATF_REQUIRE(libthr_handle == NULL); +} + +static void +check_local_main(void) +{ + static const char out_log[] = "Created\nUsed\nDestroyed\n"; + + fflush(output); + ATF_REQUIRE(atf::utils::compare_file("test_main.txt", out_log)); +} + +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_main); +ATF_TEST_CASE_BODY(cxx__thread_local_main) +{ + + ATF_REQUIRE((output = fopen("test_main.txt", "w")) != NULL); + f.use(); + atexit(check_local_main); +} + +extern "C" int __cxa_thread_atexit(void (*)(void *), void *, void *); + +static void +again(void *arg) +{ + + __cxa_thread_atexit(again, arg, &output); +} + +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_inf_dtors); +ATF_TEST_CASE_BODY(cxx__thread_inf_dtors) +{ + + again(NULL); +} + +ATF_INIT_TEST_CASES(tcs) +{ + + ATF_ADD_TEST_CASE(tcs, cxx__nothr); + ATF_ADD_TEST_CASE(tcs, cxx__thread_local_main); + ATF_ADD_TEST_CASE(tcs, cxx__thread_inf_dtors); +} Added: head/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc Sat Aug 6 13:32:40 2016 (r303795) @@ -0,0 +1,180 @@ +/*- + * Copyright (c) 2016 Mahdi Mokhtari + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +static FILE *output = NULL; + +struct Foo { + Foo() { ATF_REQUIRE(fprintf(output, "Created\n") > 0); } + ~Foo() { ATF_REQUIRE(fprintf(output, "Destroyed\n") > 0); } + void use() { ATF_REQUIRE(fprintf(output, "Used\n") > 0); } +}; + +struct Bar { + Bar() {} + ~Bar() { + thread_local static Foo foo; + ATF_REQUIRE(fprintf(output, "DIED\n") > 0); + } + void use() {} +}; + +extern "C" int __cxa_thread_atexit(void (*)(void *), void *, void *); + +static void +again(void *arg) +{ + + __cxa_thread_atexit(again, arg, &output); +} + +struct Baz { + Baz() {} + ~Baz() { + again(NULL); + } + void use() {} +}; + +static thread_local Foo f; +static thread_local Foo g; +static thread_local Bar h; +static thread_local Baz e; + +/* + * This test must be linked to libpthread. + */ +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thr); +ATF_TEST_CASE_BODY(cxx__thr) +{ + void *libthr_handle; + + /* Avoid coredump during f construction. */ + output = stderr; + + libthr_handle = dlopen("libthr.so.3", RTLD_LAZY | RTLD_GLOBAL | + RTLD_NOLOAD); + ATF_REQUIRE(libthr_handle != NULL); + dlclose(libthr_handle); +} + +/* + * In this test f.use() will test cxa_thread_atexit() in non-threaded mode. + * After f.use() main will be threaded and we'll have one additional thread + * with its own TLS data. + */ +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_before); +ATF_TEST_CASE_BODY(cxx__thread_local_before) +{ + static const char out_log[] = "Created\nCreated\nUsed\nCreated\n" + "Created\nUsed\nCreated\nDIED\nDestroyed\nDestroyed\nDestroyed\n"; + + ATF_REQUIRE((output = fopen("test_before.txt", "w")) != NULL); + + f.use(); + std::thread t([]() { f.use(); }); + t.join(); + + fflush(output); + + ATF_REQUIRE(atf::utils::compare_file("test_before.txt", out_log)); +} + +/* + * In this test, f.use() will test __cxa_thread_atexit() + * in threaded mode (but still in main-threaed). + */ +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_after); +ATF_TEST_CASE_BODY(cxx__thread_local_after) +{ + static const char out_log[] = "Created\nCreated\nUsed\nCreated\n" + "DIED\nDestroyed\nDestroyed\nDestroyed\nCreated\nCreated\nUsed\n"; + + ATF_REQUIRE((output = fopen("test_after.txt", "w")) != NULL); + + std::thread t([]() { g.use(); }); + t.join(); + sleep(1); + g.use(); + + fflush(output); + + ATF_REQUIRE(atf::utils::compare_file("test_after.txt", out_log)); +} + +/* + * In this test, we register a new dtor while dtors are being run + * in __cxa_thread_atexit(). + */ +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_add_while_calling_dtors); +ATF_TEST_CASE_BODY(cxx__thread_local_add_while_calling_dtors) +{ + static const char out_log[] = "Created\nCreated\nCreated\nDIED\n" + "Destroyed\nDestroyed\nDestroyed\n"; + + ATF_REQUIRE((output = fopen("test_add_meanwhile.txt", "w")) != NULL); + + std::thread t([]() { h.use(); }); + t.join(); + sleep(1); + + fflush(output); + + ATF_REQUIRE(atf::utils::compare_file("test_add_meanwhile.txt", out_log)); +} + +ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_inf_dtors); +ATF_TEST_CASE_BODY(cxx__thread_inf_dtors) +{ + + /* + * Only added to make isolated run of this test not + * coredumping. Construction of Foo objects require filled + * output. + */ + output = stderr; + + std::thread t([]() { e.use(); }); + t.join(); +} + +ATF_INIT_TEST_CASES(tcs) +{ + + ATF_ADD_TEST_CASE(tcs, cxx__thr); + ATF_ADD_TEST_CASE(tcs, cxx__thread_local_before); + ATF_ADD_TEST_CASE(tcs, cxx__thread_local_after); + ATF_ADD_TEST_CASE(tcs, cxx__thread_local_add_while_calling_dtors); + ATF_ADD_TEST_CASE(tcs, cxx__thread_inf_dtors); +} Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sat Aug 6 13:28:58 2016 (r303794) +++ head/lib/libthr/thread/thr_exit.c Sat Aug 6 13:32:40 2016 (r303795) @@ -153,8 +153,12 @@ thread_unwind_stop(int version, _Unwind_ __pthread_cleanup_pop_imp(1); } - if (done) + if (done) { + /* Tell libc that it should call non-trivial TLS dtors. */ + __cxa_thread_call_dtors(); + exit_thread(); /* Never return! */ + } return (_URC_NO_REASON); } @@ -258,6 +262,8 @@ cleanup: while (curthread->cleanup != NULL) { __pthread_cleanup_pop_imp(1); } + __cxa_thread_call_dtors(); + exit_thread(); } @@ -265,6 +271,7 @@ cleanup: while (curthread->cleanup != NULL) { __pthread_cleanup_pop_imp(1); } + __cxa_thread_call_dtors(); exit_thread(); #endif /* _PTHREAD_FORCED_UNWIND */ From owner-svn-src-head@freebsd.org Sat Aug 6 15:06:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2CC6BAF681; Sat, 6 Aug 2016 15:06:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A6201B1F; Sat, 6 Aug 2016 15:06:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76F6JI4048942; Sat, 6 Aug 2016 15:06:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76F6JwI048940; Sat, 6 Aug 2016 15:06:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201608061506.u76F6JwI048940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 6 Aug 2016 15:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303796 - head/sys/cddl/dev/dtrace/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 15:06:20 -0000 Author: jhibbits Date: Sat Aug 6 15:06:19 2016 New Revision: 303796 URL: https://svnweb.freebsd.org/changeset/base/303796 Log: Two fixups for dtrace * Use the right incantation to get the next stack pointer. Since powerpc uses special frames for traps, dereferencing the stack pointer straight up won't get us the next stack pointer in every case. * Clear EE using the correct instruction sequence. The PowerISA states that 'andi.' ANDs the register with 0||, instead of sign extending or filling out the unavailable bits with 1. Even if it did sign extend, PSL_EE is 0x8000, so ~PSL_EE is 0x7fff, and the upper bits would be cleared. Use rlwinm in the 32-bit case, and a two-rotate sequence in the 64-bit case, the latter chosen to follow the output generated by gcc. MFC after: 1 week Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Sat Aug 6 13:32:40 2016 (r303795) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Sat Aug 6 15:06:19 2016 (r303796) @@ -67,7 +67,13 @@ dtrace_icookie_t dtrace_interrupt_disabl */ ASENTRY_NOPROF(dtrace_interrupt_disable) mfmsr %r3 - andi. %r0,%r3,~PSL_EE@l +#ifdef __powerpc64__ + /* Two-instruction sequence to clear EE flag */ + rldicl %r0,%r3,48,1 + rotldi %r0,%r0,16 +#else + rlwinm %r0,%r3,0,~PSL_EE /* Clear EE flag */ +#endif mtmsr %r0 blr END(dtrace_interrupt_disable) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sat Aug 6 13:32:40 2016 (r303795) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sat Aug 6 15:06:19 2016 (r303796) @@ -545,7 +545,7 @@ dtrace_getstackdepth(int aframes) else aframes--; osp = sp; - sp = *(uintptr_t *)sp; + sp = dtrace_next_sp(sp); } if (depth < aframes) return (0); From owner-svn-src-head@freebsd.org Sat Aug 6 15:10:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97325BAF7B0; Sat, 6 Aug 2016 15:10:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61AD81DE9; Sat, 6 Aug 2016 15:10:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76FAERo049122; Sat, 6 Aug 2016 15:10:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76FAEHo049121; Sat, 6 Aug 2016 15:10:14 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201608061510.u76FAEHo049121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 6 Aug 2016 15:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303797 - head/contrib/binutils/bfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 15:10:15 -0000 Author: jhibbits Date: Sat Aug 6 15:10:14 2016 New Revision: 303797 URL: https://svnweb.freebsd.org/changeset/base/303797 Log: Check the first byte of the array for NUL, instead of the array as a NULL pointer The partition_name field is an array, so can never be NULL itself. Check only the first byte instead. This was found when test building with clang, but I'm not sure how it passes gcc's warnings either. Modified: head/contrib/binutils/bfd/ppcboot.c Modified: head/contrib/binutils/bfd/ppcboot.c ============================================================================== --- head/contrib/binutils/bfd/ppcboot.c Sat Aug 6 15:06:19 2016 (r303796) +++ head/contrib/binutils/bfd/ppcboot.c Sat Aug 6 15:10:14 2016 (r303797) @@ -419,7 +419,7 @@ ppcboot_bfd_print_private_bfd_data (abfd if (tdata->header.os_id) fprintf (f, "OS_ID = 0x%.2x\n", tdata->header.os_id); - if (tdata->header.partition_name) + if (tdata->header.partition_name[0]) fprintf (f, _("Partition name = \"%s\"\n"), tdata->header.partition_name); for (i = 0; i < 4; i++) From owner-svn-src-head@freebsd.org Sat Aug 6 15:29:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D8D3BAFCE0; Sat, 6 Aug 2016 15:29:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EC0018F2; Sat, 6 Aug 2016 15:29:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76FTk0L056480; Sat, 6 Aug 2016 15:29:46 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76FTkhZ056479; Sat, 6 Aug 2016 15:29:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201608061529.u76FTkhZ056479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 6 Aug 2016 15:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303798 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 15:29:47 -0000 Author: tuexen Date: Sat Aug 6 15:29:46 2016 New Revision: 303798 URL: https://svnweb.freebsd.org/changeset/base/303798 Log: Don't modify a structure without holding a reference count on it. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Aug 6 15:10:14 2016 (r303797) +++ head/sys/netinet/sctputil.c Sat Aug 6 15:29:46 2016 (r303798) @@ -6098,9 +6098,9 @@ out: goto stage_left; #endif } - atomic_add_int(&stcb->asoc.refcnt, -1); /* Save the value back for next time */ stcb->freed_by_sorcv_sincelast = freed_so_far; + atomic_add_int(&stcb->asoc.refcnt, -1); } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) { if (stcb) { From owner-svn-src-head@freebsd.org Sat Aug 6 16:48:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51A33BB02AC; Sat, 6 Aug 2016 16:48:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 229D31EEF; Sat, 6 Aug 2016 16:48:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76GmeiL085986; Sat, 6 Aug 2016 16:48:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76Gmejb085985; Sat, 6 Aug 2016 16:48:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608061648.u76Gmejb085985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 6 Aug 2016 16:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303799 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 16:48:41 -0000 Author: pfg Date: Sat Aug 6 16:48:40 2016 New Revision: 303799 URL: https://svnweb.freebsd.org/changeset/base/303799 Log: ext2fs: Add some more inode flags. These are currently unused in out implementation but it is good to keep them for reference. Obtained from: NetBSD (CVS Rev. 1.35) MFC after: 1 month Modified: head/sys/fs/ext2fs/ext2_dinode.h Modified: head/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- head/sys/fs/ext2fs/ext2_dinode.h Sat Aug 6 15:29:46 2016 (r303798) +++ head/sys/fs/ext2fs/ext2_dinode.h Sat Aug 6 16:48:40 2016 (r303799) @@ -71,7 +71,10 @@ #define EXT4_TOPDIR 0x00020000 /* Top of directory hierarchies*/ #define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */ #define EXT4_EXTENTS 0x00080000 /* Inode uses extents */ +#define EXT4_EA_INODE 0x00200000 /* Inode used for large EA */ #define EXT4_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */ +#define EXT4_INLINE_DATA 0x10000000 /* Inode has inline data */ +#define EXT4_PROJINHERIT 0x20000000 /* Children inherit project ID */ /* * Definitions for nanosecond timestamps. From owner-svn-src-head@freebsd.org Sat Aug 6 17:24:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4797BAF02A; Sat, 6 Aug 2016 17:24:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A3BF1827; Sat, 6 Aug 2016 17:24:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76HOZDv000637; Sat, 6 Aug 2016 17:24:35 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76HOZrO000636; Sat, 6 Aug 2016 17:24:35 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201608061724.u76HOZrO000636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 6 Aug 2016 17:24:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303800 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 17:24:36 -0000 Author: pfg Date: Sat Aug 6 17:24:35 2016 New Revision: 303800 URL: https://svnweb.freebsd.org/changeset/base/303800 Log: ext2fs: Add defines for some missing ext4 feature flags. These are currently unused in our implementation and some even appear to have not been implemented yet on linux but it is good to keep them for reference. Obtained from: NetBSD (CVS Rev. 1.41) MFC after: 1 month Modified: head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Sat Aug 6 16:48:40 2016 (r303799) +++ head/sys/fs/ext2fs/ext2fs.h Sat Aug 6 17:24:35 2016 (r303800) @@ -206,6 +206,7 @@ struct csum { #define EXT2F_COMPAT_HASJOURNAL 0x0004 #define EXT2F_COMPAT_RESIZE 0x0010 #define EXT2F_COMPAT_DIRHASHINDEX 0x0020 +#define EXT2F_COMPAT_SPARSESUPER2 0x0200 #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 @@ -214,6 +215,11 @@ struct csum { #define EXT2F_ROCOMPAT_GDT_CSUM 0x0010 #define EXT2F_ROCOMPAT_DIR_NLINK 0x0020 #define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040 +#define EXT2F_ROCOMPAT_QUOTA 0x0100 +#define EXT2F_ROCOMPAT_BIGALLOC 0x0200 +#define EXT2F_ROCOMPAT_METADATA_CKSUM 0x0400 +#define EXT2F_ROCOMPAT_READONLY 0x1000 +#define EXT2F_ROCOMPAT_PROJECT 0x2000 #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 @@ -223,6 +229,12 @@ struct csum { #define EXT2F_INCOMPAT_64BIT 0x0080 #define EXT2F_INCOMPAT_MMP 0x0100 #define EXT2F_INCOMPAT_FLEX_BG 0x0200 +#define EXT2F_INCOMPAT_EA_INODE 0x0400 +#define EXT2F_INCOMPAT_DIRDATA 0x1000 +#define EXT2F_INCOMPAT_CSUM_SEED 0x2000 +#define EXT2F_INCOMPAT_LARGEDIR 0x4000 +#define EXT2F_INCOMPAT_INLINE_DATA 0x8000 +#define EXT2F_INCOMPAT_ENCRYPT 0x10000 /* * Features supported in this implementation From owner-svn-src-head@freebsd.org Sat Aug 6 17:27:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A73E3BAF09E; Sat, 6 Aug 2016 17:27:08 +0000 (UTC) (envelope-from bjk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 613F719BC; Sat, 6 Aug 2016 17:27:08 +0000 (UTC) (envelope-from bjk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76HR7jb000767; Sat, 6 Aug 2016 17:27:07 GMT (envelope-from bjk@FreeBSD.org) Received: (from bjk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76HR7TQ000766; Sat, 6 Aug 2016 17:27:07 GMT (envelope-from bjk@FreeBSD.org) Message-Id: <201608061727.u76HR7TQ000766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bjk set sender to bjk@FreeBSD.org using -f From: Benjamin Kaduk Date: Sat, 6 Aug 2016 17:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303801 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 17:27:08 -0000 Author: bjk (doc committer) Date: Sat Aug 6 17:27:07 2016 New Revision: 303801 URL: https://svnweb.freebsd.org/changeset/base/303801 Log: Correct the documentation of the 'type' parameter for the _SWAP macros from sys/queue.h Submitted by: akshay1994.leo_gmail.com (for STAILQ) Differential Revision: https://reviews.freebsd.org/D7428 Modified: head/share/man/man3/queue.3 Modified: head/share/man/man3/queue.3 ============================================================================== --- head/share/man/man3/queue.3 Sat Aug 6 17:24:35 2016 (r303800) +++ head/share/man/man3/queue.3 Sat Aug 6 17:27:07 2016 (r303801) @@ -141,7 +141,7 @@ lists and tail queues .Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME" .Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME" .Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME" -.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME" +.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "TYPE" .\" .Fn STAILQ_CLASS_ENTRY "CLASSTYPE" .Fn STAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" @@ -164,7 +164,7 @@ lists and tail queues .Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" -.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME" +.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "TYPE" .\" .Fn LIST_CLASS_ENTRY "CLASSTYPE" .Fn LIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" @@ -184,7 +184,7 @@ lists and tail queues .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME" .Fn LIST_PREV "TYPE *elm" "LIST_HEAD *head" "TYPE" "LIST_ENTRY NAME" .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME" -.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME" +.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" .\" .Fn TAILQ_CLASS_ENTRY "CLASSTYPE" .Fn TAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" @@ -211,7 +211,7 @@ lists and tail queues .Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME" .Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME" .Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME" -.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME" +.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" .\" .Sh DESCRIPTION These macros define and operate on four types of data structures which From owner-svn-src-head@freebsd.org Sat Aug 6 17:53:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC516BAF8A5; Sat, 6 Aug 2016 17:53:54 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 722361826; Sat, 6 Aug 2016 17:53:54 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76HrrVi011815; Sat, 6 Aug 2016 17:53:53 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76HrrP1011814; Sat, 6 Aug 2016 17:53:53 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201608061753.u76HrrP1011814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sat, 6 Aug 2016 17:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303802 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 17:53:54 -0000 Author: bcr (doc committer) Date: Sat Aug 6 17:53:53 2016 New Revision: 303802 URL: https://svnweb.freebsd.org/changeset/base/303802 Log: Update with the members of the 9th core team. Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Sat Aug 6 17:27:07 2016 (r303801) +++ head/share/misc/organization.dot Sat Aug 6 17:53:53 2016 (r303802) @@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"] # Development teams go here alphabetically sorted -core [label="Core Team\ncore@FreeBSD.org\nbapt, emaste, gavin,\nglebius, gnn, hrs,\npeter, rwatson, theraven"] +core [label="Core Team\ncore@FreeBSD.org\nallanjude, bapt, bcr,\nbenno, emaste, gnn,\nhrs, jhb, kmoore"] coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\nmatthew"] doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] From owner-svn-src-head@freebsd.org Sat Aug 6 18:48:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 348BBBB05B4; Sat, 6 Aug 2016 18:48:49 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA6A21DFC; Sat, 6 Aug 2016 18:48:48 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76Imm5m030398; Sat, 6 Aug 2016 18:48:48 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76ImlqK030395; Sat, 6 Aug 2016 18:48:47 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201608061848.u76ImlqK030395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Sat, 6 Aug 2016 18:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303803 - in head/sys/dev: fdt ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 18:48:49 -0000 Author: stevek Date: Sat Aug 6 18:48:47 2016 New Revision: 303803 URL: https://svnweb.freebsd.org/changeset/base/303803 Log: Add hw.fdt sysctl node. Make FDT blob available via opaque hw.fdt.dtb sysctl, if a DTB has been installed by the time sysctls are registered. Reviewed by: andrew Approved by: sjg (mentor) Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D7411 Modified: head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sat Aug 6 17:53:53 2016 (r303802) +++ head/sys/dev/fdt/fdt_common.c Sat Aug 6 18:48:47 2016 (r303803) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -60,6 +61,8 @@ __FBSDID("$FreeBSD$"); #define FDT_REG_CELLS 4 +SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD, 0, "Flattened Device Tree"); + vm_paddr_t fdt_immr_pa; vm_offset_t fdt_immr_va; vm_offset_t fdt_immr_size; Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Sat Aug 6 17:53:53 2016 (r303802) +++ head/sys/dev/fdt/fdt_common.h Sat Aug 6 18:48:47 2016 (r303803) @@ -32,6 +32,7 @@ #ifndef _FDT_COMMON_H_ #define _FDT_COMMON_H_ +#include #include #include #include @@ -80,6 +81,8 @@ extern struct fdt_pm_mask_entry fdt_pm_m extern u_char fdt_static_dtb; #endif +SYSCTL_DECL(_hw_fdt); + int fdt_addrsize_cells(phandle_t, int *, int *); u_long fdt_data_get(void *, int); int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *); Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Sat Aug 6 17:53:53 2016 (r303802) +++ head/sys/dev/ofw/ofw_fdt.c Sat Aug 6 18:48:47 2016 (r303803) @@ -96,6 +96,27 @@ OFW_DEF(ofw_fdt); static void *fdtp = NULL; static int +sysctl_handle_dtb(SYSCTL_HANDLER_ARGS) +{ + + return (sysctl_handle_opaque(oidp, fdtp, fdt_totalsize(fdtp), req)); +} + +static void +sysctl_register_fdt_oid(void *arg) +{ + + /* If there is no FDT registered, skip adding the sysctl */ + if (fdtp == NULL) + return; + + SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_fdt), OID_AUTO, "dtb", + CTLTYPE_OPAQUE | CTLFLAG_RD, NULL, 0, sysctl_handle_dtb, "", + "Device Tree Blob"); +} +SYSINIT(dtb_oid, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_register_fdt_oid, 0); + +static int ofw_fdt_init(ofw_t ofw, void *data) { int err; From owner-svn-src-head@freebsd.org Sat Aug 6 19:05:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C13AEBB0908; Sat, 6 Aug 2016 19:05:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 925501621; Sat, 6 Aug 2016 19:05:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76J5169037671; Sat, 6 Aug 2016 19:05:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76J51sB037669; Sat, 6 Aug 2016 19:05:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201608061905.u76J51sB037669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 6 Aug 2016 19:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303804 - head/usr.bin/tar/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 19:05:02 -0000 Author: ngie Date: Sat Aug 6 19:05:01 2016 New Revision: 303804 URL: https://svnweb.freebsd.org/changeset/base/303804 Log: Fix building usr.bin/tar/tests with PIE symbol building enabled by removing CFLAGS+= -static `CFLAGS+= -static` was a carryover from pre-r289195 with usr.bin/tar/test/Makefile that should have been specified in LDFLAGS There doesn't seem to be an apparent need for static compilation of the test binaries. Differential Revision: https://reviews.freebsd.org/D7430 MFC after: 1 week Obtained-from: opBSD (418a491eed20d2603ddd1f1bd92c2c0d95094002) Submitted by: op Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/tar/tests/Makefile Modified: head/usr.bin/tar/tests/Makefile ============================================================================== --- head/usr.bin/tar/tests/Makefile Sat Aug 6 18:48:47 2016 (r303803) +++ head/usr.bin/tar/tests/Makefile Sat Aug 6 19:05:01 2016 (r303804) @@ -9,7 +9,6 @@ ATF_TESTS_SH+= functional_test BINDIR= ${TESTSDIR} CFLAGS+= -DPLATFORM_CONFIG_H=\"${SRCTOP}/lib/libarchive/config_freebsd.h\" -CFLAGS+= -static CFLAGS+= -I${SRCTOP}/lib/libarchive -I${.OBJDIR} CFLAGS+= -I${_LIBARCHIVEDIR}/tar -I${_LIBARCHIVEDIR}/test_utils From owner-svn-src-head@freebsd.org Sat Aug 6 19:06:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D705BB0A6A; Sat, 6 Aug 2016 19:06:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) (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 CFFC518C6; Sat, 6 Aug 2016 19:06:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f48.google.com with SMTP id u186so46465461ita.0; Sat, 06 Aug 2016 12:06:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=vMophArNNX+eWVcekJOUA0tg7KODC+RMgaGP/V6GghE=; b=XEDzwdw0v/uqYcbF6P0cZ55WNVJGlXawjYlfTXlG4mLoyb6Hkr0SUdr/iBBgOQYDly cm3vO91yErXkJJjRzHcEQCflXzahMIigCzpT7qnh12vx2s111CDEu1tsRX0nCbwDi5/A 5sqs/cjpbb+bjKPtar4PpffOoqpPMXdsRNm9HUEw4QJw6PrT3exnqTEh6b3kXhVYg7eG XAbetOGT1fLWcGC4wZ6NBvO8yc1LLUO/pjLTpECD1bEpOI6UimukBDqRUhW6eIAKEg3J IlyjjNP9sBJGZGo/6ybOnrKeVrW7H01B3QxoV7qFi9nkNPh2Y1V8kfsgUTkwDwOG67jP DP+A== X-Gm-Message-State: AEkoouuxb+mlciJWAFby1awFhNFpFxXGBt4kKzv9N6oO8c6JxARUL1aPpu401PdNBk7BqQ== X-Received: by 10.36.139.2 with SMTP id g2mr10569221ite.75.1470510384761; Sat, 06 Aug 2016 12:06:24 -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 y194sm10749832iod.17.2016.08.06.12.06.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Aug 2016 12:06:24 -0700 (PDT) Received: by mail-it0-f50.google.com with SMTP id f6so51572492ith.0; Sat, 06 Aug 2016 12:06:23 -0700 (PDT) X-Received: by 10.36.76.16 with SMTP id a16mr10705405itb.86.1470510383072; Sat, 06 Aug 2016 12:06:23 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.122.208 with HTTP; Sat, 6 Aug 2016 12:06:22 -0700 (PDT) In-Reply-To: <201608061727.u76HR7TQ000766@repo.freebsd.org> References: <201608061727.u76HR7TQ000766@repo.freebsd.org> From: Conrad Meyer Date: Sat, 6 Aug 2016 12:06:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303801 - head/share/man/man3 To: Benjamin Kaduk Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 19:06:32 -0000 Hey Benjamin, The submitter notes that this wider change isn't quite right in https://reviews.freebsd.org/D7428 =E2=80=94 LIST_SWAP and TAILQ_SWAP both n= eed the "entry" parameter. Best, Conrad On Sat, Aug 6, 2016 at 10:27 AM, Benjamin Kaduk wrote: > Author: bjk (doc committer) > Date: Sat Aug 6 17:27:07 2016 > New Revision: 303801 > URL: https://svnweb.freebsd.org/changeset/base/303801 > > Log: > Correct the documentation of the 'type' parameter for the _SWAP > macros from sys/queue.h > > Submitted by: akshay1994.leo_gmail.com (for STAILQ) > Differential Revision: https://reviews.freebsd.org/D7428 > > Modified: > head/share/man/man3/queue.3 > > Modified: head/share/man/man3/queue.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/man/man3/queue.3 Sat Aug 6 17:24:35 2016 (r303800) > +++ head/share/man/man3/queue.3 Sat Aug 6 17:27:07 2016 (r303801) > @@ -141,7 +141,7 @@ lists and tail queues > .Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME= " > .Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME" > .Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME" > -.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME= " > +.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "TYPE" > .\" > .Fn STAILQ_CLASS_ENTRY "CLASSTYPE" > .Fn STAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" > @@ -164,7 +164,7 @@ lists and tail queues > .Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY N= AME" > .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NA= ME" > .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" > -.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY = NAME" > +.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "TYPE" > .\" > .Fn LIST_CLASS_ENTRY "CLASSTYPE" > .Fn LIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" > @@ -184,7 +184,7 @@ lists and tail queues > .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME" > .Fn LIST_PREV "TYPE *elm" "LIST_HEAD *head" "TYPE" "LIST_ENTRY NAME" > .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME" > -.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY N= AME" > +.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" > .\" > .Fn TAILQ_CLASS_ENTRY "CLASSTYPE" > .Fn TAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" > @@ -211,7 +211,7 @@ lists and tail queues > .Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME" > .Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME" > .Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME" > -.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENT= RY NAME" > +.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" > .\" > .Sh DESCRIPTION > These macros define and operate on four types of data structures which > From owner-svn-src-head@freebsd.org Sat Aug 6 19:12:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0923BB0CC5; Sat, 6 Aug 2016 19:12:24 +0000 (UTC) (envelope-from bjk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A10B41D39; Sat, 6 Aug 2016 19:12:24 +0000 (UTC) (envelope-from bjk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76JCNle041213; Sat, 6 Aug 2016 19:12:23 GMT (envelope-from bjk@FreeBSD.org) Received: (from bjk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76JCNmu041212; Sat, 6 Aug 2016 19:12:23 GMT (envelope-from bjk@FreeBSD.org) Message-Id: <201608061912.u76JCNmu041212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bjk set sender to bjk@FreeBSD.org using -f From: Benjamin Kaduk Date: Sat, 6 Aug 2016 19:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303805 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 19:12:24 -0000 Author: bjk (doc committer) Date: Sat Aug 6 19:12:23 2016 New Revision: 303805 URL: https://svnweb.freebsd.org/changeset/base/303805 Log: Re-correct the documentation for the 'type' parameter of the _SWAP macros from sys/queue.h -- only the singly-linked forms do not need the 'field' argument. Pointy Hat to: bjk Reported by: akshay1994.leo_gmail.com Modified: head/share/man/man3/queue.3 Modified: head/share/man/man3/queue.3 ============================================================================== --- head/share/man/man3/queue.3 Sat Aug 6 19:05:01 2016 (r303804) +++ head/share/man/man3/queue.3 Sat Aug 6 19:12:23 2016 (r303805) @@ -184,7 +184,7 @@ lists and tail queues .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME" .Fn LIST_PREV "TYPE *elm" "LIST_HEAD *head" "TYPE" "LIST_ENTRY NAME" .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME" -.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" +.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME" .\" .Fn TAILQ_CLASS_ENTRY "CLASSTYPE" .Fn TAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" @@ -211,7 +211,7 @@ lists and tail queues .Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME" .Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME" .Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME" -.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" +.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME" .\" .Sh DESCRIPTION These macros define and operate on four types of data structures which From owner-svn-src-head@freebsd.org Sat Aug 6 19:13:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9D5ABB0D49; Sat, 6 Aug 2016 19:13:47 +0000 (UTC) (envelope-from kaduk@mit.edu) Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu [18.9.25.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FCCA1FBE; Sat, 6 Aug 2016 19:13:46 +0000 (UTC) (envelope-from kaduk@mit.edu) X-AuditID: 1209190e-40fff70000005c88-7a-57a635b4cba3 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id A5.88.23688.4B536A75; Sat, 6 Aug 2016 15:08:37 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id u76J8ZCn008404; Sat, 6 Aug 2016 15:08:36 -0400 Received: from multics.mit.edu (system-low-sipb.mit.edu [18.187.2.37]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id u76J8WB4022503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 6 Aug 2016 15:08:35 -0400 Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id u76J8WFF007602; Sat, 6 Aug 2016 15:08:32 -0400 (EDT) Date: Sat, 6 Aug 2016 15:08:32 -0400 (EDT) From: Benjamin Kaduk X-X-Sender: kaduk@multics.mit.edu To: Conrad Meyer cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303801 - head/share/man/man3 In-Reply-To: Message-ID: References: <201608061727.u76HR7TQ000766@repo.freebsd.org> User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupileLIzCtJLcpLzFFi42IR4hRV1t1quizc4NtqRYt3cz8wW/xpn8Ji 8WfTQlaLpi8LmBxYPGZ8ms8SwBjFZZOSmpNZllqkb5fAldF6+hdrwTTZiqZ13YwNjL/Fuxg5 OSQETCR2vT/A3MXIxSEk0MYksXzyLDYIZwOjxIzva5ggnINMEteurGIHaRESqJeY8Hg5G4jN IqAlcXjLPGYQm01ATeLx3mZWiLGKEptPTQKLiwgoSXw9t50RxGYWyJY40rMFrFdYwExi1efp TCA2p0CgxLXmVWA1vAIOEtffd7HB7Np9oR2sRlRAR2L1/iksEDWCEidnPmGBmOkvsfL4T8YJ jIKzkKRmIUlB2OoSBz5dhLK1Je7fbGNbwMiyilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdYLzez RC81pXQTIzjIJfl2ME5q8D7EKMDBqMTDu2DdknAh1sSy4srcQ4ySHExKorzPOZaFC/El5adU ZiQWZ8QXleakFh9ilOBgVhLhPWUMlONNSaysSi3Kh0lJc7AoifNu/9YeLiSQnliSmp2aWpBa BJOV4eBQkuBNNgFqFCxKTU+tSMvMKUFIM3FwggznARp+DKSGt7ggMbc4Mx0if4pRUUqctxMk IQCSyCjNg+sFJ6HdTKqvGMWBXhHmFQSmJCEeYAKD634FNJgJaPBHqyUgg0sSEVJSDYz6q9wP /HJq3LZP6czO3JOfHTXuyTzhr94oXS5YMWfvC6UJf6WWzWgy6ng+6Rm73STRg0ruZ9ucfW7v c/7BLNrTenOZfwML+xdd0cbeoN+hn9kv3doooH/x4/2YpZk27r+sF0UGOHh4Vl6X/z3dJPhY bn/b6klebau3H9QSkdcKzcicN/HRpG4lluKMREMt5qLiRAC6DUNFHQMAAA== Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 19:13:47 -0000 Indeed; it seems I was not checking what I thought I was checking in sys/queue.h; fix incoming. -Ben On Sat, 6 Aug 2016, Conrad Meyer wrote: > Hey Benjamin, > > The submitter notes that this wider change isn't quite right in > https://reviews.freebsd.org/D7428 =E2=80=94 LIST_SWAP and TAILQ_SWAP both= need > the "entry" parameter. > > Best, > Conrad > > On Sat, Aug 6, 2016 at 10:27 AM, Benjamin Kaduk wrote: > > Author: bjk (doc committer) > > Date: Sat Aug 6 17:27:07 2016 > > New Revision: 303801 > > URL: https://svnweb.freebsd.org/changeset/base/303801 > > > > Log: > > Correct the documentation of the 'type' parameter for the _SWAP > > macros from sys/queue.h > > > > Submitted by: akshay1994.leo_gmail.com (for STAILQ) > > Differential Revision: https://reviews.freebsd.org/D7428 > > > > Modified: > > head/share/man/man3/queue.3 > > > > Modified: head/share/man/man3/queue.3 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/man/man3/queue.3 Sat Aug 6 17:24:35 2016 (r30380= 0) > > +++ head/share/man/man3/queue.3 Sat Aug 6 17:27:07 2016 (r30380= 1) > > @@ -141,7 +141,7 @@ lists and tail queues > > .Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NA= ME" > > .Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME" > > .Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME" > > -.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NA= ME" > > +.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "TYPE" > > .\" > > .Fn STAILQ_CLASS_ENTRY "CLASSTYPE" > > .Fn STAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" > > @@ -164,7 +164,7 @@ lists and tail queues > > .Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY= NAME" > > .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY = NAME" > > .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" > > -.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTR= Y NAME" > > +.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "TYPE" > > .\" > > .Fn LIST_CLASS_ENTRY "CLASSTYPE" > > .Fn LIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" > > @@ -184,7 +184,7 @@ lists and tail queues > > .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME" > > .Fn LIST_PREV "TYPE *elm" "LIST_HEAD *head" "TYPE" "LIST_ENTRY NAME" > > .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME" > > -.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY= NAME" > > +.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" > > .\" > > .Fn TAILQ_CLASS_ENTRY "CLASSTYPE" > > .Fn TAILQ_CLASS_HEAD "HEADNAME" "CLASSTYPE" > > @@ -211,7 +211,7 @@ lists and tail queues > > .Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME" > > .Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME" > > .Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME" > > -.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_E= NTRY NAME" > > +.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" > > .\" > > .Sh DESCRIPTION > > These macros define and operate on four types of data structures which > > > From owner-svn-src-head@freebsd.org Sat Aug 6 20:13:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AF93BB1B5F for ; Sat, 6 Aug 2016 20:13:03 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x22c.google.com (mail-yb0-x22c.google.com [IPv6:2607:f8b0:4002: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 3003A1A24 for ; Sat, 6 Aug 2016 20:13:03 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x22c.google.com with SMTP id x196so24810190ybe.1 for ; Sat, 06 Aug 2016 13:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=VgbVnBoBThU7FM3nUePjWMeY5pzgdCzLbRzGYwOOlPA=; b=tOTU2T4AcNGWOBZ+9MQTdb0nKB5f3vCGpuQeNu0NU22XRdSRoxKxnHyUxniB3lp0xF Scucc8EG0UmRfn9WDfCyYaaUttMYfxH9zWnun3ezLeYIFL4KZ4ckpE0UfylEL5RJ5OW0 A/xD09IPglvEB42pb2glYIo0vpVpemq7Vv5xZB7C6jaG1Ym7TTAsuAe3CFJY/BixKbfr fPbSiZby+RmfhTstzlTsUiVw5EylsMmSX9Au8oaRlDOjqbFFmefUwJU66X9QYu/yfkID lrTb/nu6Abi5zgLQSFQNHJtbqiTPTec0njFmXAR2MVK/jy112VPOH/3IJqWPtLcGEJ0K cUYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VgbVnBoBThU7FM3nUePjWMeY5pzgdCzLbRzGYwOOlPA=; b=BjePurDWcVATU1XKQ9CSPKJQmS0kIqwnBQ19eBECjLFzbq04maTGT2eOHOkBf+nsU8 Aa1S9bcUgZll0sYqJyYMzLKBVCS6Nm/sLZb3SEn77ihF1vNwDPRUaXyYXKekJrRKXz0l mUkmHyF2WGiSxzKEggstwRNHdj3kQHbJfnDKpYKBpdv6c6OKXk4c7kmkokTMFSXzdAVh x9rbPQZOxdalqJUqy8ROQOa7Cm+UmRyA838TCU18U4th+gJiWT/WVp7KbxmyrqlxHD2n i0+UVVNbc5v5IxZWVdhVIJkccU7hkXJe2Dkns79Cz/rgA7rZm8gZ5DYgwwLKXEgJ1o5h F6Kw== X-Gm-Message-State: AEkoouusGDCHvrGWye7rsT96MbfsTuIGOtZ/pHd/UOE9LAzLyI/tqzNwZeW7I+wS8tFGVVtQpO3KZ0FvkoEAmQ== X-Received: by 10.37.161.136 with SMTP id a8mr25574098ybi.16.1470514382043; Sat, 06 Aug 2016 13:13:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.201.71 with HTTP; Sat, 6 Aug 2016 13:13:01 -0700 (PDT) In-Reply-To: <201608041527.u74FR9xo083057@repo.freebsd.org> References: <201608041527.u74FR9xo083057@repo.freebsd.org> From: Ed Schouten Date: Sat, 6 Aug 2016 22:13:01 +0200 Message-ID: Subject: Re: svn commit: r303746 - head/usr.bin/indent To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 20:13:03 -0000 Hi Pedro, 2016-08-04 17:27 GMT+02:00 Pedro F. Giffuni : > Log: > indent(1): Use bsearch() for looking up type keywords. You're never doing any deletions, right? Would it make more sense to use hsearch_r() in that case? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Sat Aug 6 20:27:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1E9BBB1EF3; Sat, 6 Aug 2016 20:27:13 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 926CE12C1; Sat, 6 Aug 2016 20:27:13 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u76KRCw0066921; Sat, 6 Aug 2016 20:27:12 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u76KRCnE066920; Sat, 6 Aug 2016 20:27:12 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608062027.u76KRCnE066920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 6 Aug 2016 20:27:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303806 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 20:27:13 -0000 Author: cy Date: Sat Aug 6 20:27:12 2016 New Revision: 303806 URL: https://svnweb.freebsd.org/changeset/base/303806 Log: Add Logitech Unifying receiver. MFC after: 1 week Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Aug 6 19:12:23 2016 (r303805) +++ head/sys/dev/usb/usbdevs Sat Aug 6 20:27:12 2016 (r303806) @@ -2729,6 +2729,7 @@ product LOGITECH BB13 0xc401 USB-PS/2 T product LOGITECH RK53 0xc501 Cordless mouse product LOGITECH RB6 0xc503 Cordless keyboard product LOGITECH MX700 0xc506 Cordless optical mouse +product LOGITECH UNIFYING 0xc52b Logitech Unifying Receiver product LOGITECH QUICKCAMPRO2 0xd001 QuickCam Pro /* Logitec Corp. products */ From owner-svn-src-head@freebsd.org Sat Aug 6 21:14:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B463BB1BCF for ; Sat, 6 Aug 2016 21:14:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm21.bullet.mail.bf1.yahoo.com (nm21.bullet.mail.bf1.yahoo.com [98.139.212.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 344171B46 for ; Sat, 6 Aug 2016 21:14:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1470514723; bh=4UIGjT4l95EVVeAOLlQaayN0AAzbw7S81KNs/+uvbl0=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=UzquuCGH6YB33lVJjNGH0LTngErxNmITa6MXdDFsKIralSFFrRJI4mtFUwKsvS4/dXQ6PiPmkRzcV8HNU6MoCvKbhxJOiGNhkvxT/XaaXNP/dSm3/gWUsVWxxE2V48hHoXVb2dnIBm49vdEmFmHSKkWv+YJkpGR4I4VUWxEJgUFF6A2rp5bE/TWHoXyB34bxMrA4KJPfg6j6rvq6EgQvl1YcwFeVLVqMjsVxO6e52gp9kb8u6j86aOeuyRAI61m75O8cNaDG4m+W9fYWhp1JI4VlsbSx4mlQUIBQf59r52dMqAlKyv4kamEcsGsJxmtFBsWu+k3psAHAupdqap0Nug== Received: from [98.139.170.181] by nm21.bullet.mail.bf1.yahoo.com with NNFMP; 06 Aug 2016 20:18:43 -0000 Received: from [98.139.211.204] by tm24.bullet.mail.bf1.yahoo.com with NNFMP; 06 Aug 2016 20:18:43 -0000 Received: from [127.0.0.1] by smtp213.mail.bf1.yahoo.com with NNFMP; 06 Aug 2016 20:18:43 -0000 X-Yahoo-Newman-Id: 681569.72508.bm@smtp213.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: it9cSAMVM1nxkhq6K.BwWsXp96MayCsfvs2pGQkFaz65jW0 MjbUa64CbK65Bi_.piW9Y6i4Wt0QNyFc2WMoaGOblpk376BYyRH2GxhdMcl. 1Rxj_6Tw2JCkuacQsKGIKfBKJVuJun3mVZd4fBmziCCKd3EYBgTZzzi5HmIl uVjFR2lmHE7V1VVAJxxZtQgxDC7l0gcHGGaGx9rCYOb_ig97MUhGWzrWQJTm oKEVhCZZLMdaCRxW9gcUmSCt00WCV9YV..YvbzJck1jQIzkCbg91JNShSg0b rWepr3n7tNZjcHF.QdyKGKiRKZs57J1Qb5TTmJslPHqzD28ujaphvqQweRwF VO2FVw9ZwdzZjUJ8ocIqyjmQXF_GoO4bKiZjVM.VFmzar5pysnU0yFDFKNfZ hboJLxqqMcY.E_E8a1Fi3M_kBSqQy1_QO_rrjXRikF_hHzWvmaa3ahYkmmeY v_tbWWH_PuIoiJuLyK0EltLUtux_CHk7AukmYO23CGWSOXsGXP1OnAN1UffH K7cF4KKzCC6CS9WEytVEzxi3s8xFJK1t9lYCnweKy32CLCA-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303746 - head/usr.bin/indent To: Ed Schouten References: <201608041527.u74FR9xo083057@repo.freebsd.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <54ec1a67-177b-9fb7-ad2a-b3f371926cc5@FreeBSD.org> Date: Sat, 6 Aug 2016 15:18:23 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2016 21:14:22 -0000 On 06/08/2016 15:13, Ed Schouten wrote: > Hi Pedro, > > 2016-08-04 17:27 GMT+02:00 Pedro F. Giffuni : >> Log: >> indent(1): Use bsearch() for looking up type keywords. > You're never doing any deletions, right? Would it make more sense to > use hsearch_r() in that case? > Indeed, good idea, although it may be an issue if portability to Windows is desired. BCC'ing author. Pedro.