From owner-svn-src-head@freebsd.org Sun Sep 24 00:10:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CE3AE14FA8; Sun, 24 Sep 2017 00:10:14 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from mail142c7.megamailservers.com (mail542c7.megamailservers.com [209.235.141.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22BB33FCE; Sun, 24 Sep 2017 00:10:13 +0000 (UTC) (envelope-from shurd@sasktel.net) X-Authenticated-User: hurds.sasktel.net X-VIP: 69.49.109.87 Received: from [192.168.0.33] (ip72-194-73-141.oc.oc.cox.net [72.194.73.141]) (authenticated bits=0) by mail142c7.megamailservers.com (8.14.9/8.13.1) with ESMTP id v8NNkkIM027188; Sat, 23 Sep 2017 19:46:49 -0400 Subject: Re: svn commit: r323942 - head/sys/net To: "Bjoern A. Zeeb" Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> From: Stephen Hurd Message-ID: <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> Date: Sat, 23 Sep 2017 16:46:46 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 In-Reply-To: <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CTCH-RefID: str=0001.0A020201.59C6F26A.007E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.2 cv=F7AnTupN c=1 sm=1 tr=0 a=l4Y+EJuLrT/8f1z5FvEQ1g==:117 a=l4Y+EJuLrT/8f1z5FvEQ1g==:17 a=IkcTkHD0fZMA:10 a=6I5d2MoRAAAA:8 a=GtM8sYFC6DhVkiSUIvIA:9 a=QEXdDO2ut3YA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 00:10:14 -0000 Bjoern A. Zeeb wrote: > On 23 Sep 2017, at 6:32, Stephen Hurd wrote: > >> Bjoern A. Zeeb wrote: >>> On 23 Sep 2017, at 1:35, Stephen Hurd wrote: >>> >>>> Author: shurd >>>> Date: Sat Sep 23 01:35:14 2017 >>>> New Revision: 323942 >>>> URL: https://svnweb.freebsd.org/changeset/base/323942 >>>> >>>> Log: >>>> Chain mbufs before passing to if_input() >>>> >>>> Build a list of mbufs to pass to if_input() after LRO. Results in >>>> 12% small packet forwarding rate improvement. >>> forwarding seems a confusing word here.. >> >> The test was small (64 byte frames) received on one interface, then >> sent out on a different one using the net.inet.ip.forwarding sysctl >> (controlled via the gateway_enable setting in rc.conf). > > Then this makes no sense as we don’t do LRO if forwarding is enabled > on the machine; > https://svnweb.freebsd.org/base/head/sys/netinet/tcp_lro.c?annotate=317390#l645 Basically, it changed from this: foreach (mbuf in rx) { if (lro && tcp_lro_rx(mbuf) == 0) continue; if_input(mbuf) } To this: prev_mbuf = first_mbuf = NULL; foreach (mbuf in rx) { if (lro && tcp_lro_rx(mbuf) == 0) continue; if (prev_mbuf) { prev_mbuf->m_nextpkt = mbuf; prev_mbuf = mbuf; } else { first_mbuf = prev_mbuf = mbuf; } } if (first_mbuf) if_input(first_mbuf); So while before it called if_input() for each separate mbuf that was not LROed, it now builds a chain of mbufs that were not LROed, and makes a single call to if_input() with the whole chain. For cases like packet forwarding where no packets are LROed, performance is better. From owner-svn-src-head@freebsd.org Sun Sep 24 00:14:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACEB5E152D8; Sun, 24 Sep 2017 00:14:49 +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 839EF6363E; Sun, 24 Sep 2017 00:14:49 +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 v8O0Emkp027549; Sun, 24 Sep 2017 00:14:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O0EmGN027547; Sun, 24 Sep 2017 00:14:48 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201709240014.v8O0EmGN027547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 24 Sep 2017 00:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323960 - head/tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/tests/sys/opencrypto X-SVN-Commit-Revision: 323960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 00:14:49 -0000 Author: ngie Date: Sun Sep 24 00:14:48 2017 New Revision: 323960 URL: https://svnweb.freebsd.org/changeset/base/323960 Log: Convert some idioms over to py3k-compatible idioms - Import print_function from __future__ and use print(..) instead of `print ..`. - Use repr instead of backticks when the object needs to be dumped, unless print(..) can do it lazily. Use str instead of backticks as appropriate for simplification reasons. This doesn't fully convert these modules over py3k. It just gets over some of the trivial compatibility hurdles. Modified: head/tests/sys/opencrypto/cryptodev.py head/tests/sys/opencrypto/cryptotest.py Modified: head/tests/sys/opencrypto/cryptodev.py ============================================================================== --- head/tests/sys/opencrypto/cryptodev.py Sun Sep 24 00:07:18 2017 (r323959) +++ head/tests/sys/opencrypto/cryptodev.py Sun Sep 24 00:14:48 2017 (r323960) @@ -30,6 +30,7 @@ # $FreeBSD$ # +from __future__ import print_function import array import dpkt from fcntl import ioctl @@ -174,9 +175,9 @@ class Crypto: if not cipher and not mac: raise ValueError('one of cipher or mac MUST be specified.') ses.crid = crid - #print `ses` + #print(ses) s = array.array('B', ses.pack_hdr()) - #print `s` + #print(s) ioctl(_cryptodev, CIOCGSESSION2, s, 1) ses.unpack(s) @@ -206,7 +207,7 @@ class Crypto: ivbuf = array.array('B', iv) cop.iv = ivbuf.buffer_info()[0] - #print 'cop:', `cop` + #print('cop:', cop) ioctl(_cryptodev, CIOCCRYPT, str(cop)) s = s.tostring() @@ -234,7 +235,8 @@ class Crypto: if tag is None: tag = array.array('B', [0] * self._maclen) else: - assert len(tag) == self._maclen, `len(tag), self._maclen` + assert len(tag) == self._maclen, \ + '%d != %d' % (len(tag), self._maclen) tag = array.array('B', tag) caead.tag = tag.buffer_info()[0] @@ -288,8 +290,8 @@ class Crypto: signal.signal(signal.SIGALRM, oldalarm) - print 'time:', end - start - print 'perf MB/sec:', (reps * size) / (end - start) / 1024 / 1024 + print('time:', end - start) + print('perf MB/sec:', (reps * size) / (end - start) / 1024 / 1024) def encrypt(self, data, iv, aad=None): if aad is None: @@ -332,7 +334,7 @@ class KATParser: if i[0] == '[': yield i[1:].split(']', 1)[0], self.fielditer() else: - raise ValueError('unknown line: %s' % `i`) + raise ValueError('unknown line: %r' % repr(i)) def eatblanks(self): while True: @@ -362,12 +364,12 @@ class KATParser: if line == 'FAIL': f, v = 'FAIL', '' else: - print 'line:', `line` + print('line:', repr(line)) raise v = v.strip() if f in values: - raise ValueError('already present: %s' % `f`) + raise ValueError('already present: %r' % repr(f)) values[f] = v line = self.fp.readline().strip() if not line: @@ -377,7 +379,7 @@ class KATParser: remain = self.fields.copy() - set(values.keys()) # XXX - special case GCM decrypt if remain and not ('FAIL' in values and 'PT' in remain): - raise ValueError('not all fields found: %s' % `remain`) + raise ValueError('not all fields found: %r' % repr(remain)) yield values @@ -388,22 +390,22 @@ if __name__ == '__main__': if True: try: crid = Crypto.findcrid('aesni0') - print 'aesni:', crid + print('aesni:', crid) except IOError: - print 'aesni0 not found' + print('aesni0 not found') for i in xrange(10): try: name = Crypto.getcridname(i) - print '%2d: %s' % (i, `name`) + print('%2d: %r' % (i, repr(name))) except IOError: pass elif False: kp = KATParser('/usr/home/jmg/aesni.testing/format tweak value input - data unit seq no/XTSGenAES128.rsp', [ 'COUNT', 'DataUnitLen', 'Key', 'DataUnitSeqNumber', 'PT', 'CT' ]) for mode, ni in kp: - print `i`, `ni` + print(i, ni) for j in ni: - print `j` + print(j) elif False: key = _spdechex('c939cc13397c1d37de6ae0e1cb7c423c') iv = _spdechex('00000000000000000000000000000001') @@ -414,15 +416,15 @@ if __name__ == '__main__': c = Crypto(CRYPTO_AES_ICM, key) enc = c.encrypt(pt, iv) - print 'enc:', enc.encode('hex') - print ' ct:', ct.encode('hex') + print('enc:', enc.encode('hex')) + print(' ct:', ct.encode('hex')) assert ct == enc dec = c.decrypt(ct, iv) - print 'dec:', dec.encode('hex') - print ' pt:', pt.encode('hex') + print('dec:', dec.encode('hex')) + print(' pt:', pt.encode('hex')) assert pt == dec elif False: @@ -435,15 +437,15 @@ if __name__ == '__main__': c = Crypto(CRYPTO_AES_ICM, key) enc = c.encrypt(pt, iv) - print 'enc:', enc.encode('hex') - print ' ct:', ct.encode('hex') + print('enc:', enc.encode('hex')) + print(' ct:', ct.encode('hex')) assert ct == enc dec = c.decrypt(ct, iv) - print 'dec:', dec.encode('hex') - print ' pt:', pt.encode('hex') + print('dec:', dec.encode('hex')) + print(' pt:', pt.encode('hex')) assert pt == dec elif False: @@ -455,15 +457,15 @@ if __name__ == '__main__': enc = c.encrypt(pt, iv) - print 'enc:', enc.encode('hex') - print ' ct:', ct.encode('hex') + print('enc:', enc.encode('hex')) + print(' ct:', ct.encode('hex')) assert ct == enc dec = c.decrypt(ct, iv) - print 'dec:', dec.encode('hex') - print ' pt:', pt.encode('hex') + print('dec:', dec.encode('hex')) + print(' pt:', pt.encode('hex')) assert pt == dec elif False: @@ -481,26 +483,26 @@ if __name__ == '__main__': enc, enctag = c.encrypt(pt, iv, aad=aad) - print 'enc:', enc.encode('hex') - print ' ct:', ct.encode('hex') + print('enc:', enc.encode('hex')) + print(' ct:', ct.encode('hex')) assert enc == ct - print 'etg:', enctag.encode('hex') - print 'tag:', tag.encode('hex') + print('etg:', enctag.encode('hex')) + print('tag:', tag.encode('hex')) assert enctag == tag # Make sure we get EBADMSG #enctag = enctag[:-1] + 'a' dec, dectag = c.decrypt(ct, iv, aad=aad, tag=enctag) - print 'dec:', dec.encode('hex') - print ' pt:', pt.encode('hex') + print('dec:', dec.encode('hex')) + print(' pt:', pt.encode('hex')) assert dec == pt - print 'dtg:', dectag.encode('hex') - print 'tag:', tag.encode('hex') + print('dtg:', dectag.encode('hex')) + print('tag:', tag.encode('hex')) assert dectag == tag elif False: @@ -517,13 +519,13 @@ if __name__ == '__main__': enc, enctag = c.encrypt(pt, iv, aad=aad) - print 'enc:', enc.encode('hex') - print ' ct:', ct.encode('hex') + print('enc:', enc.encode('hex')) + print(' ct:', ct.encode('hex')) assert enc == ct - print 'etg:', enctag.encode('hex') - print 'tag:', tag.encode('hex') + print('etg:', enctag.encode('hex')) + print('tag:', tag.encode('hex')) assert enctag == tag elif False: for i in xrange(100000): @@ -550,9 +552,9 @@ if __name__ == '__main__': else: key = '1bbfeadf539daedcae33ced497343f3ca1f2474ad932b903997d44707db41382'.decode('hex') - print 'XTS %d testing:' % (len(key) * 8) + print('XTS %d testing:' % (len(key) * 8)) c = Crypto(CRYPTO_AES_XTS, key) for i in [ 8192, 192*1024]: - print 'block size: %d' % i + print('block size: %d' % i) c.perftest(COP_ENCRYPT, i) c.perftest(COP_DECRYPT, i) Modified: head/tests/sys/opencrypto/cryptotest.py ============================================================================== --- head/tests/sys/opencrypto/cryptotest.py Sun Sep 24 00:07:18 2017 (r323959) +++ head/tests/sys/opencrypto/cryptotest.py Sun Sep 24 00:14:48 2017 (r323960) @@ -29,6 +29,7 @@ # $FreeBSD$ # +from __future__ import print_function import cryptodev import itertools import os @@ -57,17 +58,17 @@ def GenTestCase(cname): ############### ##### AES ##### ############### - @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % `cname`) + @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % (cname)) def test_xts(self): for i in katg('XTSTestVectors/format tweak value input - data unit seq no', '*.rsp'): self.runXTS(i, cryptodev.CRYPTO_AES_XTS) - @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % `cname`) + @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % (cname)) def test_cbc(self): for i in katg('KAT_AES', 'CBC[GKV]*.rsp'): self.runCBC(i) - @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % `cname`) + @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % (cname)) def test_gcm(self): for i in katg('gcmtestvectors', 'gcmEncrypt*'): self.runGCM(i, 'ENCRYPT') @@ -88,7 +89,7 @@ def GenTestCase(cname): swapptct = True curfun = Crypto.decrypt else: - raise RuntimeError('unknown mode: %s' % `mode`) + raise RuntimeError('unknown mode: %r' % repr(mode)) for bogusmode, lines in cryptodev.KATParser(fname, [ 'Count', 'Key', 'IV', 'CT', 'AAD', 'Tag', 'PT', ]): @@ -116,8 +117,8 @@ def GenTestCase(cname): rtag = rtag[:len(tag)] data['rct'] = rct.encode('hex') data['rtag'] = rtag.encode('hex') - self.assertEqual(rct, ct, `data`) - self.assertEqual(rtag, tag, `data`) + self.assertEqual(rct, ct, repr(data)) + self.assertEqual(rtag, tag, repr(data)) else: if len(tag) != 16: continue @@ -130,7 +131,7 @@ def GenTestCase(cname): data['rpt'] = rpt.encode('hex') data['rtag'] = rtag.encode('hex') self.assertEqual(rpt, pt, - `data`) + repr(data)) def runCBC(self, fname): curfun = None @@ -143,7 +144,7 @@ def GenTestCase(cname): swapptct = True curfun = Crypto.decrypt else: - raise RuntimeError('unknown mode: %s' % `mode`) + raise RuntimeError('unknown mode: %r' % repr(mode)) for data in lines: curcnt = int(data['COUNT']) @@ -171,7 +172,7 @@ def GenTestCase(cname): swapptct = True curfun = Crypto.decrypt else: - raise RuntimeError('unknown mode: %s' % `mode`) + raise RuntimeError('unknown mode: %r' % repr(mode)) for data in lines: curcnt = int(data['COUNT']) @@ -194,7 +195,7 @@ def GenTestCase(cname): ############### ##### DES ##### ############### - @unittest.skipIf(cname not in desmodules, 'skipping DES on %s' % `cname`) + @unittest.skipIf(cname not in desmodules, 'skipping DES on %s' % (cname)) def test_tdes(self): for i in katg('KAT_TDES', 'TCBC[a-z]*.rsp'): self.runTDES(i) @@ -210,7 +211,7 @@ def GenTestCase(cname): swapptct = True curfun = Crypto.decrypt else: - raise RuntimeError('unknown mode: %s' % `mode`) + raise RuntimeError('unknown mode: %r' % repr(mode)) for data in lines: curcnt = int(data['COUNT']) @@ -230,14 +231,14 @@ def GenTestCase(cname): ############### ##### SHA ##### ############### - @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' % `cname`) + @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' % str(cname)) def test_sha(self): # SHA not available in software pass #for i in iglob('SHA1*'): # self.runSHA(i) - @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' % `cname`) + @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' % str(cname)) def test_sha1hmac(self): for i in katg('hmactestvectors', 'HMAC.rsp'): self.runSHA1HMAC(i) From owner-svn-src-head@freebsd.org Sun Sep 24 02:51:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A419E17FB0; Sun, 24 Sep 2017 02:51:01 +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 2A90266739; Sun, 24 Sep 2017 02:51:01 +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 v8O2p0US088078; Sun, 24 Sep 2017 02:51:00 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O2p0j4088076; Sun, 24 Sep 2017 02:51:00 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709240251.v8O2p0j4088076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 24 Sep 2017 02:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323961 - head/sys/dev/ti X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/dev/ti X-SVN-Commit-Revision: 323961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 02:51:01 -0000 Author: alc Date: Sun Sep 24 02:50:59 2017 New Revision: 323961 URL: https://svnweb.freebsd.org/changeset/base/323961 Log: Since the page "frame" doesn't belong to a vm object, it can't be paged out. Since it can't be paged out, it is never actually enqueued in a paging queue. Nonetheless, passing PQ_INACTIVE to vm_page_unwire() creates the appearance that the page "frame" is being enqueued in the inactive queue. As of r288122, we can avoid this false impression by passing PQ_NONE. MFC after: 1 week Modified: head/sys/dev/ti/if_ti.c Modified: head/sys/dev/ti/if_ti.c ============================================================================== --- head/sys/dev/ti/if_ti.c Sun Sep 24 00:14:48 2017 (r323960) +++ head/sys/dev/ti/if_ti.c Sun Sep 24 02:50:59 2017 (r323961) @@ -1621,7 +1621,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct m } sf[i] = sf_buf_alloc(frame, SFB_NOWAIT); if (sf[i] == NULL) { - vm_page_unwire(frame, PQ_INACTIVE); + vm_page_unwire(frame, PQ_NONE); vm_page_free(frame); device_printf(sc->ti_dev, "buffer allocation " "failed -- packet dropped!\n"); From owner-svn-src-head@freebsd.org Sun Sep 24 03:33:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6627BE18DFC; Sun, 24 Sep 2017 03:33:28 +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 2FFD367B79; Sun, 24 Sep 2017 03:33:28 +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 v8O3XRTE009113; Sun, 24 Sep 2017 03:33:27 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O3XRot009112; Sun, 24 Sep 2017 03:33:27 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201709240333.v8O3XRot009112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 24 Sep 2017 03:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323962 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 323962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 03:33:28 -0000 Author: cy Date: Sun Sep 24 03:33:26 2017 New Revision: 323962 URL: https://svnweb.freebsd.org/changeset/base/323962 Log: Fix typo from r323945. Reported by: Gary Jennejohn Point hat to: cy (me) Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Sun Sep 24 02:50:59 2017 (r323961) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Sun Sep 24 03:33:26 2017 (r323962) @@ -6093,7 +6093,7 @@ ipf_nat_icmpquerytype(icmptype) { case ICMP_ECHOREPLY: case ICMP_ECHO: - /* route advertisement/soliciation is currently unsupported: */ + /* route advertisement/solicitation is currently unsupported: */ /* it would require rewriting the ICMP data section */ case ICMP_TSTAMP: case ICMP_TSTAMPREPLY: From owner-svn-src-head@freebsd.org Sun Sep 24 05:03:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29297E1F25A; Sun, 24 Sep 2017 05:03:59 +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 E48F169DB7; Sun, 24 Sep 2017 05:03:58 +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 v8O53wh3045522; Sun, 24 Sep 2017 05:03:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O53wNS045521; Sun, 24 Sep 2017 05:03:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709240503.v8O53wNS045521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 24 Sep 2017 05:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323963 - head/contrib/one-true-awk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/one-true-awk X-SVN-Commit-Revision: 323963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 05:03:59 -0000 Author: imp Date: Sun Sep 24 05:03:57 2017 New Revision: 323963 URL: https://svnweb.freebsd.org/changeset/base/323963 Log: Fix uninitialized variable echo | awk 'BEGIN {i=$1; print i}' prints a boatload of stack garbage. NUL terminate the memory returned from malloc to prevent it. Obtained from: OpenBSD run.c 1.40 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D12379 Modified: head/contrib/one-true-awk/lib.c Modified: head/contrib/one-true-awk/lib.c ============================================================================== --- head/contrib/one-true-awk/lib.c Sun Sep 24 03:33:26 2017 (r323962) +++ head/contrib/one-true-awk/lib.c Sun Sep 24 05:03:57 2017 (r323963) @@ -62,6 +62,7 @@ void recinit(unsigned int n) || (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL || (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL ) FATAL("out of space for $0 and fields"); + *record = '\0'; *fldtab[0] = dollar0; fldtab[0]->sval = record; fldtab[0]->nval = tostring("0"); From owner-svn-src-head@freebsd.org Sun Sep 24 05:04:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BBD0E1F281; Sun, 24 Sep 2017 05:04:03 +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 3727F69DC3; Sun, 24 Sep 2017 05:04:03 +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 v8O542xh045577; Sun, 24 Sep 2017 05:04:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O5424E045576; Sun, 24 Sep 2017 05:04:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709240504.v8O5424E045576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 24 Sep 2017 05:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323964 - head/contrib/one-true-awk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/one-true-awk X-SVN-Commit-Revision: 323964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 05:04:03 -0000 Author: imp Date: Sun Sep 24 05:04:02 2017 New Revision: 323964 URL: https://svnweb.freebsd.org/changeset/base/323964 Log: Fix %c for floating values that become 0 when coerced to int. Obtained from: OpenBSD run.c 1.36 (From Jeremy Devenport) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D12379 Modified: head/contrib/one-true-awk/run.c Modified: head/contrib/one-true-awk/run.c ============================================================================== --- head/contrib/one-true-awk/run.c Sun Sep 24 05:03:57 2017 (r323963) +++ head/contrib/one-true-awk/run.c Sun Sep 24 05:04:02 2017 (r323964) @@ -918,7 +918,7 @@ int format(char **pbuf, int *pbufsize, const char *s, break; case 'c': if (isnum(x)) { - if (getfval(x)) + if ((int)getfval(x)) sprintf(p, fmt, (int) getfval(x)); else { *p++ = '\0'; /* explicit null byte */ From owner-svn-src-head@freebsd.org Sun Sep 24 05:04:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D8D7E1F2AD; Sun, 24 Sep 2017 05:04:08 +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 CC73D69E28; Sun, 24 Sep 2017 05:04:07 +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 v8O546FG045631; Sun, 24 Sep 2017 05:04:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O546Ob045630; Sun, 24 Sep 2017 05:04:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709240504.v8O546Ob045630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 24 Sep 2017 05:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323965 - head/contrib/one-true-awk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/one-true-awk X-SVN-Commit-Revision: 323965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 05:04:08 -0000 Author: imp Date: Sun Sep 24 05:04:06 2017 New Revision: 323965 URL: https://svnweb.freebsd.org/changeset/base/323965 Log: Don't display empty error context. Context extraction didn't handle this case and showed uninitialized memory. Obtained from: OpenBSD lib.c 1.21 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D12379 Modified: head/contrib/one-true-awk/lib.c Modified: head/contrib/one-true-awk/lib.c ============================================================================== --- head/contrib/one-true-awk/lib.c Sun Sep 24 05:04:02 2017 (r323964) +++ head/contrib/one-true-awk/lib.c Sun Sep 24 05:04:06 2017 (r323965) @@ -617,7 +617,7 @@ void eprint(void) /* try to print context around error static int been_here = 0; extern char ebuf[], *ep; - if (compile_time == 2 || compile_time == 0 || been_here++ > 0) + if (compile_time == 2 || compile_time == 0 || been_here++ > 0 || ebuf == ep) return; p = ep - 1; if (p > ebuf && *p == '\n') From owner-svn-src-head@freebsd.org Sun Sep 24 08:53:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3907E23224; Sun, 24 Sep 2017 08:53:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 692066EC35; Sun, 24 Sep 2017 08:53:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A86722601A9; Sun, 24 Sep 2017 10:52:59 +0200 (CEST) Subject: Re: svn commit: r323942 - head/sys/net To: Stephen Hurd , "Bjoern A. Zeeb" Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> From: Hans Petter Selasky Message-ID: <3601ee57-2bf5-036a-a3d1-a4795847d0ec@selasky.org> Date: Sun, 24 Sep 2017 10:50:29 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 08:53:04 -0000 On 09/24/17 01:46, Stephen Hurd wrote: > Bjoern A. Zeeb wrote: >> On 23 Sep 2017, at 6:32, Stephen Hurd wrote: >> >>> Bjoern A. Zeeb wrote: >>>> On 23 Sep 2017, at 1:35, Stephen Hurd wrote: >>>> >>>>> Author: shurd >>>>> Date: Sat Sep 23 01:35:14 2017 >>>>> New Revision: 323942 >>>>> URL: https://svnweb.freebsd.org/changeset/base/323942 >>>>> >>>>> Log: >>>>>    Chain mbufs before passing to if_input() >>>>> >>>>>    Build a list of mbufs to pass to if_input() after LRO. Results in >>>>>    12% small packet forwarding rate improvement. >>>> forwarding seems a confusing word here.. >>> >>> The test was small (64 byte frames) received on one interface, then >>> sent out on a different one using the net.inet.ip.forwarding sysctl >>> (controlled via the gateway_enable setting in rc.conf). >> >> Then this makes no sense as we don’t do LRO if forwarding is enabled >> on the machine; >> https://svnweb.freebsd.org/base/head/sys/netinet/tcp_lro.c?annotate=317390#l645 >> > > Basically, it changed from this: > > foreach (mbuf in rx) { >   if (lro && tcp_lro_rx(mbuf) == 0) >     continue; >   if_input(mbuf) > } > > To this: > > prev_mbuf = first_mbuf = NULL; > foreach (mbuf in rx) { >   if (lro && tcp_lro_rx(mbuf) == 0) >     continue; >   if (prev_mbuf) { >     prev_mbuf->m_nextpkt = mbuf; >     prev_mbuf = mbuf; >   } >   else { >     first_mbuf = prev_mbuf = mbuf; >   } > } > > if (first_mbuf) >   if_input(first_mbuf); > > So while before it called if_input() for each separate mbuf that was not > LROed, it now builds a chain of mbufs that were not LROed, and makes a > single call to if_input() with the whole chain.  For cases like packet > forwarding where no packets are LROed, performance is better. > Can such a similar logic be applied inside TCP LRO aswell? --HPS From owner-svn-src-head@freebsd.org Sun Sep 24 09:05:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 448D3E236EA; Sun, 24 Sep 2017 09:05:37 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E4F56F1B6; Sun, 24 Sep 2017 09:05:37 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8O95aQZ043423; Sun, 24 Sep 2017 09:05:36 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O95ZOY043417; Sun, 24 Sep 2017 09:05:35 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201709240905.v8O95ZOY043417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Sun, 24 Sep 2017 09:05:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323966 - in head/sys: arm/broadcom/bcm2835 arm/ti dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 arm/ti dev/sdhci X-SVN-Commit-Revision: 323966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 09:05:37 -0000 Author: kibab Date: Sun Sep 24 09:05:35 2017 New Revision: 323966 URL: https://svnweb.freebsd.org/changeset/base/323966 Log: Rename sdhci_cam_start_slot() into sdhci_start_slot() This change allows to just call sdhci_start_slot() in SDHCI drivers and not to think about which stack handles the operation. As a side effect, this will also fix MMCCAM with sdhci_acpi driver. Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D12471 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c head/sys/arm/ti/ti_sdhci.c head/sys/dev/sdhci/fsl_sdhci.c head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_pci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Sep 24 05:04:06 2017 (r323965) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Sep 24 09:05:35 2017 (r323966) @@ -255,11 +255,7 @@ bcm_sdhci_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); -#ifdef MMCCAM - sdhci_cam_start_slot(&sc->sc_slot); -#else sdhci_start_slot(&sc->sc_slot); -#endif return (0); Modified: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- head/sys/arm/ti/ti_sdhci.c Sun Sep 24 05:04:06 2017 (r323965) +++ head/sys/arm/ti/ti_sdhci.c Sun Sep 24 09:05:35 2017 (r323966) @@ -683,11 +683,7 @@ ti_sdhci_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); -#ifdef MMCCAM - sdhci_cam_start_slot(&sc->slot); -#else sdhci_start_slot(&sc->slot); -#endif return (0); fail: Modified: head/sys/dev/sdhci/fsl_sdhci.c ============================================================================== --- head/sys/dev/sdhci/fsl_sdhci.c Sun Sep 24 05:04:06 2017 (r323965) +++ head/sys/dev/sdhci/fsl_sdhci.c Sun Sep 24 09:05:35 2017 (r323966) @@ -913,11 +913,7 @@ fsl_sdhci_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); -#ifdef MMCCAM - sdhci_cam_start_slot(&sc->slot); -#else sdhci_start_slot(&sc->slot); -#endif return (0); Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Sep 24 05:04:06 2017 (r323965) +++ head/sys/dev/sdhci/sdhci.c Sun Sep 24 09:05:35 2017 (r323966) @@ -1051,12 +1051,14 @@ no_tuning: return (0); } +#ifndef MMCCAM void sdhci_start_slot(struct sdhci_slot *slot) { sdhci_card_task(slot, 0); } +#endif int sdhci_cleanup_slot(struct sdhci_slot *slot) @@ -2383,7 +2385,7 @@ sdhci_generic_write_ivar(device_t bus, device_t child, #ifdef MMCCAM void -sdhci_cam_start_slot(struct sdhci_slot *slot) +sdhci_start_slot(struct sdhci_slot *slot) { if ((slot->devq = cam_simq_alloc(1)) == NULL) { goto fail; Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Sun Sep 24 05:04:06 2017 (r323965) +++ head/sys/dev/sdhci/sdhci.h Sun Sep 24 09:05:35 2017 (r323966) @@ -430,9 +430,4 @@ bool sdhci_generic_get_card_present(device_t brdev, st void sdhci_generic_set_uhs_timing(device_t brdev, struct sdhci_slot *slot); void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present); -#ifdef MMCCAM -/* CAM-related */ -void sdhci_cam_start_slot(struct sdhci_slot *slot); -#endif - #endif /* __SDHCI_H__ */ Modified: head/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- head/sys/dev/sdhci/sdhci_pci.c Sun Sep 24 05:04:06 2017 (r323965) +++ head/sys/dev/sdhci/sdhci_pci.c Sun Sep 24 09:05:35 2017 (r323966) @@ -395,11 +395,7 @@ sdhci_pci_attach(device_t dev) pci_enable_busmaster(dev); /* Process cards detection. */ for (i = 0; i < sc->num_slots; i++) { -#ifdef MMCCAM - sdhci_cam_start_slot(&sc->slots[i]); -#else sdhci_start_slot(&sc->slots[i]); -#endif } return (0); From owner-svn-src-head@freebsd.org Sun Sep 24 09:33:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB68EE23DA5; Sun, 24 Sep 2017 09:33:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA8806FE01; Sun, 24 Sep 2017 09:33:09 +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 v8O9X89i055902; Sun, 24 Sep 2017 09:33:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8O9X8VS055900; Sun, 24 Sep 2017 09:33:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201709240933.v8O9X8VS055900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 Sep 2017 09:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323967 - in head/sys/arm: conf freescale/imx X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm: conf freescale/imx X-SVN-Commit-Revision: 323967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 09:33:10 -0000 Author: andrew Date: Sun Sep 24 09:33:08 2017 New Revision: 323967 URL: https://svnweb.freebsd.org/changeset/base/323967 Log: Add i.MX6 and Xilinx to GENERIC. Merge in the missing devices from the IMX6 and ZEDBOARD kernel configs. The Freescale sdma device has been renamed to fslsdma to mark it as a platform specific driver. Reviewed by: ian Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11564 Modified: head/sys/arm/conf/GENERIC head/sys/arm/freescale/imx/files.imx6 Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sun Sep 24 09:05:35 2017 (r323966) +++ head/sys/arm/conf/GENERIC Sun Sep 24 09:33:08 2017 (r323967) @@ -40,11 +40,13 @@ files "../allwinner/a83t/files.a83t" files "../allwinner/h3/files.h3" files "../broadcom/bcm2835/files.bcm2836" files "../broadcom/bcm2835/files.bcm283x" +files "../freescale/imx/files.imx6" files "../nvidia/tegra124/files.tegra124" files "../qemu/files.qemu" files "../ti/files.ti" files "../ti/am335x/files.am335x" files "../ti/omap4/files.omap4" +files "../xilinx/files.zynq7" options SOC_ALLWINNER_A10 options SOC_ALLWINNER_A13 @@ -116,6 +118,7 @@ device pty device snp device md # Memory "disks" device random # Entropy device +device firmware # firmware assist module device pl310 # PL310 L2 cache controller device psci @@ -128,6 +131,7 @@ device p2wi # Allwinner Push-Pull Two Wire device axp209 # AXP209 Power Management Unit device axp81x # AXP813/818 Power Management Unit device bcm2835_bsc +device fsliic # Freescale i2c/iic device icee # AT24Cxxx and compatible EEPROMs device sy8106a # SY8106A Buck Regulator device ti_i2c @@ -171,6 +175,7 @@ device ti_adc # reboot automatically because the boot loader might have enabled the # watchdog. device ti_wdt +device imxwdt # Watchdog. WARNING: can't be disabled!!! device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) @@ -186,6 +191,7 @@ device ehci device dwcotg # DWC OTG controller device musb +device axe # USB-Ethernet device umass # Disks/Mass storage - Requires scbus and da device uhid # "Human Interface Devices" device ukbd # Allow keyboard like HIDs to control console @@ -205,8 +211,10 @@ device miibus device awg # 10/100/1000 integrated EMAC controller device cpsw # TI Common Platform Ethernet Switch (CPSW) +device cgem # Zynq-7000 gig ethernet device device dwc # 10/100/1000 integrated GMAC controller device emac # 10/100 integrated EMAC controller +device ffec # Freescale Fast Ethernet Controller device smsc # SMSC LAN91C111 # Sound support @@ -230,6 +238,7 @@ device ti_pruss device ti_mbox # DMA controller +device fslsdma device ti_sdma # Extensible Firmware Interface @@ -237,4 +246,4 @@ options EFI # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/nvidia dtb/rpi dtb/omap4" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/imx6 dtb/nvidia dtb/rpi dtb/zynq dtb/omap4" Modified: head/sys/arm/freescale/imx/files.imx6 ============================================================================== --- head/sys/arm/freescale/imx/files.imx6 Sun Sep 24 09:05:35 2017 (r323966) +++ head/sys/arm/freescale/imx/files.imx6 Sun Sep 24 09:33:08 2017 (r323967) @@ -22,7 +22,7 @@ arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx_gpt.c optional imx_gpt arm/freescale/imx/imx_gpio.c optional gpio arm/freescale/imx/imx_i2c.c optional fsliic -arm/freescale/imx/imx6_sdma.c optional sdma +arm/freescale/imx/imx6_sdma.c optional fslsdma arm/freescale/imx/imx6_audmux.c optional sound arm/freescale/imx/imx6_ssi.c optional sound arm/freescale/imx/imx6_ahci.c optional ahci From owner-svn-src-head@freebsd.org Sun Sep 24 13:14:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCCA0E2824D; Sun, 24 Sep 2017 13:14:51 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5247756B5; Sun, 24 Sep 2017 13:14:51 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8ODEox8046589; Sun, 24 Sep 2017 13:14:50 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ODEoi0046585; Sun, 24 Sep 2017 13:14:50 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709241314.v8ODEoi0046585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 24 Sep 2017 13:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323969 - in head: share/man/man4 sys/dev/mpr sys/dev/mps X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/mpr sys/dev/mps X-SVN-Commit-Revision: 323969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 13:14:52 -0000 Author: scottl Date: Sun Sep 24 13:14:50 2017 New Revision: 323969 URL: https://svnweb.freebsd.org/changeset/base/323969 Log: Add the ability to report and set debug flags as text strings instead of just integer flags. Report both for convenience. Submitted by: Eygene Ryabinkin (manpage) Sponsored by: Netflix Modified: head/share/man/man4/mpr.4 head/share/man/man4/mps.4 head/sys/dev/mpr/mpr.c head/sys/dev/mps/mps.c Modified: head/share/man/man4/mpr.4 ============================================================================== --- head/share/man/man4/mpr.4 Sun Sep 24 12:53:33 2017 (r323968) +++ head/share/man/man4/mpr.4 Sun Sep 24 13:14:50 2017 (r323969) @@ -337,31 +337,41 @@ dev.mpr.X.use_phy_num The same set of values are valid as when setting this tunable for all adapters. .Pp .Sh DEBUGGING -To enable debugging prints from the -.Nm -driver, set the -.Bd -literal -offset indent -hw.mpr.X.debug_level -.Ed -.Pp -tunable, either in +Driver diagnostic printing is controlled in .Xr loader.conf 5 -or by using -.Xr sysctl 8 . -These bits have the described effects: -.Bd -literal -offset indent -0x0001 Enable informational prints (set by default). -0x0002 Enable prints for driver faults (set by default). -0x0004 Enable prints for controller events. -0x0008 Enable prints for controller logging. -0x0010 Enable prints for tracing recovery operations. -0x0020 Enable prints for parameter errors and programming bugs. -0x0040 Enable prints for system initialization operations. -0x0080 Enable prints for more detailed information. -0x0100 Enable prints for user-generated commands (IOCTL). -0x0200 Enable prints for device mapping. -0x0400 Enable prints for tracing through driver functions. -.Ed +by using the global +.Va hw.mpr.debug_level +and per-device +.Va dev.mpr.X.debug_level +tunables. +One can alter the debug level for any adapter at run-time using the +.Xr sysctl 8 +variable +.Va dev.mpr.X.debug_level . +.Pp +All +.Va debug_level +variables can be named by either an integer value or a text string. +Multiple values can be specified together by either ORing the +integer values or by providing a comma-separated list of names. +The current +.Va debug_level +status is reported in both formats for convenience. +The following levels are available: +.Bl -column "FlagXX" "NameXXXX" "Description" -offset indent +.It Em Flag Ta Em Name Ta Em Description +.It 0x0001 Ta info Ta Basic information (enabled by default) +.It 0x0002 Ta fault Ta Driver faults (enabled by default) +.It 0x0004 Ta event Ta Controller events +.It 0x0008 Ta log Ta Logging data from controller +.It 0x0010 Ta recovery Ta Tracing of recovery operations +.It 0x0020 Ta error Ta Parameter errors and programming bugs +.It 0x0040 Ta init Ta System initialization operations +.It 0x0080 Ta xinfo Ta More detailed information +.It 0x0100 Ta user Ta Tracing of user-generated commands (IOCTL) +.It 0x0200 Ta mapping Ta Tracing of device mapping +.It 0x0400 Ta trace Ta Tracing through driver functions +.El .Sh SEE ALSO .Xr cam 4 , .Xr cd 4 , Modified: head/share/man/man4/mps.4 ============================================================================== --- head/share/man/man4/mps.4 Sun Sep 24 12:53:33 2017 (r323968) +++ head/share/man/man4/mps.4 Sun Sep 24 13:14:50 2017 (r323969) @@ -313,31 +313,41 @@ dev.mps.X.use_phy_num The same set of values are valid as when setting this tunable for all adapters. .Pp .Sh DEBUGGING -To enable debugging prints from the -.Nm -driver, set the -.Bd -literal -offset indent -hw.mps.X.debug_level -.Ed -.Pp -tunable, either in +Driver diagnostic printing is controlled in .Xr loader.conf 5 -or by using -.Xr sysctl 8 . -These bits have the described effects: -.Bd -literal -offset indent -0x0001 Enable informational prints (set by default). -0x0002 Enable prints for driver faults (set by default). -0x0004 Enable prints for controller events. -0x0008 Enable prints for controller logging. -0x0010 Enable prints for tracing recovery operations. -0x0020 Enable prints for parameter errors and programming bugs. -0x0040 Enable prints for system initialization operations. -0x0080 Enable prints for more detailed information. -0x0100 Enable prints for user-generated commands (IOCTL). -0x0200 Enable prints for device mapping. -0x0400 Enable prints for tracing through driver functions. -.Ed +by using the global +.Va hw.mps.debug_level +and per-device +.Va dev.mps.X.debug_level +tunables. +One can alter the debug level for any adapter at run-time using the +.Xr sysctl 8 +variable +.Va dev.mps.X.debug_level . +.Pp +All +.Va debug_level +variables can be named by either an integer value or a text string. +Multiple values can be specified together by either ORing the +integer values or by providing a comma-separated list of names. +The current +.Va debug_level +status is reported in both formats for convenience. +The following levels are available: +.Bl -column "FlagXX" "NameXXXX" "Description" -offset indent +.It Em Flag Ta Em Name Ta Em Description +.It 0x0001 Ta info Ta Basic information (enabled by default) +.It 0x0002 Ta fault Ta Driver faults (enabled by default) +.It 0x0004 Ta event Ta Controller events +.It 0x0008 Ta log Ta Logging data from controller +.It 0x0010 Ta recovery Ta Tracing of recovery operations +.It 0x0020 Ta error Ta Parameter errors and programming bugs +.It 0x0040 Ta init Ta System initialization operations +.It 0x0080 Ta xinfo Ta More detailed information +.It 0x0100 Ta user Ta Tracing of user-generated commands (IOCTL) +.It 0x0200 Ta mapping Ta Tracing of device mapping +.It 0x0400 Ta trace Ta Tracing through driver functions +.El .Sh SEE ALSO .Xr cam 4 , .Xr cd 4 , Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Sun Sep 24 12:53:33 2017 (r323968) +++ head/sys/dev/mpr/mpr.c Sun Sep 24 13:14:50 2017 (r323969) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -105,6 +106,9 @@ static int mpr_reregister_events(struct mpr_softc *sc) static void mpr_enqueue_request(struct mpr_softc *sc, struct mpr_command *cm); static int mpr_get_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts); static int mpr_wait_db_ack(struct mpr_softc *sc, int timeout, int sleep_flag); +static int mpr_debug_sysctl(SYSCTL_HANDLER_ARGS); +static void mpr_parse_debug(struct mpr_softc *sc, char *list); + SYSCTL_NODE(_hw, OID_AUTO, mpr, CTLFLAG_RD, 0, "MPR Driver Parameters"); MALLOC_DEFINE(M_MPR, "mpr", "mpr driver memory"); @@ -1591,7 +1595,7 @@ mpr_init_queues(struct mpr_softc *sc) void mpr_get_tunables(struct mpr_softc *sc) { - char tmpstr[80]; + char tmpstr[80], mpr_debug[80]; /* XXX default to some debugging for now */ sc->mpr_debug = MPR_INFO | MPR_FAULT; @@ -1611,7 +1615,9 @@ mpr_get_tunables(struct mpr_softc *sc) /* * Grab the global variables. */ - TUNABLE_INT_FETCH("hw.mpr.debug_level", &sc->mpr_debug); + bzero(mpr_debug, 80); + if (TUNABLE_STR_FETCH("hw.mpr.debug_level", mpr_debug, 80) != 0) + mpr_parse_debug(sc, mpr_debug); TUNABLE_INT_FETCH("hw.mpr.disable_msix", &sc->disable_msix); TUNABLE_INT_FETCH("hw.mpr.disable_msi", &sc->disable_msi); TUNABLE_INT_FETCH("hw.mpr.max_msix", &sc->max_msix); @@ -1628,7 +1634,9 @@ mpr_get_tunables(struct mpr_softc *sc) /* Grab the unit-instance variables */ snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.debug_level", device_get_unit(sc->mpr_dev)); - TUNABLE_INT_FETCH(tmpstr, &sc->mpr_debug); + bzero(mpr_debug, 80); + if (TUNABLE_STR_FETCH(tmpstr, mpr_debug, 80) != 0) + mpr_parse_debug(sc, mpr_debug); snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.disable_msix", device_get_unit(sc->mpr_dev)); @@ -1714,9 +1722,9 @@ mpr_setup_sysctl(struct mpr_softc *sc) sysctl_tree = sc->sysctl_tree; } - SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "debug_level", CTLFLAG_RW, &sc->mpr_debug, 0, - "mpr debug level"); + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "debug_level", CTLTYPE_STRING | CTLFLAG_RW, sc, 0, + mpr_debug_sysctl, "A", "mpr debug level"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "disable_msix", CTLFLAG_RD, &sc->disable_msix, 0, @@ -1807,6 +1815,104 @@ mpr_setup_sysctl(struct mpr_softc *sc) SYSCTL_ADD_UQUAD(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "prp_page_alloc_fail", CTLFLAG_RD, &sc->prp_page_alloc_fail, "PRP page allocation failures"); +} + +static struct mpr_debug_string { + char *name; + int flag; +} mpr_debug_strings[] = { + {"info", MPR_INFO}, + {"fault", MPR_FAULT}, + {"event", MPR_EVENT}, + {"log", MPR_LOG}, + {"recovery", MPR_RECOVERY}, + {"error", MPR_ERROR}, + {"init", MPR_INIT}, + {"xinfo", MPR_XINFO}, + {"user", MPR_USER}, + {"mapping", MPR_MAPPING}, + {"trace", MPR_TRACE} +}; + +static int +mpr_debug_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct mpr_softc *sc; + struct mpr_debug_string *string; + struct sbuf sbuf; + char *buffer; + size_t sz; + int i, len, debug, error; + + sc = (struct mpr_softc *)arg1; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + debug = sc->mpr_debug; + + sbuf_printf(&sbuf, "%#x", debug); + + sz = sizeof(mpr_debug_strings) / sizeof(mpr_debug_strings[0]); + for (i = 0; i < sz; i++) { + string = &mpr_debug_strings[i]; + if (debug & string->flag) + sbuf_printf(&sbuf, ",%s", string->name); + } + + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + + if (error || req->newptr == NULL) + return (error); + + len = req->newlen - req->newidx; + if (len == 0) + return (0); + + buffer = malloc(len, M_MPR, M_ZERO|M_WAITOK); + error = SYSCTL_IN(req, buffer, len); + + mpr_parse_debug(sc, buffer); + + free(buffer, M_MPR); + return (error); +} + +static void +mpr_parse_debug(struct mpr_softc *sc, char *list) +{ + struct mpr_debug_string *string; + char *token, *endtoken; + size_t sz; + int flags, i; + + if (list == NULL || *list == '\0') + return; + + flags = 0; + sz = sizeof(mpr_debug_strings) / sizeof(mpr_debug_strings[0]); + while ((token = strsep(&list, ":,")) != NULL) { + + /* Handle integer flags */ + flags |= strtol(token, &endtoken, 0); + if (token != endtoken) + continue; + + /* Handle text flags */ + for (i = 0; i < sz; i++) { + string = &mpr_debug_strings[i]; + if (strcasecmp(token, string->name) == 0) { + flags |= string->flag; + break; + } + } + } + + sc->mpr_debug = flags; + return; } int Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sun Sep 24 12:53:33 2017 (r323968) +++ head/sys/dev/mps/mps.c Sun Sep 24 13:14:50 2017 (r323969) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -102,6 +103,9 @@ static int mps_reregister_events(struct mps_softc *sc) static void mps_enqueue_request(struct mps_softc *sc, struct mps_command *cm); static int mps_get_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts); static int mps_wait_db_ack(struct mps_softc *sc, int timeout, int sleep_flag); +static int mps_debug_sysctl(SYSCTL_HANDLER_ARGS); +static void mps_parse_debug(struct mps_softc *sc, char *list); + SYSCTL_NODE(_hw, OID_AUTO, mps, CTLFLAG_RD, 0, "MPS Driver Parameters"); MALLOC_DEFINE(M_MPT2, "mps", "mpt2 driver memory"); @@ -1452,7 +1456,7 @@ mps_init_queues(struct mps_softc *sc) void mps_get_tunables(struct mps_softc *sc) { - char tmpstr[80]; + char tmpstr[80], mps_debug[80]; /* XXX default to some debugging for now */ sc->mps_debug = MPS_INFO|MPS_FAULT; @@ -1472,7 +1476,9 @@ mps_get_tunables(struct mps_softc *sc) /* * Grab the global variables. */ - TUNABLE_INT_FETCH("hw.mps.debug_level", &sc->mps_debug); + bzero(mps_debug, 80); + if (TUNABLE_STR_FETCH("hw.mps.debug_level", mps_debug, 80) != 0) + mps_parse_debug(sc, mps_debug); TUNABLE_INT_FETCH("hw.mps.disable_msix", &sc->disable_msix); TUNABLE_INT_FETCH("hw.mps.disable_msi", &sc->disable_msi); TUNABLE_INT_FETCH("hw.mps.max_msix", &sc->max_msix); @@ -1489,7 +1495,9 @@ mps_get_tunables(struct mps_softc *sc) /* Grab the unit-instance variables */ snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.debug_level", device_get_unit(sc->mps_dev)); - TUNABLE_INT_FETCH(tmpstr, &sc->mps_debug); + bzero(mps_debug, 80); + if (TUNABLE_STR_FETCH(tmpstr, mps_debug, 80) != 0) + mps_parse_debug(sc, mps_debug); snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.disable_msix", device_get_unit(sc->mps_dev)); @@ -1576,9 +1584,9 @@ mps_setup_sysctl(struct mps_softc *sc) sysctl_tree = sc->sysctl_tree; } - SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "debug_level", CTLFLAG_RW, &sc->mps_debug, 0, - "mps debug level"); + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "debug_level", CTLTYPE_STRING | CTLFLAG_RW, sc, 0, + mps_debug_sysctl, "A", "mps debug level"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "disable_msix", CTLFLAG_RD, &sc->disable_msix, 0, @@ -1669,6 +1677,104 @@ mps_setup_sysctl(struct mps_softc *sc) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "use_phy_num", CTLFLAG_RD, &sc->use_phynum, 0, "Use the phy number for enumeration"); +} + +struct mps_debug_string { + char *name; + int flag; +} mps_debug_strings[] = { + {"info", MPS_INFO}, + {"fault", MPS_FAULT}, + {"event", MPS_EVENT}, + {"log", MPS_LOG}, + {"recovery", MPS_RECOVERY}, + {"error", MPS_ERROR}, + {"init", MPS_INIT}, + {"xinfo", MPS_XINFO}, + {"user", MPS_USER}, + {"mapping", MPS_MAPPING}, + {"trace", MPS_TRACE} +}; + +static int +mps_debug_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct mps_softc *sc; + struct mps_debug_string *string; + struct sbuf sbuf; + char *buffer; + size_t sz; + int i, len, debug, error; + + sc = (struct mps_softc *)arg1; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + debug = sc->mps_debug; + + sbuf_printf(&sbuf, "%#x", debug); + + sz = sizeof(mps_debug_strings) / sizeof(mps_debug_strings[0]); + for (i = 0; i < sz; i++) { + string = &mps_debug_strings[i]; + if (debug & string->flag) + sbuf_printf(&sbuf, ",%s", string->name); + } + + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + + if (error || req->newptr == NULL) + return (error); + + len = req->newlen - req->newidx; + if (len == 0) + return (0); + + buffer = malloc(len, M_MPT2, M_ZERO|M_WAITOK); + error = SYSCTL_IN(req, buffer, len); + + mps_parse_debug(sc, buffer); + + free(buffer, M_MPT2); + return (error); +} + +static void +mps_parse_debug(struct mps_softc *sc, char *list) +{ + struct mps_debug_string *string; + char *token, *endtoken; + size_t sz; + int flags, i; + + if (list == NULL || *list == '\0') + return; + + flags = 0; + sz = sizeof(mps_debug_strings) / sizeof(mps_debug_strings[0]); + while ((token = strsep(&list, ":,")) != NULL) { + + /* Handle integer flags */ + flags |= strtol(token, &endtoken, 0); + if (token != endtoken) + continue; + + /* Handle text flags */ + for (i = 0; i < sz; i++) { + string = &mps_debug_strings[i]; + if (strcasecmp(token, string->name) == 0) { + flags |= string->flag; + break; + } + } + } + + sc->mps_debug = flags; + return; } int From owner-svn-src-head@freebsd.org Sun Sep 24 13:16:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3350E283B9; Sun, 24 Sep 2017 13:16:11 +0000 (UTC) (envelope-from kczekirda@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 346A67593E; Sun, 24 Sep 2017 13:16:10 +0000 (UTC) (envelope-from kczekirda@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id e64so4998132wmi.2; Sun, 24 Sep 2017 06:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=RiZCn3RWIBDDuUzB4AXJFygvWH/+I11V/uXJUKFrQmg=; b=kQnZVDElJlTvLuPFpYi9WYGHokDTcix1qSUueQtyL8lPprb/R+JiIMSc9SgzkDE/T3 SwD/zBsNQ1JXuPo6PHAeA072tsqXAx2J3Sam0YC5PLEJorJF/AUBwIgOP1QOrlqSnmcw +IDOW140d7lq4PHyIWEEfB4HFwPO1Ede5t/nppLZvnxIv6COdtlGmChGPDTmfv/7Bugq cyuE7/7Vni0kOHowzNdS+4vh76RV5xJ/7MCqw0p9uUf663vpfHeI67bDASy4glkDfFM2 5Zzk0PuwiccoXFxCSyDnqV3zicBCpPzPQT0VcIAS1gOKydhV6PLm/K0fgw7SeMDk3jpu 2tVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=RiZCn3RWIBDDuUzB4AXJFygvWH/+I11V/uXJUKFrQmg=; b=rm9rxEZ8hneSHcNGmX4/0yDlxnFxQv7nOxCiNeiEzhtfB9hUm1hU+u81+fcf3yijsN PcinK3ALLWLNE/UU8lU23+ndbv5GLTwSSRxCyDViSXAUd/enSgTCRHpEcg7zzvaMoLp+ KNWlZ1SI8PySNo85xtqBUBFwmk6/RHoc6fz5cpflG/OHOlBbPg3PTJJM5pVsVNo8Xd52 2uYlgygmKtWOBLT/W+1gsH4XAY4zj6IAMGC8o7pIhFiDhIgnyAjSbkwHTm6JDUiAYtuN nnlXSJenScE5Z7ANcXX68SfFQ72jsCW6njHBwleb94vFkhzX1oJvrIVNwNfOMmf+2xIz ymnQ== X-Gm-Message-State: AHPjjUid5HzGmVgGhO8/tX1ZivOHfrYccm/NQLymYKcdcvN1YaYAlNxp 2TZVHueMt1Y02ncwPIT8b2/ND5ZJAfgo1gOOx0VZTg== X-Google-Smtp-Source: AOwi7QBBzCD6njeJu5wAvPDDAvgtA5vu/PPxOwiGRTcaPKbdkwIi62snToiyusTx/79Q9mX+cIqYTRYeeCiBCIS+RQA= X-Received: by 10.28.217.73 with SMTP id q70mr8448436wmg.9.1506258968868; Sun, 24 Sep 2017 06:16:08 -0700 (PDT) MIME-Version: 1.0 Sender: kczekirda@gmail.com Received: by 10.223.130.34 with HTTP; Sun, 24 Sep 2017 06:15:38 -0700 (PDT) In-Reply-To: References: <201709231244.v8NCig1O037355@repo.freebsd.org> <32112779.upWhmOh2nn@ralph.baldwin.cx> From: Kamil Czekirda Date: Sun, 24 Sep 2017 15:15:38 +0200 X-Google-Sender-Auth: xlBika19bGY--4T-mOZKrMKtjkM Message-ID: Subject: Re: svn commit: r323952 - head/sys/boot/i386/libi386 To: Baptiste Daroussin Cc: John Baldwin , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Mariusz Zaborski , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 13:16:11 -0000 I think we can enable support for both NFS and TFTP protocols by default for all architectures and redefine options to LOADER_NO_NFS_SUPPORT and LOADER_NO_TFTP_SUPPORT. 2017-09-23 20:34 GMT+02:00 Warner Losh : > On Sat, Sep 23, 2017 at 9:50 AM, John Baldwin wrote: > > > On Saturday, September 23, 2017 12:44:42 PM Mariusz Zaborski wrote: > > > Author: oshogbo > > > Date: Sat Sep 23 12:44:42 2017 > > > New Revision: 323952 > > > URL: https://svnweb.freebsd.org/changeset/base/323952 > > > > > > Log: > > > After the r317886 support for TFTP and NFS can be enable > > simultaneously. > > > > > > The cleanup of this distinction was done in the r318988, but this > > Makefile > > > was omitted. > > > > > > Submitted by: kczekirda@ > > > > > > Modified: > > > head/sys/boot/i386/libi386/Makefile > > > > > > Modified: head/sys/boot/i386/libi386/Makefile > > > ============================================================ > > ================== > > > --- head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:35:46 2017 > > (r323951) > > > +++ head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:44:42 2017 > > (r323952) > > > @@ -12,10 +12,10 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c > > biospnp > > > .PATH: ${.CURDIR}/../../zfs > > > SRCS+= devicename_stubs.c > > > > > > -# Enable PXE TFTP or NFS support, not both. > > > .if defined(LOADER_TFTP_SUPPORT) > > > CFLAGS+= -DLOADER_TFTP_SUPPORT > > > -.else > > > +.endif > > > +.if defined(LOADER_NFS_SUPPORT) > > > CFLAGS+= -DLOADER_NFS_SUPPORT > > > .endif > > > > Is LOADER_NFS_SUPPORT defined by default? If not, I think you just > turned > > off NFS > > in the default loader. One option would be to add a new > > 'LOADER_NO_NFS_SUPPORT' > > and include NFS unless that is defined. We could also just always > include > > NFS > > support. Finally, if we want to retain the ability to choose loader > bits, > > these > > should probably change to real src options: WITH/WITHOUT_LOADER_TFTP_ > SUPPORT > > and > > WITH/WITHOUT_LOADER_NFS_SUPPORT and have this Makefile check > > MK_LOADER_TFTP/NFS_SUPPORT. Then we could choose defaults in > src.opts.mk. > > > > I've wanted all the 'ad-hoc' options in the tree to wind up in src.opts.mk > . > These would be a great addition. > > Warner > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Sun Sep 24 13:28:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A470E286CB; Sun, 24 Sep 2017 13:28:25 +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 20F4275E81; Sun, 24 Sep 2017 13:28:25 +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 v8ODSOM5050654; Sun, 24 Sep 2017 13:28:24 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ODSOTZ050653; Sun, 24 Sep 2017 13:28:24 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201709241328.v8ODSOTZ050653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 Sep 2017 13:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323970 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 323970 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 13:28:25 -0000 Author: andrew Date: Sun Sep 24 13:28:24 2017 New Revision: 323970 URL: https://svnweb.freebsd.org/changeset/base/323970 Log: Remove the VIRT kernel config, it's now useable through GENERIC. Sponsored by: DARPA, AFRL Deleted: head/sys/arm/conf/VIRT From owner-svn-src-head@freebsd.org Sun Sep 24 14:22:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FCEE292CF; Sun, 24 Sep 2017 14:22:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09F2C771B0; Sun, 24 Sep 2017 14:22:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8OEMbxH074944; Sun, 24 Sep 2017 14:22:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OEMbXZ074943; Sun, 24 Sep 2017 14:22:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709241422.v8OEMbXZ074943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 24 Sep 2017 14:22:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323971 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 323971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 14:22:38 -0000 Author: imp Date: Sun Sep 24 14:22:36 2017 New Revision: 323971 URL: https://svnweb.freebsd.org/changeset/base/323971 Log: Fix packages with interactive post install scripts. Tell pkg(8) we're running non-interactively so packages that with interactive post install scripts don't hang. Submitted by: Guido van Rooij Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Sun Sep 24 13:28:24 2017 (r323970) +++ head/tools/tools/nanobsd/defaults.sh Sun Sep 24 14:22:36 2017 (r323971) @@ -749,7 +749,7 @@ cust_install_files ( ) ( cust_pkgng ( ) ( mkdir -p ${NANO_WORLDDIR}/usr/local/etc local PKG_CONF="${NANO_WORLDDIR}/usr/local/etc/pkg.conf" - local PKGCMD="env ASSUME_ALWAYS_YES=YES PKG_DBDIR=${NANO_PKG_META_BASE}/pkg SIGNATURE_TYPE=none /usr/sbin/pkg" + local PKGCMD="env BATCH=YES ASSUME_ALWAYS_YES=YES PKG_DBDIR=${NANO_PKG_META_BASE}/pkg SIGNATURE_TYPE=none /usr/sbin/pkg" # Ensure pkg.conf points pkg to where the package meta data lives. touch ${PKG_CONF} From owner-svn-src-head@freebsd.org Sun Sep 24 14:26:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1E17E2935B for ; Sun, 24 Sep 2017 14:26:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 832CA77321 for ; Sun, 24 Sep 2017 14:26:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22e.google.com with SMTP id h66so7801685ioh.11 for ; Sun, 24 Sep 2017 07:26:22 -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=SdyZPRb1DZ5uwvo9kbTk/+45ldLSQLb1DT0nJsDM4So=; b=Y7ndTJw7Hhk9GmzCN30K+FjvbIvCn1c0rOxxuYPSw1D3/It5TN3fXIoMRwC05+svrR c3Npm74+b019K6h2oCJhYmUd2yMm6eM8GTzGYlJvjMtjbOztKCSHTt7/phuVmVMMe2Ga tD4Sg4g5nZx8daRnnQDSmOUVfZSOEz+LviyOj7xXCgt/c/9xmc1hnRi1BQrNoNI6vG3/ b6FU/zHvVDoqpeHsFi5QVFCVkSJ4MuqVE76RUg6UgrZ04FdjyiNM1omr5kSm2SVo/aKM HaZGVwSn3Y2FIw/dn1Ox1Aee+dWa5IaZOr4FKlqmAOEibF1vB0o92f1CIIXNlBeTzjoQ w2cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=SdyZPRb1DZ5uwvo9kbTk/+45ldLSQLb1DT0nJsDM4So=; b=KEo3kfuAWnN5h/ejqyd0KS0TuGnPb9+7l3bwTxCiXGfl0Xc6wXj1SC6uTYiya9ym+3 Kx+xJfjmJuXpFs794SyYcaNxGpQV5J8EvWJ9+fr9Q4M2OVxWepk7WSuX92xK3TdJIDfA reefXOdUsCPgYWq73tEu4SLbdCx9S2Cd+sBS6mUkifCmGgeqqz3WEET1Gl6css9k44Sb RU6dchV9bfE/ryqzNhnWUCiltCOjLRwO1I9JKP/IUkZEyzwXqUhoLCZ3+EcyNrsEfn+g O1GzVTkAdlXFtFhrjaYlHxyPkqIV8fUs2DtDUI558qWEYsDEULbXCsTCKb1yDKU7ZLVf qrUw== X-Gm-Message-State: AHPjjUggjqFkkf5SsTbNfBGoNOSroJ7FP82VbF99bJY8BSBeAE7K4zSP nxkK6P/2JXf1iu5G+rfB7BX+DhCxp9B+SKeWKtLsgA== X-Google-Smtp-Source: AOwi7QCotJ7ThKzWz8FNjrbHtTEmtuqJ0fYxZnv5M69QE3Vh9ooJi2aPeAuB7AUvSkt6xPe1x9B+Ok+53jdyd3CRvTo= X-Received: by 10.107.7.161 with SMTP id g33mr5920351ioi.169.1506263181709; Sun, 24 Sep 2017 07:26:21 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.2.194 with HTTP; Sun, 24 Sep 2017 07:26:20 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:78f4:43db:b652:bfa7] In-Reply-To: References: <201709231244.v8NCig1O037355@repo.freebsd.org> <32112779.upWhmOh2nn@ralph.baldwin.cx> From: Warner Losh Date: Sun, 24 Sep 2017 08:26:20 -0600 X-Google-Sender-Auth: 6ePHSyexlKwXQwDnME8HS5rTf2U Message-ID: Subject: Re: svn commit: r323952 - head/sys/boot/i386/libi386 To: Kamil Czekirda Cc: Baptiste Daroussin , John Baldwin , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Mariusz Zaborski Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 14:26:22 -0000 We should move them to src.opt.mk In fact, I think I may just do that this morning. Then we can just change the defaults. Warner On Sun, Sep 24, 2017 at 7:15 AM, Kamil Czekirda wrote: > I think we can enable support for both NFS and TFTP protocols by default > for all architectures and redefine options to LOADER_NO_NFS_SUPPORT and > LOADER_NO_TFTP_SUPPORT. > > 2017-09-23 20:34 GMT+02:00 Warner Losh : > >> On Sat, Sep 23, 2017 at 9:50 AM, John Baldwin wrote: >> >> > On Saturday, September 23, 2017 12:44:42 PM Mariusz Zaborski wrote: >> > > Author: oshogbo >> > > Date: Sat Sep 23 12:44:42 2017 >> > > New Revision: 323952 >> > > URL: https://svnweb.freebsd.org/changeset/base/323952 >> > > >> > > Log: >> > > After the r317886 support for TFTP and NFS can be enable >> > simultaneously. >> > > >> > > The cleanup of this distinction was done in the r318988, but this >> > Makefile >> > > was omitted. >> > > >> > > Submitted by: kczekirda@ >> > > >> > > Modified: >> > > head/sys/boot/i386/libi386/Makefile >> > > >> > > Modified: head/sys/boot/i386/libi386/Makefile >> > > ============================================================ >> > ================== >> > > --- head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:35:46 >> 2017 >> > (r323951) >> > > +++ head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:44:42 >> 2017 >> > (r323952) >> > > @@ -12,10 +12,10 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c >> > biospnp >> > > .PATH: ${.CURDIR}/../../zfs >> > > SRCS+= devicename_stubs.c >> > > >> > > -# Enable PXE TFTP or NFS support, not both. >> > > .if defined(LOADER_TFTP_SUPPORT) >> > > CFLAGS+= -DLOADER_TFTP_SUPPORT >> > > -.else >> > > +.endif >> > > +.if defined(LOADER_NFS_SUPPORT) >> > > CFLAGS+= -DLOADER_NFS_SUPPORT >> > > .endif >> > >> > Is LOADER_NFS_SUPPORT defined by default? If not, I think you just >> turned >> > off NFS >> > in the default loader. One option would be to add a new >> > 'LOADER_NO_NFS_SUPPORT' >> > and include NFS unless that is defined. We could also just always >> include >> > NFS >> > support. Finally, if we want to retain the ability to choose loader >> bits, >> > these >> > should probably change to real src options: >> WITH/WITHOUT_LOADER_TFTP_SUPPORT >> > and >> > WITH/WITHOUT_LOADER_NFS_SUPPORT and have this Makefile check >> > MK_LOADER_TFTP/NFS_SUPPORT. Then we could choose defaults in >> src.opts.mk. >> > >> >> I've wanted all the 'ad-hoc' options in the tree to wind up in >> src.opts.mk. >> These would be a great addition. >> >> Warner >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >> > > From owner-svn-src-head@freebsd.org Sun Sep 24 14:36:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42706E2950F; Sun, 24 Sep 2017 14:36:02 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11A1E776EF; Sun, 24 Sep 2017 14:36:02 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8OEa1dt079041; Sun, 24 Sep 2017 14:36:01 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OEa1iX079040; Sun, 24 Sep 2017 14:36:01 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201709241436.v8OEa1iX079040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 24 Sep 2017 14:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323972 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 323972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 14:36:02 -0000 Author: fsu Date: Sun Sep 24 14:36:01 2017 New Revision: 323972 URL: https://svnweb.freebsd.org/changeset/base/323972 Log: Add myself to the calendar.freebsd Reviewed by: pfg (mentor) Approved by: pfg (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Sep 24 14:22:36 2017 (r323971) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Sep 24 14:36:01 2017 (r323972) @@ -419,6 +419,7 @@ 11/23 Luca Pizzamiglio born in Casalpusterlengo, Italy, 1978 11/24 Andrey Zakhvatov born in Chelyabinsk, Russian Federation, 1974 11/24 Daniel Gerzo born in Bratislava, Slovakia, 1986 +11/25 Fedor Uporov born in Yalta, Crimea, USSR, 1988 11/28 Nik Clayton born in Peterborough, United Kingdom, 1973 11/28 Stanislav Sedov born in Chelyabinsk, USSR, 1985 12/01 Hajimu Umemoto born in Nara, Japan, 1961 From owner-svn-src-head@freebsd.org Sun Sep 24 16:50:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEE62E2B4A4; Sun, 24 Sep 2017 16:50:11 +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 7DEE67E9F2; Sun, 24 Sep 2017 16:50:11 +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 v8OGoAYF032433; Sun, 24 Sep 2017 16:50:10 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OGoADH032431; Sun, 24 Sep 2017 16:50:10 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709241650.v8OGoADH032431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 24 Sep 2017 16:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323973 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 16:50:11 -0000 Author: alc Date: Sun Sep 24 16:50:10 2017 New Revision: 323973 URL: https://svnweb.freebsd.org/changeset/base/323973 Log: Optimize vm_page_try_to_free(). Specifically, the call to pmap_remove_all() can be avoided when the page's containing object has a reference count of zero. (If the object has a reference count of zero, then none of its pages can possibly be mapped.) Address nearby style issues in vm_page_try_to_free(), and change its return type to "bool". Reviewed by: kib, markj MFC after: 1 week Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Sep 24 14:36:01 2017 (r323972) +++ head/sys/vm/vm_page.c Sun Sep 24 16:50:10 2017 (r323973) @@ -3081,23 +3081,25 @@ vm_page_unswappable(vm_page_t m) * vm_page_try_to_free() * * Attempt to free the page. If we cannot free it, we do nothing. - * 1 is returned on success, 0 on failure. + * true is returned on success, false on failure. */ -int +bool vm_page_try_to_free(vm_page_t m) { - vm_page_lock_assert(m, MA_OWNED); + vm_page_assert_locked(m); if (m->object != NULL) VM_OBJECT_ASSERT_WLOCKED(m->object); - if (m->dirty || m->hold_count || m->wire_count || + if (m->dirty != 0 || m->hold_count != 0 || m->wire_count != 0 || (m->oflags & VPO_UNMANAGED) != 0 || vm_page_busied(m)) - return (0); - pmap_remove_all(m); - if (m->dirty) - return (0); + return (false); + if (m->object != NULL && m->object->ref_count != 0) { + pmap_remove_all(m); + if (m->dirty != 0) + return (false); + } vm_page_free(m); - return (1); + return (true); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Sep 24 14:36:01 2017 (r323972) +++ head/sys/vm/vm_page.h Sun Sep 24 16:50:10 2017 (r323973) @@ -477,7 +477,6 @@ void vm_page_change_lock(vm_page_t m, struct mtx **mtx vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, vm_page_t *ma, int count); -int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); @@ -513,6 +512,7 @@ void vm_page_set_valid_range(vm_page_t m, int base, in int vm_page_sleep_if_busy(vm_page_t m, const char *msg); vm_offset_t vm_page_startup(vm_offset_t vaddr); void vm_page_sunbusy(vm_page_t m); +bool vm_page_try_to_free(vm_page_t m); int vm_page_trysbusy(vm_page_t m); void vm_page_unhold_pages(vm_page_t *ma, int count); void vm_page_unswappable(vm_page_t m); From owner-svn-src-head@freebsd.org Sun Sep 24 18:12:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69F35E2CC4D; Sun, 24 Sep 2017 18:12:11 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from mail101c7.megamailservers.com (mail501c7.megamailservers.com [209.235.141.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF17E8094E; Sun, 24 Sep 2017 18:12:10 +0000 (UTC) (envelope-from shurd@sasktel.net) X-Authenticated-User: hurds.sasktel.net X-VIP: 69.49.109.87 Received: from [192.168.0.33] (ip72-194-73-141.oc.oc.cox.net [72.194.73.141]) (authenticated bits=0) by mail101c7.megamailservers.com (8.14.9/8.13.1) with ESMTP id v8OHvOwm032555; Sun, 24 Sep 2017 13:57:26 -0400 Subject: Re: svn commit: r323942 - head/sys/net To: Hans Petter Selasky Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> <3601ee57-2bf5-036a-a3d1-a4795847d0ec@selasky.org> From: Stephen Hurd Message-ID: <311ab67b-7d37-69aa-8a7b-cbd5350e51c0@sasktel.net> Date: Sun, 24 Sep 2017 10:57:23 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 In-Reply-To: <3601ee57-2bf5-036a-a3d1-a4795847d0ec@selasky.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CTCH-RefID: str=0001.0A020205.59C7F209.0018, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.2 cv=V9cN6avi c=1 sm=1 tr=0 a=l4Y+EJuLrT/8f1z5FvEQ1g==:117 a=l4Y+EJuLrT/8f1z5FvEQ1g==:17 a=IkcTkHD0fZMA:10 a=2pFDieIRxZvowp__EMcA:9 a=QEXdDO2ut3YA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 18:12:11 -0000 Hans Petter Selasky wrote: > On 09/24/17 01:46, Stephen Hurd wrote: >> Basically, it changed from this: >> >> foreach (mbuf in rx) { >> if (lro && tcp_lro_rx(mbuf) == 0) >> continue; >> if_input(mbuf) >> } >> >> To this: >> >> prev_mbuf = first_mbuf = NULL; >> foreach (mbuf in rx) { >> if (lro && tcp_lro_rx(mbuf) == 0) >> continue; >> if (prev_mbuf) { >> prev_mbuf->m_nextpkt = mbuf; >> prev_mbuf = mbuf; >> } >> else { >> first_mbuf = prev_mbuf = mbuf; >> } >> } >> >> if (first_mbuf) >> if_input(first_mbuf); >> >> So while before it called if_input() for each separate mbuf that was >> not LROed, it now builds a chain of mbufs that were not LROed, and >> makes a single call to if_input() with the whole chain. For cases >> like packet forwarding where no packets are LROed, performance is >> better. >> > > Can such a similar logic be applied inside TCP LRO aswell? It looks like it would be more complex to do a similar thing in tcp_lro.c, and I'm not certain it would help much except in cases with a large number of streams that mostly end up not being coalesced. Taking a quick look, tcp_lro_flush() would need to be modified to return an mbuf head and tail, then the caller would need to be responsible for combining them into a single mbuf chain and calling if_input(). Either that, or an mbuf tail could be passed into tcp_lro_flush(), the tail modified in there, and an mbuf head returned... that way it would work something like this: The caller would be something like this: m_head = m_tail = NULL; LIST_FOREACH(le, bucket, hash_next) { head = tcp_lro_flush(lc, le, &m_tail); if (m_head == NULL) m_head = head; } if (m_head) if_input(m_head); And tcp_lro_flush() would be something like this: struct mbuf *tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le, struct mbuf **tail) { ... if (*tail) *tail->m_next = le->m_head; *tail = le->m_tail; ... return le->m_head; } Hrm, maybe it wouldn't be all that difficult after all. :-) I'll be driving across the country later this week, so I don't want to start poking into LRO then disappear, so if nobody else tries it out before then, I should take a look in a couple weeks. From owner-svn-src-head@freebsd.org Sun Sep 24 19:43:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43DE9E2EAD0; Sun, 24 Sep 2017 19:43:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10E237F2; Sun, 24 Sep 2017 19:43:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8OJhVW9010609; Sun, 24 Sep 2017 19:43:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OJhVNX010608; Sun, 24 Sep 2017 19:43:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709241943.v8OJhVNX010608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 24 Sep 2017 19:43:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323974 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 323974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 19:43:32 -0000 Author: rmacklem Date: Sun Sep 24 19:43:31 2017 New Revision: 323974 URL: https://svnweb.freebsd.org/changeset/base/323974 Log: Remove 0 filling from nfsm_uiombuflist(). nfsm_uiombuflist() zero filled the mbuf list to a multiple of 4bytes as required for XDR. Unfortunately that modified an mbuf list after it was m_copym()'d and was broken. This patch removes the zero filling code. Since nfsm_uiombuflist() is not yet used in head/current, this has no effect on users. The function will be used by a future commit of code that adds Flex File Layout support. Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Sun Sep 24 16:50:10 2017 (r323973) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Sun Sep 24 19:43:31 2017 (r323974) @@ -344,7 +344,7 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu struct mbuf *mp, *mp2, *firstmp; int xfer, left, mlen; int uiosiz, clflg, rem; - char *cp, *tcp; + char *tcp; KASSERT(uiop->uio_iovcnt == 1, ("nfsm_uiotombuf: iovcnt != 1")); @@ -396,19 +396,7 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu uiop->uio_iov->iov_len -= uiosiz; siz -= uiosiz; } - if (rem > 0) { - if (rem > M_TRAILINGSPACE(mp)) { - NFSMGET(mp); - mbuf_setlen(mp, 0); - mbuf_setnext(mp2, mp); - } - cp = NFSMTOD(mp, caddr_t) + mbuf_len(mp); - for (left = 0; left < rem; left++) - *cp++ = '\0'; - mbuf_setlen(mp, mbuf_len(mp) + rem); - if (cpp != NULL) - *cpp = cp; - } else if (cpp != NULL) + if (cpp != NULL) *cpp = NFSMTOD(mp, caddr_t) + mbuf_len(mp); if (mbp != NULL) *mbp = mp; From owner-svn-src-head@freebsd.org Sun Sep 24 19:59:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFB32E2EDBA; Sun, 24 Sep 2017 19:59:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F48CEA1; Sun, 24 Sep 2017 19:59:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8OJxQhO015126; Sun, 24 Sep 2017 19:59:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OJxQbu015125; Sun, 24 Sep 2017 19:59:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709241959.v8OJxQbu015125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 24 Sep 2017 19:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323977 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 323977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 19:59:27 -0000 Author: cem Date: Sun Sep 24 19:59:26 2017 New Revision: 323977 URL: https://svnweb.freebsd.org/changeset/base/323977 Log: g_resize_provider_event: Do not invoke orphan method twice Like r266444, g_resize_provider_event can attempt to orphan an already orphaned geom_dev consumer. This will cause a panic in g_dev_orphan. Apply the same fix as was applied to g_orphan_register. Reviewed by: ae Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12469 Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Sun Sep 24 19:53:17 2017 (r323976) +++ head/sys/geom/geom_subr.c Sun Sep 24 19:59:26 2017 (r323977) @@ -631,6 +631,14 @@ g_resize_provider_event(void *arg, int flag) LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) { gp = cp->geom; if (gp->resize == NULL && size < pp->mediasize) { + /* + * XXX: g_dev_orphan method does deferred destroying + * and it is possible, that other event could already + * call the orphan method. Check consumer's flags to + * do not schedule it twice. + */ + if (cp->flags & G_CF_ORPHAN) + continue; cp->flags |= G_CF_ORPHAN; cp->geom->orphan(cp); } From owner-svn-src-head@freebsd.org Sun Sep 24 20:05:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EECDE2EFF2; Sun, 24 Sep 2017 20:05:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48BD612E2; Sun, 24 Sep 2017 20:05:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8OK5mc5018952; Sun, 24 Sep 2017 20:05:48 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OK5mwO018951; Sun, 24 Sep 2017 20:05:48 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709242005.v8OK5mwO018951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 24 Sep 2017 20:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323978 - head/sys/fs/nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsserver X-SVN-Commit-Revision: 323978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 20:05:49 -0000 Author: rmacklem Date: Sun Sep 24 20:05:48 2017 New Revision: 323978 URL: https://svnweb.freebsd.org/changeset/base/323978 Log: Change a panic to an error return. There was a panic() in the NFS server's write operation that didn't need to be a panic() and could just be an error return. This patch makes that change. Found by code inspection during development of the pNFS service. MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Sun Sep 24 19:59:26 2017 (r323977) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Sun Sep 24 20:05:48 2017 (r323978) @@ -921,7 +921,7 @@ nfsrvd_write(struct nfsrv_descript *nd, __unused int i nd->nd_md, nd->nd_dpos, nd->nd_cred, p); error = nfsm_advance(nd, NFSM_RNDUP(retlen), -1); if (error) - panic("nfsrv_write mbuf"); + goto nfsmout; } if (nd->nd_flag & ND_NFSV4) aftat_ret = 0; From owner-svn-src-head@freebsd.org Sun Sep 24 20:57:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A885E0131D; Sun, 24 Sep 2017 20:57:04 +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 285982FC5; Sun, 24 Sep 2017 20:57:04 +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 v8OKv3Fc039685; Sun, 24 Sep 2017 20:57:03 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OKv3OO039684; Sun, 24 Sep 2017 20:57:03 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201709242057.v8OKv3OO039684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 24 Sep 2017 20:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323980 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 323980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 20:57:04 -0000 Author: pfg Date: Sun Sep 24 20:57:03 2017 New Revision: 323980 URL: https://svnweb.freebsd.org/changeset/base/323980 Log: Small style(9) issue: spaces vs TAB. Modified: head/sys/compat/linux/linux_stats.c Modified: head/sys/compat/linux/linux_stats.c ============================================================================== --- head/sys/compat/linux/linux_stats.c Sun Sep 24 20:16:38 2017 (r323979) +++ head/sys/compat/linux/linux_stats.c Sun Sep 24 20:57:03 2017 (r323980) @@ -319,7 +319,7 @@ struct l_statfs { #define LINUX_PROC_SUPER_MAGIC 0x9fa0L #define LINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */ #define LINUX_ZFS_SUPER_MAGIC 0x2FC12FC1 -#define LINUX_DEVFS_SUPER_MAGIC 0x1373L +#define LINUX_DEVFS_SUPER_MAGIC 0x1373L #define LINUX_SHMFS_MAGIC 0x01021994 static long From owner-svn-src-head@freebsd.org Sun Sep 24 22:12:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70A9EE026A7; Sun, 24 Sep 2017 22:12:16 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from mail125c7.megamailservers.com (mail525c7.megamailservers.com [209.235.141.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0366640A3; Sun, 24 Sep 2017 22:12:15 +0000 (UTC) (envelope-from shurd@sasktel.net) X-Authenticated-User: hurds.sasktel.net X-VIP: 69.49.109.87 Received: from [192.168.0.33] (ip72-194-73-141.oc.oc.cox.net [72.194.73.141]) (authenticated bits=0) by mail125c7.megamailservers.com (8.14.9/8.13.1) with ESMTP id v8OMC5E2017143; Sun, 24 Sep 2017 18:12:06 -0400 Subject: Re: svn commit: r323942 - head/sys/net From: Stephen Hurd To: Hans Petter Selasky Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> <3601ee57-2bf5-036a-a3d1-a4795847d0ec@selasky.org> <311ab67b-7d37-69aa-8a7b-cbd5350e51c0@sasktel.net> Message-ID: Date: Sun, 24 Sep 2017 15:12:04 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 In-Reply-To: <311ab67b-7d37-69aa-8a7b-cbd5350e51c0@sasktel.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CTCH-RefID: str=0001.0A020205.59C82DB7.0131, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.2 cv=fL1J5dSe c=1 sm=1 tr=0 a=l4Y+EJuLrT/8f1z5FvEQ1g==:117 a=l4Y+EJuLrT/8f1z5FvEQ1g==:17 a=IkcTkHD0fZMA:10 a=6I5d2MoRAAAA:8 a=XkjZycnYKMKC4wFt0lIA:9 a=QEXdDO2ut3YA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 22:12:16 -0000 Stephen Hurd wrote: > Hans Petter Selasky wrote: >> On 09/24/17 01:46, Stephen Hurd wrote: >>> Basically, it changed from this: >>> >>> foreach (mbuf in rx) { >>> if (lro && tcp_lro_rx(mbuf) == 0) >>> continue; >>> if_input(mbuf) >>> } >>> >>> To this: >>> >>> prev_mbuf = first_mbuf = NULL; >>> foreach (mbuf in rx) { >>> if (lro && tcp_lro_rx(mbuf) == 0) >>> continue; >>> if (prev_mbuf) { >>> prev_mbuf->m_nextpkt = mbuf; >>> prev_mbuf = mbuf; >>> } >>> else { >>> first_mbuf = prev_mbuf = mbuf; >>> } >>> } >>> >>> if (first_mbuf) >>> if_input(first_mbuf); >>> >>> So while before it called if_input() for each separate mbuf that was >>> not LROed, it now builds a chain of mbufs that were not LROed, and >>> makes a single call to if_input() with the whole chain. For cases >>> like packet forwarding where no packets are LROed, performance is >>> better. >>> >> >> Can such a similar logic be applied inside TCP LRO aswell? > > It looks like it would be more complex to do a similar thing in > tcp_lro.c, and I'm not certain it would help much except in cases with > a large number of streams that mostly end up not being coalesced. > Taking a quick look, tcp_lro_flush() would need to be modified to > return an mbuf head and tail, then the caller would need to be > responsible for combining them into a single mbuf chain and calling > if_input(). > > Either that, or an mbuf tail could be passed into tcp_lro_flush(), the > tail modified in there, and an mbuf head returned... that way it would > work something like this: > > The caller would be something like this: > > m_head = m_tail = NULL; > LIST_FOREACH(le, bucket, hash_next) { > head = tcp_lro_flush(lc, le, &m_tail); > if (m_head == NULL) > m_head = head; > } > if (m_head) > if_input(m_head); > > And tcp_lro_flush() would be something like this: > > struct mbuf *tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le, > struct mbuf **tail) > { > ... > if (*tail) > *tail->m_next = le->m_head; > *tail = le->m_tail; > ... > return le->m_head; > } > > Hrm, maybe it wouldn't be all that difficult after all. :-) > > I'll be driving across the country later this week, so I don't want to > start poking into LRO then disappear, so if nobody else tries it out > before then, I should take a look in a couple weeks. I've done an initial pass here: https://reviews.freebsd.org/D12487 Feel free to test it out and report findings in the review. From owner-svn-src-head@freebsd.org Sun Sep 24 22:29:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97E91E02D34; Sun, 24 Sep 2017 22:29: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 56AC9647FD; Sun, 24 Sep 2017 22:29: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 v8OMTBP2076512; Sun, 24 Sep 2017 22:29:11 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OMTBcZ076511; Sun, 24 Sep 2017 22:29:11 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709242229.v8OMTBcZ076511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 24 Sep 2017 22:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323981 - head/sys/contrib/vchiq/interface/vchiq_arm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/contrib/vchiq/interface/vchiq_arm X-SVN-Commit-Revision: 323981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 22:29:12 -0000 Author: alc Date: Sun Sep 24 22:29:11 2017 New Revision: 323981 URL: https://svnweb.freebsd.org/changeset/base/323981 Log: Modernize the use of vm_page_unwire(). Since r288122, vm_page_unwire() has returned TRUE when the wire count transitions to zero, eliminating the need for callers to inspect the page's wire count. MFC after: 1 week Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c ============================================================================== --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Sun Sep 24 20:57:03 2017 (r323980) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Sun Sep 24 22:29:11 2017 (r323981) @@ -378,8 +378,7 @@ static void pagelist_page_free(vm_page_t pp) { vm_page_lock(pp); - vm_page_unwire(pp, PQ_INACTIVE); - if (pp->wire_count == 0 && pp->object == NULL) + if (vm_page_unwire(pp, PQ_INACTIVE) && pp->object == NULL) vm_page_free(pp); vm_page_unlock(pp); } From owner-svn-src-head@freebsd.org Sun Sep 24 23:35:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B337E0405B; Sun, 24 Sep 2017 23:35:02 +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 1DC6C66190; Sun, 24 Sep 2017 23:35:02 +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 v8ONZ1GK004982; Sun, 24 Sep 2017 23:35:01 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ONZ19m004981; Sun, 24 Sep 2017 23:35:01 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709242335.v8ONZ19m004981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 24 Sep 2017 23:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323982 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Sep 2017 23:35:02 -0000 Author: alc Date: Sun Sep 24 23:35:01 2017 New Revision: 323982 URL: https://svnweb.freebsd.org/changeset/base/323982 Log: Change vm_page_try_to_free() to require a managed page. Essentially, vm_page_try_to_free() is testing conditions, like clean versus dirty, that only vary in managed pages. Suggested by: kib Reviewed by: markj X-MFC after: never Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Sep 24 22:29:11 2017 (r323981) +++ head/sys/vm/vm_page.c Sun Sep 24 23:35:01 2017 (r323982) @@ -3078,22 +3078,23 @@ vm_page_unswappable(vm_page_t m) } /* - * vm_page_try_to_free() + * Attempt to free the page. If it cannot be freed, do nothing. Returns true + * if the page is freed and false otherwise. * - * Attempt to free the page. If we cannot free it, we do nothing. - * true is returned on success, false on failure. + * The page must be managed. The page and its containing object must be + * locked. */ bool vm_page_try_to_free(vm_page_t m) { vm_page_assert_locked(m); - if (m->object != NULL) - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_WLOCKED(m->object); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m)); if (m->dirty != 0 || m->hold_count != 0 || m->wire_count != 0 || - (m->oflags & VPO_UNMANAGED) != 0 || vm_page_busied(m)) + vm_page_busied(m)) return (false); - if (m->object != NULL && m->object->ref_count != 0) { + if (m->object->ref_count != 0) { pmap_remove_all(m); if (m->dirty != 0) return (false); From owner-svn-src-head@freebsd.org Mon Sep 25 02:06:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A482EE07315; Mon, 25 Sep 2017 02:06:52 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 742C76A57B; Mon, 25 Sep 2017 02:06:52 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8P26poJ083492; Mon, 25 Sep 2017 02:06:51 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8P26pej083491; Mon, 25 Sep 2017 02:06:51 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201709250206.v8P26pej083491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Mon, 25 Sep 2017 02:06:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323983 - head/sys/dev/neta X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/neta X-SVN-Commit-Revision: 323983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 02:06:52 -0000 Author: mw Date: Mon Sep 25 02:06:51 2017 New Revision: 323983 URL: https://svnweb.freebsd.org/changeset/base/323983 Log: Fix gcc compilation issues in the mvneta driver Compiling mvneta driver with gcc unveiled two issues, that required fixing. Reported by: andrew Obtained from: Semihalf Modified: head/sys/dev/neta/if_mvneta.c Modified: head/sys/dev/neta/if_mvneta.c ============================================================================== --- head/sys/dev/neta/if_mvneta.c Sun Sep 24 23:35:01 2017 (r323982) +++ head/sys/dev/neta/if_mvneta.c Mon Sep 25 02:06:51 2017 (r323983) @@ -97,16 +97,6 @@ __FBSDID("$FreeBSD$"); #define A3700_TCLK_250MHZ 250000000 -STATIC uint32_t -mvneta_get_clk() -{ -#if defined(__aarch64__) - return (A3700_TCLK_250MHZ); -#else - return (get_tclk()); -#endif -} - /* Device Register Initialization */ STATIC int mvneta_initreg(struct ifnet *); @@ -213,6 +203,9 @@ STATIC int mvneta_detach(device_t); STATIC int mvneta_miibus_readreg(device_t, int, int); STATIC int mvneta_miibus_writereg(device_t, int, int, int); +/* Clock */ +STATIC uint32_t mvneta_get_clk(void); + static device_method_t mvneta_methods[] = { /* Device interface */ DEVMETHOD(device_detach, mvneta_detach), @@ -354,6 +347,16 @@ static struct { { mvneta_rxtxth_intr, "MVNETA aggregated interrupt" }, }; +STATIC uint32_t +mvneta_get_clk() +{ +#if defined(__aarch64__) + return (A3700_TCLK_250MHZ); +#else + return (get_tclk()); +#endif +} + static int mvneta_set_mac_address(struct mvneta_softc *sc, uint8_t *addr) { @@ -831,11 +834,9 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; - struct ifnet *ifp; int q; sc = device_get_softc(dev); - ifp = sc->ifp; mvneta_stop(sc); /* Detach network interface */ From owner-svn-src-head@freebsd.org Mon Sep 25 08:00:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 703FFE0D8DD; Mon, 25 Sep 2017 08:00:32 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29B6471EB6; Mon, 25 Sep 2017 08:00:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4DF882601A9; Mon, 25 Sep 2017 10:00:28 +0200 (CEST) Subject: Re: svn commit: r323942 - head/sys/net To: Stephen Hurd Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> <3601ee57-2bf5-036a-a3d1-a4795847d0ec@selasky.org> <311ab67b-7d37-69aa-8a7b-cbd5350e51c0@sasktel.net> From: Hans Petter Selasky Message-ID: <73f8eaa1-7d71-0ef9-f5dc-4d18158f427e@selasky.org> Date: Mon, 25 Sep 2017 09:57:57 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 08:00:32 -0000 On 09/25/17 00:12, Stephen Hurd wrote: > > I've done an initial pass here: https://reviews.freebsd.org/D12487 > > Feel free to test it out and report findings in the review. I see some bugs. I'll send you a patch off-list. --HPS From owner-svn-src-head@freebsd.org Mon Sep 25 11:11:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B907E10D6E; Mon, 25 Sep 2017 11:11:03 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A0C276A08; Mon, 25 Sep 2017 11:11:03 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id C6CED25D3857; Mon, 25 Sep 2017 11:10:59 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 00776D1F908; Mon, 25 Sep 2017 11:10:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id QJi0CRiBspsv; Mon, 25 Sep 2017 11:10:57 +0000 (UTC) Received: from [192.168.124.1] (fresh-ayiya.sbone.de [IPv6:fde9:577b:c1a9:f001::2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id A86E8D1F7FD; Mon, 25 Sep 2017 11:10:50 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Stephen Hurd" Cc: "Stephen Hurd" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323942 - head/sys/net Date: Mon, 25 Sep 2017 11:10:48 +0000 Message-ID: <4523452E-79B0-494A-B44F-44DE4B747D69@lists.zabbadoz.net> In-Reply-To: <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: quoted-printable X-Mailer: MailMate (2.0BETAr6091) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 11:11:03 -0000 On 23 Sep 2017, at 23:46, Stephen Hurd wrote: > Bjoern A. Zeeb wrote: >> On 23 Sep 2017, at 6:32, Stephen Hurd wrote: >> >>> Bjoern A. Zeeb wrote: >>>> On 23 Sep 2017, at 1:35, Stephen Hurd wrote: >>>> >>>>> Author: shurd >>>>> Date: Sat Sep 23 01:35:14 2017 >>>>> New Revision: 323942 >>>>> URL: https://svnweb.freebsd.org/changeset/base/323942 >>>>> >>>>> Log: >>>>> Chain mbufs before passing to if_input() >>>>> >>>>> Build a list of mbufs to pass to if_input() after LRO. Results = >>>>> in >>>>> 12% small packet forwarding rate improvement. >>>> forwarding seems a confusing word here.. >>> >>> The test was small (64 byte frames) received on one interface, then = >>> sent out on a different one using the net.inet.ip.forwarding sysctl = >>> (controlled via the gateway_enable setting in rc.conf). >> >> Then this makes no sense as we don=E2=80=99t do LRO if forwarding is = >> enabled on the machine; >> https://svnweb.freebsd.org/base/head/sys/netinet/tcp_lro.c?annotate=3D= 317390#l645 > > Basically, it changed from this: =2E. > To this: =E2=80=A6 > So while before it called if_input() for each separate mbuf that was = > not LROed, it now builds a chain of mbufs that were not LROed, and = > makes a single call to if_input() with the whole chain. For cases = > like packet forwarding where no packets are LROed, performance is = > better. Got it, so the =E2=80=9Cafter LRO=E2=80=9D in the original commit message= is as = confusing as forwarding. I not saying anything against the change, I am just saying the commit = message doesn=E2=80=99t describe what it does. Also I am pretty sure this works with ether_input but not so much with = fddi_input, iso88025_input, and ifdead_input is probably going to leak = as well. /bz From owner-svn-src-head@freebsd.org Mon Sep 25 15:03:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A087E17E60; Mon, 25 Sep 2017 15:03:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB51F81431; Mon, 25 Sep 2017 15:03:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PF3S8F003825; Mon, 25 Sep 2017 15:03:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PF3Rbp003823; Mon, 25 Sep 2017 15:03:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709251503.v8PF3Rbp003823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 25 Sep 2017 15:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323985 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 15:03:29 -0000 Author: ian Date: Mon Sep 25 15:03:27 2017 New Revision: 323985 URL: https://svnweb.freebsd.org/changeset/base/323985 Log: Use nstosbt() instead of multiplying by SBT_1NS to avoid roundoff errors. Differential Revision: https://reviews.freebsd.org/D11779 Modified: head/sys/cddl/compat/opensolaris/sys/kcondvar.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Modified: head/sys/cddl/compat/opensolaris/sys/kcondvar.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/kcondvar.h Mon Sep 25 11:38:58 2017 (r323984) +++ head/sys/cddl/compat/opensolaris/sys/kcondvar.h Mon Sep 25 15:03:27 2017 (r323985) @@ -63,13 +63,8 @@ static clock_t cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, int flag) { - sbintime_t sbt; - sbintime_t pr; - sbt = tim * SBT_1NS; - pr = res * SBT_1NS; - - return (cv_timedwait_sbt(cvp, mp, sbt, pr, 0)); + return (cv_timedwait_sbt(cvp, mp, nstosbt(tim), nstosbt(res), 0)); } #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Mon Sep 25 11:38:58 2017 (r323984) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Mon Sep 25 15:03:27 2017 (r323985) @@ -806,8 +806,8 @@ dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty) continue; mutex_exit(&curthread->t_delay_lock); #else - pause_sbt("dmu_tx_delay", wakeup * SBT_1NS, - zfs_delay_resolution_ns * SBT_1NS, C_ABSOLUTE); + pause_sbt("dmu_tx_delay", nstosbt(wakeup), + nstosbt(zfs_delay_resolution_ns), C_ABSOLUTE); #endif #else hrtime_t delta = wakeup - gethrtime(); From owner-svn-src-head@freebsd.org Mon Sep 25 17:05:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1C86E1FA95; Mon, 25 Sep 2017 17:05:06 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from mail125c7.megamailservers.com (mail525c7.megamailservers.com [209.235.141.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48E031BD5; Mon, 25 Sep 2017 17:05:05 +0000 (UTC) (envelope-from shurd@sasktel.net) X-Authenticated-User: hurds.sasktel.net X-VIP: 69.49.109.87 Received: from [192.168.0.33] (ip72-194-73-141.oc.oc.cox.net [72.194.73.141]) (authenticated bits=0) by mail125c7.megamailservers.com (8.14.9/8.13.1) with ESMTP id v8PH50pU021872; Mon, 25 Sep 2017 13:05:02 -0400 Subject: Re: svn commit: r323942 - head/sys/net To: "Bjoern A. Zeeb" Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> <4523452E-79B0-494A-B44F-44DE4B747D69@lists.zabbadoz.net> From: Stephen Hurd Message-ID: <61486844-e6f1-2607-2113-599ebcb02c58@sasktel.net> Date: Mon, 25 Sep 2017 10:04:59 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 In-Reply-To: <4523452E-79B0-494A-B44F-44DE4B747D69@lists.zabbadoz.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CTCH-RefID: str=0001.0A020204.59C93740.009A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.2 cv=fL1J5dSe c=1 sm=1 tr=0 a=l4Y+EJuLrT/8f1z5FvEQ1g==:117 a=l4Y+EJuLrT/8f1z5FvEQ1g==:17 a=IkcTkHD0fZMA:10 a=6I5d2MoRAAAA:8 a=JWSIKrv1NKH2LzKxutUA:9 a=QEXdDO2ut3YA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 17:05:06 -0000 Bjoern A. Zeeb wrote: > On 23 Sep 2017, at 23:46, Stephen Hurd wrote: > >> Bjoern A. Zeeb wrote: >>> On 23 Sep 2017, at 6:32, Stephen Hurd wrote: >>> >>>> Bjoern A. Zeeb wrote: >>>>> On 23 Sep 2017, at 1:35, Stephen Hurd wrote: >>>>> >>>>>> Author: shurd >>>>>> Date: Sat Sep 23 01:35:14 2017 >>>>>> New Revision: 323942 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/323942 >>>>>> >>>>>> Log: >>>>>> Chain mbufs before passing to if_input() >>>>>> >>>>>> Build a list of mbufs to pass to if_input() after LRO. Results in >>>>>> 12% small packet forwarding rate improvement. >>>>> forwarding seems a confusing word here.. >>>> >>>> The test was small (64 byte frames) received on one interface, then >>>> sent out on a different one using the net.inet.ip.forwarding sysctl >>>> (controlled via the gateway_enable setting in rc.conf). >>> >>> Then this makes no sense as we don’t do LRO if forwarding is enabled >>> on the machine; >>> https://svnweb.freebsd.org/base/head/sys/netinet/tcp_lro.c?annotate=317390#l645 >>> >> >> Basically, it changed from this: > .. >> To this: > … >> So while before it called if_input() for each separate mbuf that was >> not LROed, it now builds a chain of mbufs that were not LROed, and >> makes a single call to if_input() with the whole chain. For cases >> like packet forwarding where no packets are LROed, performance is >> better. > > Got it, so the “after LRO” in the original commit message is as > confusing as forwarding. > > I not saying anything against the change, I am just saying the commit > message doesn’t describe what it does. Can you explain what was confusing about it or propose other wording? I'm not sure what was confusing, and I'd like to avoid similarly confusing messages in the future. > Also I am pretty sure this works with ether_input but not so much with > fddi_input, iso88025_input, and ifdead_input is probably going to leak > as well. Thanks for the heads up. They all seem to use m_freem(), so they shouldn't leak. It doesn't look like they would actually work though (except ifdead_input of course). From owner-svn-src-head@freebsd.org Mon Sep 25 18:34:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A820E216A0; Mon, 25 Sep 2017 18:34:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.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 108DE641BE; Mon, 25 Sep 2017 18:34:36 +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 mail.baldwin.cx (Postfix) with ESMTPSA id AA2F510AB01; Mon, 25 Sep 2017 14:34:34 -0400 (EDT) From: John Baldwin To: Mariusz Zaborski Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323952 - head/sys/boot/i386/libi386 Date: Mon, 25 Sep 2017 11:30:07 -0700 Message-ID: <5584174.l2VGySiRAV@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <32112779.upWhmOh2nn@ralph.baldwin.cx> References: <201709231244.v8NCig1O037355@repo.freebsd.org> <32112779.upWhmOh2nn@ralph.baldwin.cx> 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.4.3 (mail.baldwin.cx); Mon, 25 Sep 2017 14:34:34 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 18:34:36 -0000 On Saturday, September 23, 2017 08:50:48 AM John Baldwin wrote: > On Saturday, September 23, 2017 12:44:42 PM Mariusz Zaborski wrote: > > Author: oshogbo > > Date: Sat Sep 23 12:44:42 2017 > > New Revision: 323952 > > URL: https://svnweb.freebsd.org/changeset/base/323952 > > > > Log: > > After the r317886 support for TFTP and NFS can be enable simultaneously. > > > > The cleanup of this distinction was done in the r318988, but this Makefile > > was omitted. > > > > Submitted by: kczekirda@ > > > > Modified: > > head/sys/boot/i386/libi386/Makefile > > > > Modified: head/sys/boot/i386/libi386/Makefile > > ============================================================================== > > --- head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:35:46 2017 (r323951) > > +++ head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:44:42 2017 (r323952) > > @@ -12,10 +12,10 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp > > .PATH: ${.CURDIR}/../../zfs > > SRCS+= devicename_stubs.c > > > > -# Enable PXE TFTP or NFS support, not both. > > .if defined(LOADER_TFTP_SUPPORT) > > CFLAGS+= -DLOADER_TFTP_SUPPORT > > -.else > > +.endif > > +.if defined(LOADER_NFS_SUPPORT) > > CFLAGS+= -DLOADER_NFS_SUPPORT > > .endif > > Is LOADER_NFS_SUPPORT defined by default? If not, I think you just turned off NFS > in the default loader. I'm now less certain of this statement, but apart from "we should do loader build options better", I think it needs an answer one way or another. From what I can tell, all the other Makefiles under sys/boot have 'LOADER_NFS_SUPPORT?= yes' except for this one. OTOH, I can't find any code in libi386 that has an #ifdef depending on either LOADER_NFS_SUPPORT or LOADER_TFTP_SUPPORT. It seems to only be used for sys/boot/i386/loader.conf.c when deciding which filesystems to include (and it already includes both on i386). I wonder if this entire clause can just be removed from this Makefile and have it not even care at all about LOADER_*_SUPPORT? It seems that bapt@ removed the #ifdef's from pxe.c in r305125 so these variables aren't meaningful now? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Sep 25 19:33:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA89CE228CF; Mon, 25 Sep 2017 19:33: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 787A865E0C; Mon, 25 Sep 2017 19:33:33 +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 v8PJXWs7018164; Mon, 25 Sep 2017 19:33:32 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PJXWM4018163; Mon, 25 Sep 2017 19:33:32 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709251933.v8PJXWM4018163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 25 Sep 2017 19:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323990 - head/lib/libcapsicum X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/libcapsicum X-SVN-Commit-Revision: 323990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 19:33:33 -0000 Author: cem Date: Mon Sep 25 19:33:32 2017 New Revision: 323990 URL: https://svnweb.freebsd.org/changeset/base/323990 Log: capsicum_helpers: Add SEEK to default stdio rights set PR: 219173 Sponsored by: Dell EMC Isilon Modified: head/lib/libcapsicum/capsicum_helpers.h Modified: head/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.h Mon Sep 25 19:06:01 2017 (r323989) +++ head/lib/libcapsicum/capsicum_helpers.h Mon Sep 25 19:33:32 2017 (r323990) @@ -50,7 +50,7 @@ caph_limit_stream(int fd, int flags) cap_rights_t rights; unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ, FIODTYPE }; - cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL); + cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_SEEK); if ((flags & CAPH_READ) != 0) cap_rights_set(&rights, CAP_READ); From owner-svn-src-head@freebsd.org Mon Sep 25 19:49:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E634E22C26; Mon, 25 Sep 2017 19:49:58 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 104A066673; Mon, 25 Sep 2017 19:49:57 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PJnvTL022673; Mon, 25 Sep 2017 19:49:57 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PJnvEK022672; Mon, 25 Sep 2017 19:49:57 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709251949.v8PJnvEK022672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 25 Sep 2017 19:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323991 - head/sys/boot/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/boot/efi/libefi X-SVN-Commit-Revision: 323991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 19:49:58 -0000 Author: tsoome Date: Mon Sep 25 19:49:56 2017 New Revision: 323991 URL: https://svnweb.freebsd.org/changeset/base/323991 Log: libefi: efipart_floppy() will should not pass acpi pointer if the HID test fails The current efipart_floppy() implementation is leaking the acpi pointer. Modified: head/sys/boot/efi/libefi/efipart.c Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Mon Sep 25 19:33:32 2017 (r323990) +++ head/sys/boot/efi/libefi/efipart.c Mon Sep 25 19:49:56 2017 (r323991) @@ -181,7 +181,7 @@ efipart_inithandles(void) static ACPI_HID_DEVICE_PATH * efipart_floppy(EFI_DEVICE_PATH *node) { - ACPI_HID_DEVICE_PATH *acpi = NULL; + ACPI_HID_DEVICE_PATH *acpi; if (DevicePathType(node) == ACPI_DEVICE_PATH && DevicePathSubType(node) == ACPI_DP) { @@ -192,7 +192,7 @@ efipart_floppy(EFI_DEVICE_PATH *node) return (acpi); } } - return (acpi); + return (NULL); } /* From owner-svn-src-head@freebsd.org Mon Sep 25 20:23:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05667E234E3; Mon, 25 Sep 2017 20:23:52 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 85D2D6760A; Mon, 25 Sep 2017 20:23:51 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 0888D25D3857; Mon, 25 Sep 2017 20:23:47 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 2EC97D1F950; Mon, 25 Sep 2017 20:23:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id Rlvo_8s0HqpP; Mon, 25 Sep 2017 20:23:45 +0000 (UTC) Received: from [192.168.124.1] (fresh-ayiya.sbone.de [IPv6:fde9:577b:c1a9:f001::2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 174E8D1F7FD; Mon, 25 Sep 2017 20:23:44 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Stephen Hurd" Cc: "Stephen Hurd" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323942 - head/sys/net Date: Mon, 25 Sep 2017 20:23:43 +0000 Message-ID: <681F1B2B-1CF6-41AC-9EED-B4790AB7CE95@lists.zabbadoz.net> In-Reply-To: <61486844-e6f1-2607-2113-599ebcb02c58@sasktel.net> References: <201709230135.v8N1ZE6S063264@repo.freebsd.org> <283397c7-a01e-3776-7ed3-b64d68003d0b@sasktel.net> <6F5DC92C-2CF6-4A33-9663-BFECB7DB65F2@lists.zabbadoz.net> <89d68ff8-84ed-83a6-4e77-9a321babe2fe@sasktel.net> <4523452E-79B0-494A-B44F-44DE4B747D69@lists.zabbadoz.net> <61486844-e6f1-2607-2113-599ebcb02c58@sasktel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (2.0BETAr6091) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 20:23:52 -0000 On 25 Sep 2017, at 17:04, Stephen Hurd wrote: > Bjoern A. Zeeb wrote: >> On 23 Sep 2017, at 23:46, Stephen Hurd wrote: >> >>> Bjoern A. Zeeb wrote: >>>> On 23 Sep 2017, at 6:32, Stephen Hurd wrote: >>>> >>>>> Bjoern A. Zeeb wrote: >>>>>> On 23 Sep 2017, at 1:35, Stephen Hurd wrote: >>>>>> >>>>>>> Author: shurd >>>>>>> Date: Sat Sep 23 01:35:14 2017 >>>>>>> New Revision: 323942 >>>>>>> URL: https://svnweb.freebsd.org/changeset/base/323942 >>>>>>> >>>>>>> Log: >>>>>>> Chain mbufs before passing to if_input() >>>>>>> >>>>>>> Build a list of mbufs to pass to if_input() after LRO. >>>>>>> Results in >>>>>>> 12% small packet forwarding rate improvement. >> I not saying anything against the change, I am just saying the commit >> message doesn’t describe what it does. > > Can you explain what was confusing about it or propose other wording? > I'm not sure what was confusing, and I'd like to avoid similarly > confusing messages in the future. I think it’s because I read “after LRO” as “after LRO processing happened” which is exactly not what is happening in that case; I know logically in the code order it’s “after LRO”. If I understand the change correctly (and I think jtl summarised it quite well already as well): “In cases when LRO is disabled or LRO is not consuming the packet, try to build an mbuf chain and pass the chain to if_input() thus lowering the per-packet overheads (*). For a packet forwarding case we have seen a 12% rate improvement for small packets.” (*) would be nice to describe them at this point so people understand where 12% come from (e.g., function call overhead, locking overhead, whatever ..) because that’s the reason you are doing the change. >> Also I am pretty sure this works with ether_input but not so much >> with fddi_input, iso88025_input, and ifdead_input is probably going >> to leak as well. > > Thanks for the heads up. They all seem to use m_freem(), so they > shouldn't leak. Right. My bad. > It doesn't look like they would actually work though (except > ifdead_input of course). Well, they’d work with a bit of packet loss I guess ;-) /bz From owner-svn-src-head@freebsd.org Mon Sep 25 20:26:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 545A1E23624; Mon, 25 Sep 2017 20:26:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BE60677B8; Mon, 25 Sep 2017 20:26:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v8PKPuqn012540 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Sep 2017 13:25:56 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v8PKPusO012539; Mon, 25 Sep 2017 13:25:56 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 25 Sep 2017 13:25:55 -0700 From: Gleb Smirnoff To: Mariusz Zaborski Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323866 - in head: contrib/tcpdump contrib/traceroute sbin/ping usr.bin/kdump usr.sbin/tcpdump/tcpdump usr.sbin/traceroute Message-ID: <20170925202555.GV1055@FreeBSD.org> References: <201709211441.v8LEfg1w082237@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709211441.v8LEfg1w082237@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 20:26:03 -0000 Mariusz, On Thu, Sep 21, 2017 at 02:41:42PM +0000, Mariusz Zaborski wrote: M> Author: oshogbo M> Date: Thu Sep 21 14:41:41 2017 M> New Revision: 323866 M> URL: https://svnweb.freebsd.org/changeset/base/323866 M> M> Log: M> We use a few different ifdef's names to check if we are using Casper or not, M> let's standardize this. Now we are always use WITH_CASPER name. Before this change we had some change to upstream the tcpdump patch, now we don't, since the define violates internal tcpdump style. As person who did previous tcpdump import and spent some time upstreaming patches, I would ask to backout the tcpdump part of this commit. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Mon Sep 25 20:26:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D993FE2368D; Mon, 25 Sep 2017 20:26: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 A7127678A4; Mon, 25 Sep 2017 20:26: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 v8PKQGZO038730; Mon, 25 Sep 2017 20:26:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PKQG1S038727; Mon, 25 Sep 2017 20:26:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709252026.v8PKQG1S038727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 25 Sep 2017 20:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323993 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 323993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 20:26:18 -0000 Author: jhb Date: Mon Sep 25 20:26:16 2017 New Revision: 323993 URL: https://svnweb.freebsd.org/changeset/base/323993 Log: Use tmpfs_print for tmpfs FIFOs. Reviewed by: kib (part of a larger patch) Modified: head/sys/fs/tmpfs/tmpfs_fifoops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.h Modified: head/sys/fs/tmpfs/tmpfs_fifoops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_fifoops.c Mon Sep 25 20:04:14 2017 (r323992) +++ head/sys/fs/tmpfs/tmpfs_fifoops.c Mon Sep 25 20:26:16 2017 (r323993) @@ -69,5 +69,5 @@ struct vop_vector tmpfs_fifoop_entries = { .vop_access = tmpfs_access, .vop_getattr = tmpfs_getattr, .vop_setattr = tmpfs_setattr, + .vop_print = tmpfs_print, }; - Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Mon Sep 25 20:04:14 2017 (r323992) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Mon Sep 25 20:26:16 2017 (r323993) @@ -1310,7 +1310,7 @@ tmpfs_reclaim(struct vop_reclaim_args *v) return 0; } -static int +int tmpfs_print(struct vop_print_args *v) { struct vnode *vp = v->a_vp; Modified: head/sys/fs/tmpfs/tmpfs_vnops.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.h Mon Sep 25 20:04:14 2017 (r323992) +++ head/sys/fs/tmpfs/tmpfs_vnops.h Mon Sep 25 20:26:16 2017 (r323993) @@ -49,6 +49,7 @@ extern struct vop_vector tmpfs_vnodeop_nonc_entries; vop_access_t tmpfs_access; vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; +vop_print_t tmpfs_print; vop_reclaim_t tmpfs_reclaim; #endif /* _FS_TMPFS_TMPFS_VNOPS_H_ */ From owner-svn-src-head@freebsd.org Mon Sep 25 20:38:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 596FAE23AAD; Mon, 25 Sep 2017 20:38:56 +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 28C1F68206; Mon, 25 Sep 2017 20:38:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PKcteB043164; Mon, 25 Sep 2017 20:38:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PKct3x043163; Mon, 25 Sep 2017 20:38:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709252038.v8PKct3x043163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 25 Sep 2017 20:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323994 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 20:38:56 -0000 Author: jhb Date: Mon Sep 25 20:38:55 2017 New Revision: 323994 URL: https://svnweb.freebsd.org/changeset/base/323994 Log: Log signal number passed to PT_STEP requests in KTR_PTRACE traces. MFC after: 1 week Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Sep 25 20:26:16 2017 (r323993) +++ head/sys/kern/sys_process.c Mon Sep 25 20:38:55 2017 (r323994) @@ -1039,8 +1039,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi switch (req) { case PT_STEP: - CTR2(KTR_PTRACE, "PT_STEP: tid %d (pid %d)", - td2->td_tid, p->p_pid); + CTR3(KTR_PTRACE, "PT_STEP: tid %d (pid %d), sig = %d", + td2->td_tid, p->p_pid, data); error = ptrace_single_step(td2); if (error) goto out; From owner-svn-src-head@freebsd.org Mon Sep 25 20:44:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3438BE23E2E; Mon, 25 Sep 2017 20:44:42 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC2D668775; Mon, 25 Sep 2017 20:44:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PKifCE047070; Mon, 25 Sep 2017 20:44:41 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PKifx5047069; Mon, 25 Sep 2017 20:44:41 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201709252044.v8PKifx5047069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 25 Sep 2017 20:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323995 - head/cddl/usr.sbin/zfsd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/cddl/usr.sbin/zfsd X-SVN-Commit-Revision: 323995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 20:44:42 -0000 Author: asomers Date: Mon Sep 25 20:44:40 2017 New Revision: 323995 URL: https://svnweb.freebsd.org/changeset/base/323995 Log: Close a memory leak when using zpool_read_all_labels MFC after: 3 weeks X-MFC-With: 322854 Sponsored by: Spectra Logic Corp Modified: head/cddl/usr.sbin/zfsd/zfsd_event.cc Modified: head/cddl/usr.sbin/zfsd/zfsd_event.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/zfsd_event.cc Mon Sep 25 20:38:55 2017 (r323994) +++ head/cddl/usr.sbin/zfsd/zfsd_event.cc Mon Sep 25 20:44:40 2017 (r323995) @@ -101,7 +101,7 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de poolName = NULL; if (zpool_in_use(g_zfsHandle, devFd, &poolState, &poolName, &b_inuse) == 0) { - nvlist_t *devLabel; + nvlist_t *devLabel = NULL; inUse = b_inuse == B_TRUE; if (poolName != NULL) @@ -116,8 +116,10 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de * might be damaged. In that case, zfsd should do nothing and * wait for the sysadmin to decide. */ - if (nlabels != VDEV_LABELS || devLabel == NULL) + if (nlabels != VDEV_LABELS || devLabel == NULL) { + nvlist_free(devLabel); return (NULL); + } try { Vdev vdev(devLabel); @@ -131,6 +133,7 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de exp.GetString().insert(0, context); exp.Log(); + nvlist_free(devLabel); } } return (NULL); From owner-svn-src-head@freebsd.org Mon Sep 25 20:59:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 938D2E241FF; Mon, 25 Sep 2017 20:59:31 +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 6D53169466; Mon, 25 Sep 2017 20:59:30 +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 v8PKxTmo012674 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Sep 2017 13:59:30 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v8PKxTIo012673; Mon, 25 Sep 2017 13:59:29 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 25 Sep 2017 13:59:29 -0700 From: Gleb Smirnoff To: Eugene Grosbein Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323873 - head/sys/netgraph Message-ID: <20170925205929.GW1055@FreeBSD.org> References: <201709212016.v8LKGBMi024412@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709212016.v8LKGBMi024412@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 20:59:31 -0000 On Thu, Sep 21, 2017 at 08:16:11PM +0000, Eugene Grosbein wrote: E> Author: eugen (ports committer) E> Date: Thu Sep 21 20:16:10 2017 E> New Revision: 323873 E> URL: https://svnweb.freebsd.org/changeset/base/323873 E> E> Log: E> Unprotected modification of ng_iface(4) private data leads to kernel panic. E> Fix a race with per-node read-mostly lock and refcounting for a hook. The patch is far from ideal. Netgraph already has internal locking, which guarantess write semantics for "disconnect" and "newhook" scenarios. As well as read semantics for "rcvdata". Since ng_iface is a gate node, that gates data between netgraph and the big network stack, it of course needs extra locking in the interface output method. But better piggyback on the netgraph locking, rather than add your own, IMHO. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Mon Sep 25 21:09:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 287EEE24433 for ; Mon, 25 Sep 2017 21:09:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::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 DEFAA698BF for ; Mon, 25 Sep 2017 21:08:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22b.google.com with SMTP id d16so10990538ioj.3 for ; Mon, 25 Sep 2017 14:08:59 -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=SdUP8WTZsxvUYF1VWTpNo3WhCJ5duPCz/n4ahYwHVBs=; b=lVx+uCFUXTZpsSScDTePLs8HdO+c16HnHiXAsjbeNq6Y1+0dcfP4UzMUsvkTTLydF/ z+yLeq4Q3xZLxrRBcoTJOEyiKLRbC9Mu2xzE3fr4lpxx/d1iIdBwY0xJoyXSeWRfXW0f 7HzNWlhl21v9RNstt6+HfU234JbrLxcu8P4FEb0FUozZyUG7hGczj7NL5e8NefFj+VKN rPQACU8nBTvzD28+9ldf46r9oMDIfw1eAyscrLA2xsstVxrlF7COXCC4N/quitpyYQaS 72M2BMNp1+BgMWyfs7zOz9iDZ7atbYPGbtCVKsAu/ceF928wYdtqUqbwLaWtESU4fbrh Q1jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=SdUP8WTZsxvUYF1VWTpNo3WhCJ5duPCz/n4ahYwHVBs=; b=ooXwjl5awzXRUmqcrY27rM9Y83n3reMVXUk/SXfk8WzdWDD3kUeIIk9zsJ6Cyj9Go4 UJKH4QOkCWStz7NPMV/EuEUdF9KwA/xsR4AfSFIPvhf6u0avVfDKnNVSQewt/AyGgEjW IB8XM+HohmCDDLYE1s/IIcAUB3KXjhbrS0CHAMRJb53nUNmZ1bLHAlfBxNhDv5L5XukQ uzh7QdBZYRnvOVjAOpPocw/3aPPeicF54cInyD/rcZm9qGSrcznyPGt/gwG9y3H23c3P 8k3sKXfIrp5BzYi9fjSzMvIZSlQ7zU0aPbEtvt0AQmLaqBfI9AbzDMpAFUjIWfLNTYFt a2WA== X-Gm-Message-State: AHPjjUgjrZg5sSaizVUkqhjGYssAb+kztY2KE8cWFEhB4Yt2SZYmUIHI VpwAO5CJwXPNUb/E08Yq8UgsHE4mI7Zaf+DDSYJ+Jw== X-Google-Smtp-Source: AOwi7QBHB7EkBaD2ZTYCKurHF+5NuL8Zx9oCbR4+xT/LPIB8QkLYqqGQJAivoc5Lx02e55HzfX0UO3T2iy6SBcBhEjc= X-Received: by 10.107.133.92 with SMTP id h89mr10514467iod.208.1506373739082; Mon, 25 Sep 2017 14:08:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.2.194 with HTTP; Mon, 25 Sep 2017 14:08:58 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:78f4:43db:b652:bfa7] In-Reply-To: <5584174.l2VGySiRAV@ralph.baldwin.cx> References: <201709231244.v8NCig1O037355@repo.freebsd.org> <32112779.upWhmOh2nn@ralph.baldwin.cx> <5584174.l2VGySiRAV@ralph.baldwin.cx> From: Warner Losh Date: Mon, 25 Sep 2017 15:08:58 -0600 X-Google-Sender-Auth: xz8EZMgML16lLAAG3KJHHC3jXzw Message-ID: Subject: Re: svn commit: r323952 - head/sys/boot/i386/libi386 To: John Baldwin Cc: Mariusz Zaborski , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 21:09:00 -0000 On Mon, Sep 25, 2017 at 12:30 PM, John Baldwin wrote: > On Saturday, September 23, 2017 08:50:48 AM John Baldwin wrote: > > On Saturday, September 23, 2017 12:44:42 PM Mariusz Zaborski wrote: > > > Author: oshogbo > > > Date: Sat Sep 23 12:44:42 2017 > > > New Revision: 323952 > > > URL: https://svnweb.freebsd.org/changeset/base/323952 > > > > > > Log: > > > After the r317886 support for TFTP and NFS can be enable > simultaneously. > > > > > > The cleanup of this distinction was done in the r318988, but this > Makefile > > > was omitted. > > > > > > Submitted by: kczekirda@ > > > > > > Modified: > > > head/sys/boot/i386/libi386/Makefile > > > > > > Modified: head/sys/boot/i386/libi386/Makefile > > > ============================================================ > ================== > > > --- head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:35:46 2017 > (r323951) > > > +++ head/sys/boot/i386/libi386/Makefile Sat Sep 23 12:44:42 2017 > (r323952) > > > @@ -12,10 +12,10 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c > biospnp > > > .PATH: ${.CURDIR}/../../zfs > > > SRCS+= devicename_stubs.c > > > > > > -# Enable PXE TFTP or NFS support, not both. > > > .if defined(LOADER_TFTP_SUPPORT) > > > CFLAGS+= -DLOADER_TFTP_SUPPORT > > > -.else > > > +.endif > > > +.if defined(LOADER_NFS_SUPPORT) > > > CFLAGS+= -DLOADER_NFS_SUPPORT > > > .endif > > > > Is LOADER_NFS_SUPPORT defined by default? If not, I think you just > turned off NFS > > in the default loader. > > I'm now less certain of this statement, but apart from "we should do > loader build > options better", I think it needs an answer one way or another. From what > I can tell, > all the other Makefiles under sys/boot have 'LOADER_NFS_SUPPORT?= yes' > except for > this one. OTOH, I can't find any code in libi386 that has an #ifdef > depending on > either LOADER_NFS_SUPPORT or LOADER_TFTP_SUPPORT. It seems to only be > used for > sys/boot/i386/loader.conf.c when deciding which filesystems to include > (and it > already includes both on i386). I wonder if this entire clause can just > be removed > from this Makefile and have it not even care at all about LOADER_*_SUPPORT? > > It seems that bapt@ removed the #ifdef's from pxe.c in r305125 so these > variables > aren't meaningful now? > I think you may be right... I'm hacking through doing load options better, because they suck right now. If someone else wants to eliminate these in the mean time, feel free. I'll cope. Warner From owner-svn-src-head@freebsd.org Mon Sep 25 21:23:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FE0DE24814; Mon, 25 Sep 2017 21:23:50 +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 1C0816A22C; Mon, 25 Sep 2017 21:23:50 +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 v8PLNnBm063829; Mon, 25 Sep 2017 21:23:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PLNnWt063827; Mon, 25 Sep 2017 21:23:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709252123.v8PLNnWt063827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 25 Sep 2017 21:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323996 - in head: . etc/mtree X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head: . etc/mtree X-SVN-Commit-Revision: 323996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 21:23:50 -0000 Author: bapt Date: Mon Sep 25 21:23:49 2017 New Revision: 323996 URL: https://svnweb.freebsd.org/changeset/base/323996 Log: Remove the cat pages directory now that catman(1) is gone Modified: head/ObsoleteFiles.inc head/etc/mtree/BSD.usr.dist Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Sep 25 20:44:40 2017 (r323995) +++ head/ObsoleteFiles.inc Mon Sep 25 21:23:49 2017 (r323996) @@ -44,6 +44,81 @@ OLD_FILES+=usr/bin/catman OLD_FILES+=usr/libexec/catman.local OLD_FILES+=usr/share/man/man1/catman.1.gz OLD_FILES+=usr/share/man/man8/catman.local.8.gz +OLD_DIRS+=usr/share/man/cat1 +OLD_DIRS+=usr/share/man/cat2 +OLD_DIRS+=usr/share/man/cat3 +OLD_DIRS+=usr/share/man/cat4/amd64 +OLD_DIRS+=usr/share/man/cat4/arm +OLD_DIRS+=usr/share/man/cat4/i386 +OLD_DIRS+=usr/share/man/cat4/powerpc +OLD_DIRS+=usr/share/man/cat4/sparc64 +OLD_DIRS+=usr/share/man/cat4 +OLD_DIRS+=usr/share/man/cat5 +OLD_DIRS+=usr/share/man/cat6 +OLD_DIRS+=usr/share/man/cat7 +OLD_DIRS+=usr/share/man/cat8/amd64 +OLD_DIRS+=usr/share/man/cat8/arm +OLD_DIRS+=usr/share/man/cat8/i386 +OLD_DIRS+=usr/share/man/cat8/powerpc +OLD_DIRS+=usr/share/man/cat8/sparc64 +OLD_DIRS+=usr/share/man/cat8 +OLD_DIRS+=usr/share/man/cat9 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat2 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat3 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat4/amd64 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat4/arm +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat4/i386 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat4/powerpc +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat4/sparc64 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat4 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat5 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat6 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat7 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat8/amd64 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat8/arm +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat8/i386 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat8/powerpc +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat8/sparc64 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat8 +OLD_DIRS+=usr/share/man/en.ISO8859-1/cat9 +OLD_DIRS+=usr/share/man/en.UTF-8/cat1 +OLD_DIRS+=usr/share/man/en.UTF-8/cat2 +OLD_DIRS+=usr/share/man/en.UTF-8/cat3 +OLD_DIRS+=usr/share/man/en.UTF-8/cat4/amd64 +OLD_DIRS+=usr/share/man/en.UTF-8/cat4/arm +OLD_DIRS+=usr/share/man/en.UTF-8/cat4/i386 +OLD_DIRS+=usr/share/man/en.UTF-8/cat4/powerpc +OLD_DIRS+=usr/share/man/en.UTF-8/cat4/sparc64 +OLD_DIRS+=usr/share/man/en.UTF-8/cat4 +OLD_DIRS+=usr/share/man/en.UTF-8/cat5 +OLD_DIRS+=usr/share/man/en.UTF-8/cat6 +OLD_DIRS+=usr/share/man/en.UTF-8/cat7 +OLD_DIRS+=usr/share/man/en.UTF-8/cat8/amd64 +OLD_DIRS+=usr/share/man/en.UTF-8/cat8/arm +OLD_DIRS+=usr/share/man/en.UTF-8/cat8/i386 +OLD_DIRS+=usr/share/man/en.UTF-8/cat8/powerpc +OLD_DIRS+=usr/share/man/en.UTF-8/cat8/sparc64 +OLD_DIRS+=usr/share/man/en.UTF-8/cat8 +OLD_DIRS+=usr/share/man/en.UTF-8/cat9 +OLD_DIRS+=usr/share/man/ja/cat1 +OLD_DIRS+=usr/share/man/ja/cat2 +OLD_DIRS+=usr/share/man/ja/cat3 +OLD_DIRS+=usr/share/man/ja/cat4/amd64 +OLD_DIRS+=usr/share/man/ja/cat4/arm +OLD_DIRS+=usr/share/man/ja/cat4/i386 +OLD_DIRS+=usr/share/man/ja/cat4/powerpc +OLD_DIRS+=usr/share/man/ja/cat4/sparc64 +OLD_DIRS+=usr/share/man/ja/cat4 +OLD_DIRS+=usr/share/man/ja/cat5 +OLD_DIRS+=usr/share/man/ja/cat6 +OLD_DIRS+=usr/share/man/ja/cat7 +OLD_DIRS+=usr/share/man/ja/cat8/amd64 +OLD_DIRS+=usr/share/man/ja/cat8/arm +OLD_DIRS+=usr/share/man/ja/cat8/powerpc +OLD_DIRS+=usr/share/man/ja/cat8/sparc64 +OLD_DIRS+=usr/share/man/ja/cat8 +OLD_DIRS+=usr/share/man/ja/cat9 # 20170802: ksyms(4) ioctl interface was removed OLD_FILES+=usr/include/sys/ksyms.h Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Mon Sep 25 20:44:40 2017 (r323995) +++ head/etc/mtree/BSD.usr.dist Mon Sep 25 21:23:49 2017 (r323996) @@ -807,139 +807,11 @@ .. .. man -/set uname=man - cat1 + en.ISO8859-1 .. - cat2 + en.UTF-8 .. - cat3 - .. - cat4 - amd64 - .. - arm - .. - i386 - .. - powerpc - .. - sparc64 - .. - .. - cat5 - .. - cat6 - .. - cat7 - .. - cat8 - amd64 - .. - i386 - .. - powerpc - .. - sparc64 - .. - .. - cat9 - .. - en.ISO8859-1 uname=root - cat1 - .. - cat2 - .. - cat3 - .. - cat4 - amd64 - .. - arm - .. - i386 - .. - powerpc - .. - sparc64 - .. - .. - cat5 - .. - cat6 - .. - cat7 - .. - cat8 - amd64 - .. - i386 - .. - powerpc - .. - sparc64 - .. - .. - cat9 - .. - .. - en.UTF-8 uname=root - cat1 - .. - cat2 - .. - cat3 - .. - cat4 - amd64 - .. - arm - .. - i386 - .. - powerpc - .. - sparc64 - .. - .. - cat5 - .. - cat6 - .. - cat7 - .. - cat8 - amd64 - .. - i386 - .. - powerpc - .. - sparc64 - .. - .. - cat9 - .. - .. - ja uname=root - cat1 - .. - cat2 - .. - cat3 - .. - cat4 - .. - cat5 - .. - cat6 - .. - cat7 - .. - cat8 - .. - cat9 - .. -/set uname=root + ja man1 .. man2 @@ -1298,18 +1170,8 @@ .. openssl man -/set uname=man - cat1 + en.ISO8859-1 .. - cat3 - .. - en.ISO8859-1 uname=root - cat1 - .. - cat3 - .. - .. -/set uname=root man1 .. man3 From owner-svn-src-head@freebsd.org Mon Sep 25 21:25:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE3FFE248B9; Mon, 25 Sep 2017 21:25:45 +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 A6F236A394; Mon, 25 Sep 2017 21:25:45 +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 v8PLPiKH012795 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Sep 2017 14:25:44 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v8PLPhCv012794; Mon, 25 Sep 2017 14:25:43 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 25 Sep 2017 14:25:43 -0700 From: Gleb Smirnoff To: Stephen Hurd Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323944 - in head/sys: kern sys Message-ID: <20170925212543.GX1055@FreeBSD.org> References: <201709230139.v8N1dGCi063544@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709230139.v8N1dGCi063544@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 21:25:45 -0000 Stephen, On Sat, Sep 23, 2017 at 01:39:16AM +0000, Stephen Hurd wrote: S> Author: shurd S> Date: Sat Sep 23 01:39:16 2017 S> New Revision: 323944 S> URL: https://svnweb.freebsd.org/changeset/base/323944 S> S> Log: S> Make struct grouptask gt_name member a char array S> S> Previously, it was just a pointer which was copied, but S> some callers pass in a stack variable which will go out of scope. S> Add GROUPTASK_NAMELEN macro (32) and snprintf() the name into it, S> using "grouptask" if name is NULL. We can now safely include S> gtask->gt_name in console messages. Have you estimated which structures include struct grouptask, so that they now got larger? Is this done only for the sake of console messages? -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Mon Sep 25 21:48:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9848E24FDC for ; Mon, 25 Sep 2017 21:48:44 +0000 (UTC) (envelope-from shurd@freebsd.org) Received: from fed1rmfepi101.cox.net (fed1rmfepi101.cox.net [68.230.241.132]) by mx1.freebsd.org (Postfix) with ESMTP id B57F76ADFA for ; Mon, 25 Sep 2017 21:48:44 +0000 (UTC) (envelope-from shurd@freebsd.org) Received: from fed1rmimpo306.cox.net ([68.230.241.174]) by fed1rmfepo203.cox.net (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20170925214643.BFFY30763.fed1rmfepo203.cox.net@fed1rmimpo306.cox.net> for ; Mon, 25 Sep 2017 17:46:43 -0400 Received: from [192.168.0.33] ([72.194.73.141]) by fed1rmimpo306.cox.net with cox id Dxmd1w00Y32uAN001xmen4; Mon, 25 Sep 2017 17:46:39 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A090206.59C9793F.004D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.2 cv=LdtM0nXi c=1 sm=1 tr=0 a=l4Y+EJuLrT/8f1z5FvEQ1g==:117 a=l4Y+EJuLrT/8f1z5FvEQ1g==:17 a=IkcTkHD0fZMA:10 a=6I5d2MoRAAAA:8 a=CPxIPFaeP-TbcODUjsoA:9 a=QEXdDO2ut3YA:10 a=IjZwj45LgO3ly-622nXo:22 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=myhuge@cox.net Subject: Re: svn commit: r323944 - in head/sys: kern sys To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709230139.v8N1dGCi063544@repo.freebsd.org> <20170925212543.GX1055@FreeBSD.org> From: Stephen Hurd Message-ID: <929758eb-c4b6-2d0f-9eb3-f2f15b545e58@FreeBSD.org> Date: Mon, 25 Sep 2017 14:46:37 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 In-Reply-To: <20170925212543.GX1055@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.23 Precedence: list List-Id: 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, 25 Sep 2017 21:48:45 -0000 Gleb Smirnoff wrote: > Stephen, > > On Sat, Sep 23, 2017 at 01:39:16AM +0000, Stephen Hurd wrote: > S> Author: shurd > S> Date: Sat Sep 23 01:39:16 2017 > S> New Revision: 323944 > S> URL: https://svnweb.freebsd.org/changeset/base/323944 > S> > S> Log: > S> Make struct grouptask gt_name member a char array > S> > S> Previously, it was just a pointer which was copied, but > S> some callers pass in a stack variable which will go out of scope. > S> Add GROUPTASK_NAMELEN macro (32) and snprintf() the name into it, > S> using "grouptask" if name is NULL. We can now safely include > S> gtask->gt_name in console messages. > > Have you estimated which structures include struct grouptask, so > that they now got larger? I did take a look through and didn't see anything alarming in either iflib or the linuxkpi stuff which seem to be the only consumers at this time. > Is this done only for the sake of console messages? I'm not sure yet. The member was already there and had pointers to the stack in it. Nothing appeared to be consuming it, but I noticed the error while working on console messages, so that's all it's used for now. I need to finish digging through the rest of the iflib backlog to see if there's another use for it. The safest change seemed to be making it part of the structure and reviewing the usage later. From owner-svn-src-head@freebsd.org Mon Sep 25 22:06:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA6CEE253FC; Mon, 25 Sep 2017 22:06:04 +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 93AAC6B690; Mon, 25 Sep 2017 22:06:04 +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 v8PM63Ye012975 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Sep 2017 15:06:03 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v8PM6342012974; Mon, 25 Sep 2017 15:06:03 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 25 Sep 2017 15:06:02 -0700 From: Gleb Smirnoff To: Stephen Hurd Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323944 - in head/sys: kern sys Message-ID: <20170925220602.GY1055@FreeBSD.org> References: <201709230139.v8N1dGCi063544@repo.freebsd.org> <20170925212543.GX1055@FreeBSD.org> <929758eb-c4b6-2d0f-9eb3-f2f15b545e58@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <929758eb-c4b6-2d0f-9eb3-f2f15b545e58@FreeBSD.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 22:06:04 -0000 On Mon, Sep 25, 2017 at 02:46:37PM -0700, Stephen Hurd wrote: S> > On Sat, Sep 23, 2017 at 01:39:16AM +0000, Stephen Hurd wrote: S> > S> Author: shurd S> > S> Date: Sat Sep 23 01:39:16 2017 S> > S> New Revision: 323944 S> > S> URL: https://svnweb.freebsd.org/changeset/base/323944 S> > S> S> > S> Log: S> > S> Make struct grouptask gt_name member a char array S> > S> S> > S> Previously, it was just a pointer which was copied, but S> > S> some callers pass in a stack variable which will go out of scope. S> > S> Add GROUPTASK_NAMELEN macro (32) and snprintf() the name into it, S> > S> using "grouptask" if name is NULL. We can now safely include S> > S> gtask->gt_name in console messages. S> > S> > Have you estimated which structures include struct grouptask, so S> > that they now got larger? S> S> I did take a look through and didn't see anything alarming in either S> iflib or the linuxkpi stuff which seem to be the only consumers at this S> time. S> S> > Is this done only for the sake of console messages? S> S> I'm not sure yet. The member was already there and had pointers to the S> stack in it. Nothing appeared to be consuming it, but I noticed the S> error while working on console messages, so that's all it's used for S> now. I need to finish digging through the rest of the iflib backlog to S> see if there's another use for it. S> S> The safest change seemed to be making it part of the structure and S> reviewing the usage later. Thanks. I don't know much about grouptask, but regular struct task is included in many structures throughout the kernel, that's why I express my concerns. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Mon Sep 25 23:24:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E52FFE26544; Mon, 25 Sep 2017 23:24:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A78BB6D425; Mon, 25 Sep 2017 23:24:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PNOf0c012968; Mon, 25 Sep 2017 23:24:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PNOfDl012967; Mon, 25 Sep 2017 23:24:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709252324.v8PNOfDl012967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 25 Sep 2017 23:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323997 - head/contrib/gcc/config/arm X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/contrib/gcc/config/arm X-SVN-Commit-Revision: 323997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 23:24:43 -0000 Author: ian Date: Mon Sep 25 23:24:41 2017 New Revision: 323997 URL: https://svnweb.freebsd.org/changeset/base/323997 Log: Fix handling of uncaught exceptions in a std::terminate() handler on arm. When raising an exception, the unwinder searches for a catch handler and if none is found it should invoke std::terminate() with the uncaught exception as the "current" exception. Before this change, the terminate handler was invoked with no exception as current (abi::__cxa_current_exception_type() returned NULL), because the return value from the unwinder indicated an internal failure in unwinding. It turns out that was because all errors from get_eit_entry() were translated to _URC_FAILURE. Now the error is returned untranslated, which allows _URC_END_OF_STACK to percolate upwards to throw_exception() in libcxxrt. When it sees that return status it properly calls std::terminate() with the uncaught exception installed as the current exception, allowing custom terminate handlers to work with it. Modified: head/contrib/gcc/config/arm/unwind-arm.c Modified: head/contrib/gcc/config/arm/unwind-arm.c ============================================================================== --- head/contrib/gcc/config/arm/unwind-arm.c Mon Sep 25 21:23:49 2017 (r323996) +++ head/contrib/gcc/config/arm/unwind-arm.c Mon Sep 25 23:24:41 2017 (r323997) @@ -625,8 +625,8 @@ __gnu_Unwind_RaiseException (_Unwind_Control_Block * u do { /* Find the entry for this routine. */ - if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK) - return _URC_FAILURE; + if ((pr_result = get_eit_entry (ucbp, saved_vrs.core.r[R_PC])) != _URC_OK) + return pr_result; /* Call the pr to decide what to do. */ pr_result = ((personality_routine) UCB_PR_ADDR (ucbp)) From owner-svn-src-head@freebsd.org Mon Sep 25 23:50:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94C15E26957; Mon, 25 Sep 2017 23:50:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5577C6DBFA; Mon, 25 Sep 2017 23:50:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PNoAen021281; Mon, 25 Sep 2017 23:50:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PNoAMS021280; Mon, 25 Sep 2017 23:50:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709252350.v8PNoAMS021280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 25 Sep 2017 23:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323998 - head/contrib/gcc/config/arm X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/contrib/gcc/config/arm X-SVN-Commit-Revision: 323998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Sep 2017 23:50:11 -0000 Author: ian Date: Mon Sep 25 23:50:10 2017 New Revision: 323998 URL: https://svnweb.freebsd.org/changeset/base/323998 Log: Fix the return value from _Unwind_Backtrace() on arm. If unwinding stops due to hitting the end of the call chain, the return value is supposed to be _URC_END_OF_STACK; other values indicate internal errors. The return value from get_eit_entry() is now returned without translating it to _URC_FAILURE, so that callers can see _URC_END_OF_STACK when it happens. Modified: head/contrib/gcc/config/arm/unwind-arm.c Modified: head/contrib/gcc/config/arm/unwind-arm.c ============================================================================== --- head/contrib/gcc/config/arm/unwind-arm.c Mon Sep 25 23:24:41 2017 (r323997) +++ head/contrib/gcc/config/arm/unwind-arm.c Mon Sep 25 23:50:10 2017 (r323998) @@ -773,11 +773,8 @@ __gnu_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * do { /* Find the entry for this routine. */ - if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK) - { - code = _URC_FAILURE; + if ((code = get_eit_entry (ucbp, saved_vrs.core.r[R_PC])) != _URC_OK) break; - } /* The dwarf unwinder assumes the context structure holds things like the function and LSDA pointers. The ARM implementation From owner-svn-src-head@freebsd.org Tue Sep 26 01:31:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1861BE29503; Tue, 26 Sep 2017 01:31: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 DA3FF7098C; Tue, 26 Sep 2017 01:31: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 v8Q1VnoE066047; Tue, 26 Sep 2017 01:31:49 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8Q1VnJd066045; Tue, 26 Sep 2017 01:31:49 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709260131.v8Q1VnJd066045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 26 Sep 2017 01:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323999 - in head: sys/opencrypto tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/opencrypto tests/sys/opencrypto X-SVN-Commit-Revision: 323999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 01:31:51 -0000 Author: cem Date: Tue Sep 26 01:31:49 2017 New Revision: 323999 URL: https://svnweb.freebsd.org/changeset/base/323999 Log: crypto(9): Use a more specific error code when a capable driver is not found When crypto_newsession() is given a request for an unsupported capability, raise a more specific error than EINVAL. This allows cryptotest.py to skip some HMAC tests that a driver does not support. Reviewed by: jhb, rlibby Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12451 Modified: head/sys/opencrypto/crypto.c head/tests/sys/opencrypto/cryptotest.py Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Mon Sep 25 23:50:10 2017 (r323998) +++ head/sys/opencrypto/crypto.c Tue Sep 26 01:31:49 2017 (r323999) @@ -460,7 +460,7 @@ crypto_newsession(u_int64_t *sid, struct cryptoini *cr CRYPTDEB("dev newsession failed"); } else { CRYPTDEB("no driver"); - err = EINVAL; + err = EOPNOTSUPP; } CRYPTO_DRIVER_UNLOCK(); return err; Modified: head/tests/sys/opencrypto/cryptotest.py ============================================================================== --- head/tests/sys/opencrypto/cryptotest.py Mon Sep 25 23:50:10 2017 (r323998) +++ head/tests/sys/opencrypto/cryptotest.py Tue Sep 26 01:31:49 2017 (r323999) @@ -30,6 +30,7 @@ # from __future__ import print_function +import errno import cryptodev import itertools import os @@ -284,8 +285,14 @@ def GenTestCase(cname): if len(key) > blocksize: continue - c = Crypto(mac=alg, mackey=key, - crid=crid) + try: + c = Crypto(mac=alg, mackey=key, + crid=crid) + except EnvironmentError, e: + # Can't test hashes the driver does not support. + if e.errno != errno.EOPNOTSUPP: + raise + continue _, r = c.encrypt(msg, iv="") From owner-svn-src-head@freebsd.org Tue Sep 26 05:33:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C95DE2FA5E; Tue, 26 Sep 2017 05:33:16 +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 0C430773DE; Tue, 26 Sep 2017 05:33:15 +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 v8Q5XFPR066088; Tue, 26 Sep 2017 05:33:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8Q5XFMV066087; Tue, 26 Sep 2017 05:33:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709260533.v8Q5XFMV066087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 26 Sep 2017 05:33:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324000 - head X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 324000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 05:33:16 -0000 Author: bapt Date: Tue Sep 26 05:33:15 2017 New Revision: 324000 URL: https://svnweb.freebsd.org/changeset/base/324000 Log: Do not print error when running make delete-old on system without catpages directories Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Sep 26 01:31:49 2017 (r323999) +++ head/Makefile.inc1 Tue Sep 26 05:33:15 2017 (r324000) @@ -2559,7 +2559,7 @@ delete-old-files: .PHONY done # Remove catpages without corresponding manpages. @exec 3<&0; \ - find ${DESTDIR}/usr/share/man/cat* ! -type d | \ + find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | \ sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ while read catpage; do \ read manpage; \ From owner-svn-src-head@freebsd.org Tue Sep 26 05:43:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AD96E2FEFA; Tue, 26 Sep 2017 05:43:57 +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 269D877B3C; Tue, 26 Sep 2017 05:43:57 +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 v8Q5hueO070021; Tue, 26 Sep 2017 05:43:56 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8Q5hu0O070019; Tue, 26 Sep 2017 05:43:56 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709260543.v8Q5hu0O070019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 26 Sep 2017 05:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324001 - in head: . etc/mtree X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head: . etc/mtree X-SVN-Commit-Revision: 324001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 05:43:57 -0000 Author: bapt Date: Tue Sep 26 05:43:55 2017 New Revision: 324001 URL: https://svnweb.freebsd.org/changeset/base/324001 Log: Remove unneeded locales and alias man directories In base, locales (and encoding) specific directories are not used by any tool. Just remove them. While here also remove the cat page directory for openssl Modified: head/ObsoleteFiles.inc head/etc/mtree/BSD.usr.dist Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Sep 26 05:33:15 2017 (r324000) +++ head/ObsoleteFiles.inc Tue Sep 26 05:43:55 2017 (r324001) @@ -38,6 +38,45 @@ # xargs -n1 | sort | uniq -d; # done +# 20170926: remove unneeded man aliases and locales directory +OLD_FILES+=usr/share/man/en.ISO8859-1/man1 +OLD_FILES+=usr/share/man/en.ISO8859-1/man2 +OLD_FILES+=usr/share/man/en.ISO8859-1/man3 +OLD_FILES+=usr/share/man/en.ISO8859-1/man4 +OLD_FILES+=usr/share/man/en.ISO8859-1/man5 +OLD_FILES+=usr/share/man/en.ISO8859-1/man6 +OLD_FILES+=usr/share/man/en.ISO8859-1/man7 +OLD_FILES+=usr/share/man/en.ISO8859-1/man8 +OLD_FILES+=usr/share/man/en.ISO8859-1/man9 +OLD_DIRS+=usr/share/man/en.ISO8859-1 +OLD_FILES+=usr/share/man/en.ISO8859-1/mandoc.db +OLD_FILES+=usr/share/man/en.UTF-8/man1 +OLD_FILES+=usr/share/man/en.UTF-8/man2 +OLD_FILES+=usr/share/man/en.UTF-8/man3 +OLD_FILES+=usr/share/man/en.UTF-8/man4 +OLD_FILES+=usr/share/man/en.UTF-8/man5 +OLD_FILES+=usr/share/man/en.UTF-8/man6 +OLD_FILES+=usr/share/man/en.UTF-8/man7 +OLD_FILES+=usr/share/man/en.UTF-8/man8 +OLD_FILES+=usr/share/man/en.UTF-8/man9 +OLD_FILES+=usr/share/man/en.UTF-8/mandoc.db +OLD_DIRS+=usr/share/man/en.UTF-8 +OLD_FILES+=usr/share/man/en.ISO8859-15 +OLD_FILES+=usr/share/openssl/man/en.ISO8859-1/man1 +OLD_FILES+=usr/share/openssl/man/en.ISO8859-1/man3 +OLD_FILES+=usr/share/openssl/man/en.ISO8859-1/mandoc.db +OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1 +OLD_FILES+=usr/share/openssl/man/en.ISO8859-15 +OLD_DIRS+=usr/share/man/ja/man1 +OLD_DIRS+=usr/share/man/ja/man2 +OLD_DIRS+=usr/share/man/ja/man3 +OLD_DIRS+=usr/share/man/ja/man4 +OLD_DIRS+=usr/share/man/ja/man5 +OLD_DIRS+=usr/share/man/ja/man6 +OLD_DIRS+=usr/share/man/ja/man7 +OLD_DIRS+=usr/share/man/ja/man8 +OLD_DIRS+=usr/share/man/ja/man9 +OLD_DIRS+=usr/share/man/ja # 20170913: remove unneeded catman utility OLD_FILES+=etc/periodic/weekly/330.catman OLD_FILES+=usr/bin/catman @@ -119,7 +158,10 @@ OLD_DIRS+=usr/share/man/ja/cat8/powerpc OLD_DIRS+=usr/share/man/ja/cat8/sparc64 OLD_DIRS+=usr/share/man/ja/cat8 OLD_DIRS+=usr/share/man/ja/cat9 - +OLD_DIRS+=usr/share/openssl/man/cat1 +OLD_DIRS+=usr/share/openssl/man/cat3 +OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat1 +OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat3 # 20170802: ksyms(4) ioctl interface was removed OLD_FILES+=usr/include/sys/ksyms.h Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Tue Sep 26 05:33:15 2017 (r324000) +++ head/etc/mtree/BSD.usr.dist Tue Sep 26 05:43:55 2017 (r324001) @@ -807,30 +807,6 @@ .. .. man - en.ISO8859-1 - .. - en.UTF-8 - .. - ja - man1 - .. - man2 - .. - man3 - .. - man4 - .. - man5 - .. - man6 - .. - man7 - .. - man8 - .. - man9 - .. - .. man1 .. man2 @@ -1170,8 +1146,6 @@ .. openssl man - en.ISO8859-1 - .. man1 .. man3 From owner-svn-src-head@freebsd.org Tue Sep 26 05:46:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53A03E00024; Tue, 26 Sep 2017 05:46:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22DB677D1D; Tue, 26 Sep 2017 05:46:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8Q5kA0d070161; Tue, 26 Sep 2017 05:46:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8Q5kAwP070160; Tue, 26 Sep 2017 05:46:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709260546.v8Q5kAwP070160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 26 Sep 2017 05:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324002 - head/etc X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/etc X-SVN-Commit-Revision: 324002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 05:46:11 -0000 Author: bapt Date: Tue Sep 26 05:46:10 2017 New Revision: 324002 URL: https://svnweb.freebsd.org/changeset/base/324002 Log: Do not actually install uneeded alias for man Deleted: head/etc/man.alias Modified: head/etc/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Tue Sep 26 05:43:55 2017 (r324001) +++ head/etc/Makefile Tue Sep 26 05:46:10 2017 (r324002) @@ -395,31 +395,6 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY done; true .endif ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys -.if ${MK_MAN} != "no" - cd ${DESTDIR}${SHAREDIR}/man; \ - for mandir in man*; do \ - ${INSTALL_SYMLINK} ../$$mandir \ - ${DESTDIR}${SHAREDIR}/man/en.ISO8859-1/; \ - ${INSTALL_SYMLINK} ../$$mandir \ - ${DESTDIR}${SHAREDIR}/man/en.UTF-8/; \ - done -.if ${MK_OPENSSL} != "no" - cd ${DESTDIR}${SHAREDIR}/openssl/man; \ - for mandir in man*; do \ - ${INSTALL_SYMLINK} ../$$mandir \ - ${DESTDIR}${SHAREDIR}/openssl/man/en.ISO8859-1/; \ - done -.endif - set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \ - while [ $$# -gt 0 ] ; do \ - ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/man/$$1"; \ - if [ "${MK_OPENSSL}" != "no" ]; then \ - ${INSTALL_SYMLINK} "$$2" \ - "${DESTDIR}${SHAREDIR}/openssl/man/$$1"; \ - fi; \ - shift; shift; \ - done -.endif .if ${MK_NLS} != "no" set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \ while [ $$# -gt 0 ] ; do \ From owner-svn-src-head@freebsd.org Tue Sep 26 05:47:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D055E000E9; Tue, 26 Sep 2017 05:47:35 +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 EB8E27C047; Tue, 26 Sep 2017 05:47: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 v8Q5lYDO070245; Tue, 26 Sep 2017 05:47:34 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8Q5lX1V070244; Tue, 26 Sep 2017 05:47:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709260547.v8Q5lX1V070244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 26 Sep 2017 05:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324003 - head X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 324003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 05:47:35 -0000 Author: bapt Date: Tue Sep 26 05:47:33 2017 New Revision: 324003 URL: https://svnweb.freebsd.org/changeset/base/324003 Log: Remove empty lines for consistency with other entries Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Sep 26 05:46:10 2017 (r324002) +++ head/ObsoleteFiles.inc Tue Sep 26 05:47:33 2017 (r324003) @@ -164,7 +164,6 @@ OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat1 OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat3 # 20170802: ksyms(4) ioctl interface was removed OLD_FILES+=usr/include/sys/ksyms.h - # 20170722: new clang import which bumps version from 4.0.0 to 5.0.0. OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/asan_interface.h From owner-svn-src-head@freebsd.org Tue Sep 26 09:18:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA243E04647; Tue, 26 Sep 2017 09:18:19 +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 8807F82202; Tue, 26 Sep 2017 09:18:19 +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 v8Q9II3V056930; Tue, 26 Sep 2017 09:18:18 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8Q9II14056929; Tue, 26 Sep 2017 09:18:18 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709260918.v8Q9II14056929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 09:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324007 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 324007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 09:18:19 -0000 Author: manu Date: Tue Sep 26 09:18:18 2017 New Revision: 324007 URL: https://svnweb.freebsd.org/changeset/base/324007 Log: mountd: Replace malloc+strcpy to strdup Reviewed by: bapt MFC after: 1 week Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D12503 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Sep 26 09:01:56 2017 (r324006) +++ head/usr.sbin/mountd/mountd.c Tue Sep 26 09:18:18 2017 (r324007) @@ -101,7 +101,7 @@ struct dirlist { struct dirlist *dp_right; int dp_flag; struct hostlist *dp_hosts; /* List of hosts this dir exported to */ - char dp_dirp[1]; /* Actually malloc'd to size of dir */ + char *dp_dirp; }; /* dp_flag bits */ #define DP_DEFSET 0x1 @@ -1525,12 +1525,8 @@ get_exportlist_one(void) if (ep == (struct exportlist *)NULL) { ep = get_exp(); ep->ex_fs = fsb.f_fsid; - ep->ex_fsdir = (char *)malloc - (strlen(fsb.f_mntonname) + 1); - if (ep->ex_fsdir) - strcpy(ep->ex_fsdir, - fsb.f_mntonname); - else + ep->ex_fsdir = strdup(fsb.f_mntonname); + if (ep->ex_fsdir == NULL) out_of_mem(); if (debug) warnx( @@ -1940,14 +1936,16 @@ add_expdir(struct dirlist **dpp, char *cp, int len) { struct dirlist *dp; - dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len); + dp = (struct dirlist *)malloc(sizeof (struct dirlist)); if (dp == (struct dirlist *)NULL) out_of_mem(); dp->dp_left = *dpp; dp->dp_right = (struct dirlist *)NULL; dp->dp_flag = 0; dp->dp_hosts = (struct hostlist *)NULL; - strcpy(dp->dp_dirp, cp); + dp->dp_dirp = strndup(cp, len); + if (dp->dp_dirp == NULL) + out_of_mem(); *dpp = dp; return (dp->dp_dirp); } From owner-svn-src-head@freebsd.org Tue Sep 26 09:18:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A1CCE046E9; Tue, 26 Sep 2017 09:18:51 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D2C8382355; Tue, 26 Sep 2017 09:18:50 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id v8Q9IcAo033286 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Sep 2017 11:18:39 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: glebius@FreeBSD.org Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id v8Q9IZI0093629; Tue, 26 Sep 2017 16:18:35 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: svn commit: r323873 - head/sys/netgraph To: Gleb Smirnoff References: <201709212016.v8LKGBMi024412@repo.freebsd.org> <20170925205929.GW1055@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Eugene Grosbein Message-ID: <59CA1B6B.5070907@grosbein.net> Date: Tue, 26 Sep 2017 16:18:35 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20170925205929.GW1055@FreeBSD.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: Yes, score=5.5 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_96_Q, LOCAL_FROM,RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * 3.3 DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: date * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-Spam-Flag: YES X-Spam-Level: ***** X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 09:18:51 -0000 On 26.09.2017 03:59, Gleb Smirnoff wrote: > On Thu, Sep 21, 2017 at 08:16:11PM +0000, Eugene Grosbein wrote: > E> Author: eugen (ports committer) > E> Date: Thu Sep 21 20:16:10 2017 > E> New Revision: 323873 > E> URL: https://svnweb.freebsd.org/changeset/base/323873 > E> > E> Log: > E> Unprotected modification of ng_iface(4) private data leads to kernel panic. > E> Fix a race with per-node read-mostly lock and refcounting for a hook. > > The patch is far from ideal. Netgraph already has internal locking, > which guarantess write semantics for "disconnect" and "newhook" > scenarios. As well as read semantics for "rcvdata". > > Since ng_iface is a gate node, that gates data between netgraph and the > big network stack, it of course needs extra locking in the interface > output method. But better piggyback on the netgraph locking, rather than > add your own, IMHO. I'm afraid you have not read the change well enough. It does utilizes generic netgraph locking like NG_HOOK_REF(hook) for entities visible to base netgraph code. And it uses own locking only to protect private ng_iface structures from parallel modifications with another kernel thread runnning same ng_iface code. It uses lightweight rmlock there as that is network hot path and anyway, other netgraph code has nothing to do with node's private data. From owner-svn-src-head@freebsd.org Tue Sep 26 10:25:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 915A7E05EBA; Tue, 26 Sep 2017 10:25:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B5DEA5C; Tue, 26 Sep 2017 10:25:05 +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 v8QAOvEL099419 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 26 Sep 2017 13:24:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v8QAOvEL099419 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v8QAOvA8099418; Tue, 26 Sep 2017 13:24:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 26 Sep 2017 13:24:57 +0300 From: Konstantin Belousov To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324007 - head/usr.sbin/mountd Message-ID: <20170926102457.GG2271@kib.kiev.ua> References: <201709260918.v8Q9II14056929@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709260918.v8Q9II14056929@repo.freebsd.org> User-Agent: Mutt/1.9.0 (2017-09-02) 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.23 Precedence: list List-Id: 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, 26 Sep 2017 10:25:06 -0000 On Tue, Sep 26, 2017 at 09:18:18AM +0000, Emmanuel Vadot wrote: > @@ -1940,14 +1936,16 @@ add_expdir(struct dirlist **dpp, char *cp, int len) > { > struct dirlist *dp; > > - dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len); > + dp = (struct dirlist *)malloc(sizeof (struct dirlist)); You might remove the unneeded cast as well. From owner-svn-src-head@freebsd.org Tue Sep 26 11:04:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEA11E06C3F; Tue, 26 Sep 2017 11:04:10 +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 408821DB4; Tue, 26 Sep 2017 11:04:10 +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 v8QB49Qn002330; Tue, 26 Sep 2017 11:04:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QB480K002320; Tue, 26 Sep 2017 11:04:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709261104.v8QB480K002320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 26 Sep 2017 11:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324011 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/cddl/contrib/opensolaris/uts/... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Commit-Revision: 324011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 11:04:10 -0000 Author: avg Date: Tue Sep 26 11:04:08 2017 New Revision: 324011 URL: https://svnweb.freebsd.org/changeset/base/324011 Log: MFV r323535: 8585 improve batching done in zil_commit() FreeBSD notes: - this MFV reverts FreeBSD commit r314549 to make the merge easier - at present our emulation of cv_timedwait_hires is rather poor, so I elected to use cv_timedwait_sbt directly Please see the differential revision for details. Unfortunately, I did not get any positive reviews, so there could be bugs in the FreeBSD-specific piece of the merge. Hence, the long MFC timeout. illumos/illumos-gate@1271e4b10dfaaed576c08a812f466f6e81370e5e https://github.com/illumos/illumos-gate/commit/1271e4b10dfaaed576c08a812f466f6e81370e5e https://www.illumos.org/issues/8585 The current implementation of zil_commit() can introduce significant latency, beyond what is inherent due to the latency of the underlying storage. The additional latency comes from two main problems: 1. When there's outstanding ZIL blocks being written (i.e. there's already a "writer thread" in progress), then any new calls to zil_commit() will block waiting for the currently oustanding ZIL blocks to complete. The blocks written for each "writer thread" is coined a "batch", and there can only ever be a single "batch" being written at a time. When a batch is being written, any new ZIL transactions will have to wait for the next batch to be written, which won't occur until the current batch finishes. As a result, the underlying storage may not be used as efficiently as possible. While "new" threads enter zil_commit() and are blocked waiting for the next batch, it's possible that the underlying storage isn't fully utilized by the current batch of ZIL blocks. In that case, it'd be better to allow these new threads to generate (and issue) a new ZIL block, such that it could be serviced by the underlying storage concurrently with the other ZIL blocks that are being serviced. 2. Any call to zil_commit() must wait for all ZIL blocks in its "batch" to complete, prior to zil_commit() returning. The size of any given batch is proportional to the number of ZIL transaction in the queue at the time that the batch starts processing the queue; which doesn't occur until the previous batch completes. Thus, if there's a lot of transactions in the queue, the batch could be composed of many ZIL blocks, and each call to zil_commit() will have to wait for all of these writes to complete (even if the thread calling zil_commit() only cared about one of the transactions in the batch). Reviewed by: Brad Lewis Reviewed by: Matt Ahrens Reviewed by: George Wilson Approved by: Dan McDonald Author: Prakash Surya MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12355 Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Sep 26 09:34:18 2017 (r324010) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Sep 26 11:04:08 2017 (r324011) @@ -1825,13 +1825,14 @@ ztest_get_done(zgd_t *zgd, int error) ztest_object_unlock(zd, object); if (error == 0 && zgd->zgd_bp) - zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); + zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp); umem_free(zgd, sizeof (*zgd)); } static int -ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) +ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, + zio_t *zio) { ztest_ds_t *zd = arg; objset_t *os = zd->zd_os; @@ -1845,6 +1846,10 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z zgd_t *zgd; int error; + ASSERT3P(lwb, !=, NULL); + ASSERT3P(zio, !=, NULL); + ASSERT3U(size, !=, 0); + ztest_object_lock(zd, object, RL_READER); error = dmu_bonus_hold(os, object, FTAG, &db); if (error) { @@ -1865,7 +1870,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z db = NULL; zgd = umem_zalloc(sizeof (*zgd), UMEM_NOFAIL); - zgd->zgd_zilog = zd->zd_zilog; + zgd->zgd_lwb = lwb; zgd->zgd_private = zd; if (buf != NULL) { /* immediate write */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Sep 26 11:04:08 2017 (r324011) @@ -1728,6 +1728,13 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy return (SET_ERROR(EIO)); } + /* + * In order to prevent the zgd's lwb from being free'd prior to + * dmu_sync_late_arrival_done() being called, we have to ensure + * the lwb's "max txg" takes this tx's txg into account. + */ + zil_lwb_add_txg(zgd->zgd_lwb, dmu_tx_get_txg(tx)); + dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP); dsa->dsa_dr = NULL; dsa->dsa_done = done; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue Sep 26 11:04:08 2017 (r324011) @@ -920,7 +920,7 @@ uint64_t dmu_tx_get_txg(dmu_tx_t *tx); * {zfs,zvol,ztest}_get_done() args */ typedef struct zgd { - struct zilog *zgd_zilog; + struct lwb *zgd_lwb; struct blkptr *zgd_bp; dmu_buf_t *zgd_db; struct rl *zgd_rl; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue Sep 26 11:04:08 2017 (r324011) @@ -40,6 +40,7 @@ extern "C" { struct dsl_pool; struct dsl_dataset; +struct lwb; /* * Intent log format: @@ -140,6 +141,7 @@ typedef enum zil_create { /* * Intent log transaction types and record structures */ +#define TX_COMMIT 0 /* Commit marker (no on-disk state) */ #define TX_CREATE 1 /* Create file */ #define TX_MKDIR 2 /* Make directory */ #define TX_MKXATTR 3 /* Make XATTR directory */ @@ -388,7 +390,8 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, blkpt typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); typedef int zil_replay_func_t(); -typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio); +typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, + struct lwb *lwb, zio_t *zio); extern int zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func, zil_parse_lr_func_t *parse_lr_func, void *arg, uint64_t txg); @@ -427,7 +430,8 @@ extern void zil_clean(zilog_t *zilog, uint64_t synced_ extern int zil_suspend(const char *osname, void **cookiep); extern void zil_resume(void *cookie); -extern void zil_add_block(zilog_t *zilog, const blkptr_t *bp); +extern void zil_lwb_add_block(struct lwb *lwb, const blkptr_t *bp); +extern void zil_lwb_add_txg(struct lwb *lwb, uint64_t txg); extern int zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp); extern void zil_set_sync(zilog_t *zilog, uint64_t syncval); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Tue Sep 26 11:04:08 2017 (r324011) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -37,22 +37,76 @@ extern "C" { #endif /* - * Log write buffer. + * Possbile states for a given lwb structure. An lwb will start out in + * the "closed" state, and then transition to the "opened" state via a + * call to zil_lwb_write_open(). After the lwb is "open", it can + * transition into the "issued" state via zil_lwb_write_issue(). After + * the lwb's zio completes, and the vdev's are flushed, the lwb will + * transition into the "done" state via zil_lwb_write_done(), and the + * structure eventually freed. */ +typedef enum { + LWB_STATE_CLOSED, + LWB_STATE_OPENED, + LWB_STATE_ISSUED, + LWB_STATE_DONE, + LWB_NUM_STATES +} lwb_state_t; + +/* + * Log write block (lwb) + * + * Prior to an lwb being issued to disk via zil_lwb_write_issue(), it + * will be protected by the zilog's "zl_writer_lock". Basically, prior + * to it being issued, it will only be accessed by the thread that's + * holding the "zl_writer_lock". After the lwb is issued, the zilog's + * "zl_lock" is used to protect the lwb against concurrent access. + */ typedef struct lwb { zilog_t *lwb_zilog; /* back pointer to log struct */ blkptr_t lwb_blk; /* on disk address of this log blk */ boolean_t lwb_slog; /* lwb_blk is on SLOG device */ int lwb_nused; /* # used bytes in buffer */ int lwb_sz; /* size of block and buffer */ + lwb_state_t lwb_state; /* the state of this lwb */ char *lwb_buf; /* log write buffer */ - zio_t *lwb_zio; /* zio for this buffer */ + zio_t *lwb_write_zio; /* zio for the lwb buffer */ + zio_t *lwb_root_zio; /* root zio for lwb write and flushes */ dmu_tx_t *lwb_tx; /* tx for log block allocation */ uint64_t lwb_max_txg; /* highest txg in this lwb */ list_node_t lwb_node; /* zilog->zl_lwb_list linkage */ + list_t lwb_waiters; /* list of zil_commit_waiter's */ + avl_tree_t lwb_vdev_tree; /* vdevs to flush after lwb write */ + kmutex_t lwb_vdev_lock; /* protects lwb_vdev_tree */ + hrtime_t lwb_issued_timestamp; /* when was the lwb issued? */ } lwb_t; /* + * ZIL commit waiter. + * + * This structure is allocated each time zil_commit() is called, and is + * used by zil_commit() to communicate with other parts of the ZIL, such + * that zil_commit() can know when it safe for it return. For more + * details, see the comment above zil_commit(). + * + * The "zcw_lock" field is used to protect the commit waiter against + * concurrent access. This lock is often acquired while already holding + * the zilog's "zl_writer_lock" or "zl_lock"; see the functions + * zil_process_commit_list() and zil_lwb_flush_vdevs_done() as examples + * of this. Thus, one must be careful not to acquire the + * "zl_writer_lock" or "zl_lock" when already holding the "zcw_lock"; + * e.g. see the zil_commit_waiter_timeout() function. + */ +typedef struct zil_commit_waiter { + kcondvar_t zcw_cv; /* signalled when "done" */ + kmutex_t zcw_lock; /* protects fields of this struct */ + list_node_t zcw_node; /* linkage in lwb_t:lwb_waiter list */ + lwb_t *zcw_lwb; /* back pointer to lwb when linked */ + boolean_t zcw_done; /* B_TRUE when "done", else B_FALSE */ + int zcw_zio_error; /* contains the zio io_error value */ +} zil_commit_waiter_t; + +/* * Intent log transaction lists */ typedef struct itxs { @@ -94,20 +148,20 @@ struct zilog { const zil_header_t *zl_header; /* log header buffer */ objset_t *zl_os; /* object set we're logging */ zil_get_data_t *zl_get_data; /* callback to get object content */ - zio_t *zl_root_zio; /* log writer root zio */ + lwb_t *zl_last_lwb_opened; /* most recent lwb opened */ + hrtime_t zl_last_lwb_latency; /* zio latency of last lwb done */ uint64_t zl_lr_seq; /* on-disk log record sequence number */ uint64_t zl_commit_lr_seq; /* last committed on-disk lr seq */ uint64_t zl_destroy_txg; /* txg of last zil_destroy() */ uint64_t zl_replayed_seq[TXG_SIZE]; /* last replayed rec seq */ uint64_t zl_replaying_seq; /* current replay seq number */ uint32_t zl_suspend; /* log suspend count */ - kcondvar_t zl_cv_writer; /* log writer thread completion */ kcondvar_t zl_cv_suspend; /* log suspend completion */ uint8_t zl_suspending; /* log is currently suspending */ uint8_t zl_keep_first; /* keep first log block in destroy */ uint8_t zl_replay; /* replaying records while set */ uint8_t zl_stop_sync; /* for debugging */ - uint8_t zl_writer; /* boolean: write setup in progress */ + kmutex_t zl_writer_lock; /* single writer, per ZIL, at a time */ uint8_t zl_logbias; /* latency or throughput */ uint8_t zl_sync; /* synchronous or asynchronous */ int zl_parse_error; /* last zil_parse() error */ @@ -115,15 +169,10 @@ struct zilog { uint64_t zl_parse_lr_seq; /* highest lr seq on last parse */ uint64_t zl_parse_blk_count; /* number of blocks parsed */ uint64_t zl_parse_lr_count; /* number of log records parsed */ - uint64_t zl_next_batch; /* next batch number */ - uint64_t zl_com_batch; /* committed batch number */ - kcondvar_t zl_cv_batch[2]; /* batch condition variables */ itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */ list_t zl_itx_commit_list; /* itx list to be committed */ uint64_t zl_cur_used; /* current commit log size used */ list_t zl_lwb_list; /* in-flight log write list */ - kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ - avl_tree_t zl_vdev_tree; /* vdevs to flush in zil_commit() */ avl_tree_t zl_bp_tree; /* track bps during log parse */ clock_t zl_replay_time; /* lbolt of when replay started */ uint64_t zl_replay_blks; /* number of log blocks replayed */ @@ -131,6 +180,7 @@ struct zilog { uint_t zl_prev_blks[ZIL_PREV_BLKS]; /* size - sector rounded */ uint_t zl_prev_rotor; /* rotor for zl_prev[] */ txg_node_t zl_dirty_link; /* protected by dp_dirty_zilogs list */ + uint64_t zl_dirty_max_txg; /* highest txg used to dirty zilog */ }; typedef struct zil_bp_node { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Tue Sep 26 11:04:08 2017 (r324011) @@ -593,6 +593,7 @@ extern enum zio_checksum zio_checksum_dedup_select(spa extern enum zio_compress zio_compress_select(spa_t *spa, enum zio_compress child, enum zio_compress parent); +extern void zio_cancel(zio_t *zio); extern void zio_suspend(spa_t *spa, zio_t *zio); extern int zio_resume(spa_t *spa); extern void zio_resume_wait(spa_t *spa); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Sep 26 11:04:08 2017 (r324011) @@ -163,7 +163,7 @@ txg_fini(dsl_pool_t *dp) tx_state_t *tx = &dp->dp_tx; int c; - ASSERT(tx->tx_threads == 0); + ASSERT0(tx->tx_threads); mutex_destroy(&tx->tx_sync_lock); @@ -204,7 +204,7 @@ txg_sync_start(dsl_pool_t *dp) dprintf("pool %p\n", dp); - ASSERT(tx->tx_threads == 0); + ASSERT0(tx->tx_threads); tx->tx_threads = 2; @@ -265,7 +265,7 @@ txg_sync_stop(dsl_pool_t *dp) /* * Finish off any work in progress. */ - ASSERT(tx->tx_threads == 2); + ASSERT3U(tx->tx_threads, ==, 2); /* * We need to ensure that we've vacated the deferred space_maps. @@ -277,7 +277,7 @@ txg_sync_stop(dsl_pool_t *dp) */ mutex_enter(&tx->tx_sync_lock); - ASSERT(tx->tx_threads == 2); + ASSERT3U(tx->tx_threads, ==, 2); tx->tx_exiting = 1; @@ -616,7 +616,7 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) ASSERT(!dsl_pool_config_held(dp)); mutex_enter(&tx->tx_sync_lock); - ASSERT(tx->tx_threads == 2); + ASSERT3U(tx->tx_threads, ==, 2); if (txg == 0) txg = tx->tx_open_txg + TXG_DEFER_SIZE; if (tx->tx_sync_txg_waiting < txg) @@ -641,7 +641,7 @@ txg_wait_open(dsl_pool_t *dp, uint64_t txg) ASSERT(!dsl_pool_config_held(dp)); mutex_enter(&tx->tx_sync_lock); - ASSERT(tx->tx_threads == 2); + ASSERT3U(tx->tx_threads, ==, 2); if (txg == 0) txg = tx->tx_open_txg + 1; if (tx->tx_quiesce_txg_waiting < txg) 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 Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 26 11:04:08 2017 (r324011) @@ -76,6 +76,7 @@ #include #include #include +#include /* * Programming rules. @@ -1276,7 +1277,7 @@ zfs_get_done(zgd_t *zgd, int error) VN_RELE_ASYNC(ZTOV(zp), dsl_pool_vnrele_taskq(dmu_objset_pool(os))); if (error == 0 && zgd->zgd_bp) - zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); + zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp); kmem_free(zgd, sizeof (zgd_t)); } @@ -1289,7 +1290,7 @@ static int zil_fault_io = 0; * Get data to generate a TX_WRITE intent log record. */ int -zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) +zfs_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, zio_t *zio) { zfsvfs_t *zfsvfs = arg; objset_t *os = zfsvfs->z_os; @@ -1301,8 +1302,9 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio zgd_t *zgd; int error = 0; - ASSERT(zio != NULL); - ASSERT(size != 0); + ASSERT3P(lwb, !=, NULL); + ASSERT3P(zio, !=, NULL); + ASSERT3U(size, !=, 0); /* * Nothing to do if the file has been removed @@ -1320,7 +1322,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio } zgd = (zgd_t *)kmem_zalloc(sizeof (zgd_t), KM_SLEEP); - zgd->zgd_zilog = zfsvfs->z_log; + zgd->zgd_lwb = lwb; zgd->zgd_private = zp; /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep 26 09:34:18 2017 (r324010) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep 26 11:04:08 2017 (r324011) @@ -42,32 +42,53 @@ #include /* - * The zfs intent log (ZIL) saves transaction records of system calls - * that change the file system in memory with enough information - * to be able to replay them. These are stored in memory until - * either the DMU transaction group (txg) commits them to the stable pool - * and they can be discarded, or they are flushed to the stable log - * (also in the pool) due to a fsync, O_DSYNC or other synchronous - * requirement. In the event of a panic or power fail then those log - * records (transactions) are replayed. + * The ZFS Intent Log (ZIL) saves "transaction records" (itxs) of system + * calls that change the file system. Each itx has enough information to + * be able to replay them after a system crash, power loss, or + * equivalent failure mode. These are stored in memory until either: * - * There is one ZIL per file system. Its on-disk (pool) format consists - * of 3 parts: + * 1. they are committed to the pool by the DMU transaction group + * (txg), at which point they can be discarded; or + * 2. they are committed to the on-disk ZIL for the dataset being + * modified (e.g. due to an fsync, O_DSYNC, or other synchronous + * requirement). * - * - ZIL header - * - ZIL blocks - * - ZIL records + * In the event of a crash or power loss, the itxs contained by each + * dataset's on-disk ZIL will be replayed when that dataset is first + * instantianted (e.g. if the dataset is a normal fileystem, when it is + * first mounted). * - * A log record holds a system call transaction. Log blocks can - * hold many log records and the blocks are chained together. - * Each ZIL block contains a block pointer (blkptr_t) to the next - * ZIL block in the chain. The ZIL header points to the first - * block in the chain. Note there is not a fixed place in the pool - * to hold blocks. They are dynamically allocated and freed as - * needed from the blocks available. Figure X shows the ZIL structure: + * As hinted at above, there is one ZIL per dataset (both the in-memory + * representation, and the on-disk representation). The on-disk format + * consists of 3 parts: + * + * - a single, per-dataset, ZIL header; which points to a chain of + * - zero or more ZIL blocks; each of which contains + * - zero or more ZIL records + * + * A ZIL record holds the information necessary to replay a single + * system call transaction. A ZIL block can hold many ZIL records, and + * the blocks are chained together, similarly to a singly linked list. + * + * Each ZIL block contains a block pointer (blkptr_t) to the next ZIL + * block in the chain, and the ZIL header points to the first block in + * the chain. + * + * Note, there is not a fixed place in the pool to hold these ZIL + * blocks; they are dynamically allocated and freed as needed from the + * blocks available on the pool, though they can be preferentially + * allocated from a dedicated "log" vdev. */ /* + * This controls the amount of time that a ZIL block (lwb) will remain + * "open" when it isn't "full", and it has a thread waiting for it to be + * committed to stable storage. Please refer to the zil_commit_waiter() + * function (and the comments within it) for more details. + */ +int zfs_commit_timeout_pct = 5; + +/* * Disable intent logging replay. This global ZIL switch affects all pools. */ int zil_replay_disable = 0; @@ -98,6 +119,7 @@ SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_bulk, CTLFLAG &zil_slog_bulk, 0, "Maximal SLOG commit size with sync priority"); static kmem_cache_t *zil_lwb_cache; +static kmem_cache_t *zil_zcw_cache; #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ sizeof (zil_chain_t)) == (lwb->lwb_sz - lwb->lwb_nused)) @@ -445,6 +467,20 @@ zil_free_log_record(zilog_t *zilog, lr_t *lrc, void *t return (0); } +static int +zil_lwb_vdev_compare(const void *x1, const void *x2) +{ + const uint64_t v1 = ((zil_vdev_node_t *)x1)->zv_vdev; + const uint64_t v2 = ((zil_vdev_node_t *)x2)->zv_vdev; + + if (v1 < v2) + return (-1); + if (v1 > v2) + return (1); + + return (0); +} + static lwb_t * zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) { @@ -454,10 +490,13 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t lwb->lwb_zilog = zilog; lwb->lwb_blk = *bp; lwb->lwb_slog = slog; + lwb->lwb_state = LWB_STATE_CLOSED; lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); lwb->lwb_max_txg = txg; - lwb->lwb_zio = NULL; + lwb->lwb_write_zio = NULL; + lwb->lwb_root_zio = NULL; lwb->lwb_tx = NULL; + lwb->lwb_issued_timestamp = 0; if (BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_ZILOG2) { lwb->lwb_nused = sizeof (zil_chain_t); lwb->lwb_sz = BP_GET_LSIZE(bp); @@ -470,9 +509,54 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t list_insert_tail(&zilog->zl_lwb_list, lwb); mutex_exit(&zilog->zl_lock); + ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); + ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); + ASSERT(list_is_empty(&lwb->lwb_waiters)); + return (lwb); } +static void +zil_free_lwb(zilog_t *zilog, lwb_t *lwb) +{ + ASSERT(MUTEX_HELD(&zilog->zl_lock)); + ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); + ASSERT(list_is_empty(&lwb->lwb_waiters)); + + if (lwb->lwb_state == LWB_STATE_OPENED) { + avl_tree_t *t = &lwb->lwb_vdev_tree; + void *cookie = NULL; + zil_vdev_node_t *zv; + + while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) + kmem_free(zv, sizeof (*zv)); + + ASSERT3P(lwb->lwb_root_zio, !=, NULL); + ASSERT3P(lwb->lwb_write_zio, !=, NULL); + + zio_cancel(lwb->lwb_root_zio); + zio_cancel(lwb->lwb_write_zio); + + lwb->lwb_root_zio = NULL; + lwb->lwb_write_zio = NULL; + } else { + ASSERT3S(lwb->lwb_state, !=, LWB_STATE_ISSUED); + } + + ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); + ASSERT3P(lwb->lwb_write_zio, ==, NULL); + ASSERT3P(lwb->lwb_root_zio, ==, NULL); + + /* + * Clear the zilog's field to indicate this lwb is no longer + * valid, and prevent use-after-free errors. + */ + if (zilog->zl_last_lwb_opened == lwb) + zilog->zl_last_lwb_opened = NULL; + + kmem_cache_free(zil_lwb_cache, lwb); +} + /* * Called when we create in-memory log transactions so that we know * to cleanup the itxs at the end of spa_sync(). @@ -483,12 +567,16 @@ zilog_dirty(zilog_t *zilog, uint64_t txg) dsl_pool_t *dp = zilog->zl_dmu_pool; dsl_dataset_t *ds = dmu_objset_ds(zilog->zl_os); + ASSERT(spa_writeable(zilog->zl_spa)); + if (ds->ds_is_snapshot) panic("dirtying snapshot!"); if (txg_list_add(&dp->dp_dirty_zilogs, zilog, txg)) { /* up the hold count until we can be written out */ dmu_buf_add_ref(ds->ds_dbuf, zilog); + + zilog->zl_dirty_max_txg = MAX(txg, zilog->zl_dirty_max_txg); } } @@ -556,7 +644,7 @@ zil_create(zilog_t *zilog) */ if (BP_IS_HOLE(&blk) || BP_SHOULD_BYTESWAP(&blk)) { tx = dmu_tx_create(zilog->zl_os); - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); + VERIFY0(dmu_tx_assign(tx, TXG_WAIT)); dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); @@ -573,7 +661,7 @@ zil_create(zilog_t *zilog) } /* - * Allocate a log write buffer (lwb) for the first log block. + * Allocate a log write block (lwb) for the first log block. */ if (error == 0) lwb = zil_alloc_lwb(zilog, &blk, slog, txg); @@ -594,13 +682,13 @@ zil_create(zilog_t *zilog) } /* - * In one tx, free all log blocks and clear the log header. - * If keep_first is set, then we're replaying a log with no content. - * We want to keep the first block, however, so that the first - * synchronous transaction doesn't require a txg_wait_synced() - * in zil_create(). We don't need to txg_wait_synced() here either - * when keep_first is set, because both zil_create() and zil_destroy() - * will wait for any in-progress destroys to complete. + * In one tx, free all log blocks and clear the log header. If keep_first + * is set, then we're replaying a log with no content. We want to keep the + * first block, however, so that the first synchronous transaction doesn't + * require a txg_wait_synced() in zil_create(). We don't need to + * txg_wait_synced() here either when keep_first is set, because both + * zil_create() and zil_destroy() will wait for any in-progress destroys + * to complete. */ void zil_destroy(zilog_t *zilog, boolean_t keep_first) @@ -621,7 +709,7 @@ zil_destroy(zilog_t *zilog, boolean_t keep_first) return; tx = dmu_tx_create(zilog->zl_os); - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); + VERIFY0(dmu_tx_assign(tx, TXG_WAIT)); dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); @@ -638,8 +726,8 @@ zil_destroy(zilog_t *zilog, boolean_t keep_first) list_remove(&zilog->zl_lwb_list, lwb); if (lwb->lwb_buf != NULL) zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); - zio_free_zil(zilog->zl_spa, txg, &lwb->lwb_blk); - kmem_cache_free(zil_lwb_cache, lwb); + zio_free(zilog->zl_spa, txg, &lwb->lwb_blk); + zil_free_lwb(zilog, lwb); } } else if (!keep_first) { zil_destroy_sync(zilog, tx); @@ -777,24 +865,64 @@ zil_check_log_chain(dsl_pool_t *dp, dsl_dataset_t *ds, return ((error == ECKSUM || error == ENOENT) ? 0 : error); } -static int -zil_vdev_compare(const void *x1, const void *x2) +/* + * When an itx is "skipped", this function is used to properly mark the + * waiter as "done, and signal any thread(s) waiting on it. An itx can + * be skipped (and not committed to an lwb) for a variety of reasons, + * one of them being that the itx was committed via spa_sync(), prior to + * it being committed to an lwb; this can happen if a thread calling + * zil_commit() is racing with spa_sync(). + */ +static void +zil_commit_waiter_skip(zil_commit_waiter_t *zcw) { - const uint64_t v1 = ((zil_vdev_node_t *)x1)->zv_vdev; - const uint64_t v2 = ((zil_vdev_node_t *)x2)->zv_vdev; + mutex_enter(&zcw->zcw_lock); + ASSERT3B(zcw->zcw_done, ==, B_FALSE); + zcw->zcw_done = B_TRUE; + cv_broadcast(&zcw->zcw_cv); + mutex_exit(&zcw->zcw_lock); +} - if (v1 < v2) - return (-1); - if (v1 > v2) - return (1); +/* + * This function is used when the given waiter is to be linked into an + * lwb's "lwb_waiter" list; i.e. when the itx is committed to the lwb. + * At this point, the waiter will no longer be referenced by the itx, + * and instead, will be referenced by the lwb. + */ +static void +zil_commit_waiter_link_lwb(zil_commit_waiter_t *zcw, lwb_t *lwb) +{ + mutex_enter(&zcw->zcw_lock); + ASSERT(!list_link_active(&zcw->zcw_node)); + ASSERT3P(zcw->zcw_lwb, ==, NULL); + ASSERT3P(lwb, !=, NULL); + ASSERT(lwb->lwb_state == LWB_STATE_OPENED || + lwb->lwb_state == LWB_STATE_ISSUED); - return (0); + list_insert_tail(&lwb->lwb_waiters, zcw); + zcw->zcw_lwb = lwb; + mutex_exit(&zcw->zcw_lock); } +/* + * This function is used when zio_alloc_zil() fails to allocate a ZIL + * block, and the given waiter must be linked to the "nolwb waiters" + * list inside of zil_process_commit_list(). + */ +static void +zil_commit_waiter_link_nolwb(zil_commit_waiter_t *zcw, list_t *nolwb) +{ + mutex_enter(&zcw->zcw_lock); + ASSERT(!list_link_active(&zcw->zcw_node)); + ASSERT3P(zcw->zcw_lwb, ==, NULL); + list_insert_tail(nolwb, zcw); + mutex_exit(&zcw->zcw_lock); +} + void -zil_add_block(zilog_t *zilog, const blkptr_t *bp) +zil_lwb_add_block(lwb_t *lwb, const blkptr_t *bp) { - avl_tree_t *t = &zilog->zl_vdev_tree; + avl_tree_t *t = &lwb->lwb_vdev_tree; avl_index_t where; zil_vdev_node_t *zv, zvsearch; int ndvas = BP_GET_NDVAS(bp); @@ -803,14 +931,7 @@ zil_add_block(zilog_t *zilog, const blkptr_t *bp) if (zfs_nocacheflush) return; - ASSERT(zilog->zl_writer); - - /* - * Even though we're zl_writer, we still need a lock because the - * zl_get_data() callbacks may have dmu_sync() done callbacks - * that will run concurrently. - */ - mutex_enter(&zilog->zl_vdev_lock); + mutex_enter(&lwb->lwb_vdev_lock); for (i = 0; i < ndvas; i++) { zvsearch.zv_vdev = DVA_GET_VDEV(&bp->blk_dva[i]); if (avl_find(t, &zvsearch, &where) == NULL) { @@ -819,59 +940,117 @@ zil_add_block(zilog_t *zilog, const blkptr_t *bp) avl_insert(t, zv, where); } } - mutex_exit(&zilog->zl_vdev_lock); + mutex_exit(&lwb->lwb_vdev_lock); } +void +zil_lwb_add_txg(lwb_t *lwb, uint64_t txg) +{ + lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); +} + +/* + * This function is a called after all VDEVs associated with a given lwb + * write have completed their DKIOCFLUSHWRITECACHE command; or as soon + * as the lwb write completes, if "zfs_nocacheflush" is set. + * + * The intention is for this function to be called as soon as the + * contents of an lwb are considered "stable" on disk, and will survive + * any sudden loss of power. At this point, any threads waiting for the + * lwb to reach this state are signalled, and the "waiter" structures + * are marked "done". + */ static void -zil_flush_vdevs(zilog_t *zilog) +zil_lwb_flush_vdevs_done(zio_t *zio) { - spa_t *spa = zilog->zl_spa; - avl_tree_t *t = &zilog->zl_vdev_tree; - void *cookie = NULL; - zil_vdev_node_t *zv; - zio_t *zio = NULL; + lwb_t *lwb = zio->io_private; + zilog_t *zilog = lwb->lwb_zilog; + dmu_tx_t *tx = lwb->lwb_tx; + zil_commit_waiter_t *zcw; - ASSERT(zilog->zl_writer); + spa_config_exit(zilog->zl_spa, SCL_STATE, lwb); + zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); + + mutex_enter(&zilog->zl_lock); + /* - * We don't need zl_vdev_lock here because we're the zl_writer, - * and all zl_get_data() callbacks are done. + * Ensure the lwb buffer pointer is cleared before releasing the + * txg. If we have had an allocation failure and the txg is + * waiting to sync then we want zil_sync() to remove the lwb so + * that it's not picked up as the next new one in + * zil_process_commit_list(). zil_sync() will only remove the + * lwb if lwb_buf is null. */ - if (avl_numnodes(t) == 0) - return; + lwb->lwb_buf = NULL; + lwb->lwb_tx = NULL; - spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); + ASSERT3U(lwb->lwb_issued_timestamp, >, 0); + zilog->zl_last_lwb_latency = gethrtime() - lwb->lwb_issued_timestamp; - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { - vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); - if (vd != NULL && !vd->vdev_nowritecache) { - if (zio == NULL) - zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); - zio_flush(zio, vd); - } - kmem_free(zv, sizeof (*zv)); + lwb->lwb_root_zio = NULL; + lwb->lwb_state = LWB_STATE_DONE; + + if (zilog->zl_last_lwb_opened == lwb) { + /* + * Remember the highest committed log sequence number + * for ztest. We only update this value when all the log + * writes succeeded, because ztest wants to ASSERT that + * it got the whole log chain. + */ + zilog->zl_commit_lr_seq = zilog->zl_lr_seq; } + while ((zcw = list_head(&lwb->lwb_waiters)) != NULL) { + mutex_enter(&zcw->zcw_lock); + + ASSERT(list_link_active(&zcw->zcw_node)); + list_remove(&lwb->lwb_waiters, zcw); + + ASSERT3P(zcw->zcw_lwb, ==, lwb); + zcw->zcw_lwb = NULL; + + zcw->zcw_zio_error = zio->io_error; + + ASSERT3B(zcw->zcw_done, ==, B_FALSE); + zcw->zcw_done = B_TRUE; + cv_broadcast(&zcw->zcw_cv); + + mutex_exit(&zcw->zcw_lock); + } + + mutex_exit(&zilog->zl_lock); + /* - * Wait for all the flushes to complete. Not all devices actually - * support the DKIOCFLUSHWRITECACHE ioctl, so it's OK if it fails. + * Now that we've written this log block, we have a stable pointer + * to the next block in the chain, so it's OK to let the txg in + * which we allocated the next block sync. */ - if (zio) - (void) zio_wait(zio); - - spa_config_exit(spa, SCL_STATE, FTAG); + dmu_tx_commit(tx); } /* - * Function called when a log block write completes + * This is called when an lwb write completes. This means, this specific + * lwb was written to disk, and all dependent lwb have also been + * written to disk. + * + * At this point, a DKIOCFLUSHWRITECACHE command hasn't been issued to + * the VDEVs involved in writing out this specific lwb. The lwb will be + * "done" once zil_lwb_flush_vdevs_done() is called, which occurs in the + * zio completion callback for the lwb's root zio. */ static void zil_lwb_write_done(zio_t *zio) { lwb_t *lwb = zio->io_private; + spa_t *spa = zio->io_spa; zilog_t *zilog = lwb->lwb_zilog; - dmu_tx_t *tx = lwb->lwb_tx; + avl_tree_t *t = &lwb->lwb_vdev_tree; + void *cookie = NULL; + zil_vdev_node_t *zv; + ASSERT3S(spa_config_held(spa, SCL_STATE, RW_READER), !=, 0); + ASSERT(BP_GET_COMPRESS(zio->io_bp) == ZIO_COMPRESS_OFF); ASSERT(BP_GET_TYPE(zio->io_bp) == DMU_OT_INTENT_LOG); ASSERT(BP_GET_LEVEL(zio->io_bp) == 0); @@ -880,58 +1059,115 @@ zil_lwb_write_done(zio_t *zio) ASSERT(!BP_IS_HOLE(zio->io_bp)); ASSERT(BP_GET_FILL(zio->io_bp) == 0); - /* - * Ensure the lwb buffer pointer is cleared before releasing - * the txg. If we have had an allocation failure and - * the txg is waiting to sync then we want want zil_sync() - * to remove the lwb so that it's not picked up as the next new - * one in zil_commit_writer(). zil_sync() will only remove - * the lwb if lwb_buf is null. - */ abd_put(zio->io_abd); - zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); + + ASSERT3S(lwb->lwb_state, ==, LWB_STATE_ISSUED); + mutex_enter(&zilog->zl_lock); - lwb->lwb_buf = NULL; - lwb->lwb_tx = NULL; + lwb->lwb_write_zio = NULL; mutex_exit(&zilog->zl_lock); + if (avl_numnodes(t) == 0) + return; + /* - * Now that we've written this log block, we have a stable pointer - * to the next block in the chain, so it's OK to let the txg in - * which we allocated the next block sync. + * If there was an IO error, we're not going to call zio_flush() + * on these vdevs, so we simply empty the tree and free the + * nodes. We avoid calling zio_flush() since there isn't any + * good reason for doing so, after the lwb block failed to be + * written out. */ - dmu_tx_commit(tx); + if (zio->io_error != 0) { + while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) + kmem_free(zv, sizeof (*zv)); + return; + } + + while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { + vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); + if (vd != NULL) + zio_flush(lwb->lwb_root_zio, vd); + kmem_free(zv, sizeof (*zv)); + } } /* - * Initialize the io for a log block. + * This function's purpose is to "open" an lwb such that it is ready to + * accept new itxs being committed to it. To do this, the lwb's zio + * structures are created, and linked to the lwb. This function is + * idempotent; if the passed in lwb has already been opened, this + * function is essentially a no-op. */ static void -zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) +zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) { zbookmark_phys_t zb; zio_priority_t prio; + ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT3P(lwb, !=, NULL); + EQUIV(lwb->lwb_root_zio == NULL, lwb->lwb_state == LWB_STATE_CLOSED); + EQUIV(lwb->lwb_root_zio != NULL, lwb->lwb_state == LWB_STATE_OPENED); + SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_SEQ]); - if (zilog->zl_root_zio == NULL) { - zilog->zl_root_zio = zio_root(zilog->zl_spa, NULL, NULL, - ZIO_FLAG_CANFAIL); - } - if (lwb->lwb_zio == NULL) { + if (lwb->lwb_root_zio == NULL) { abd_t *lwb_abd = abd_get_from_buf(lwb->lwb_buf, BP_GET_LSIZE(&lwb->lwb_blk)); + if (!lwb->lwb_slog || zilog->zl_cur_used <= zil_slog_bulk) prio = ZIO_PRIORITY_SYNC_WRITE; else prio = ZIO_PRIORITY_ASYNC_WRITE; - lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, - 0, &lwb->lwb_blk, lwb_abd, BP_GET_LSIZE(&lwb->lwb_blk), - zil_lwb_write_done, lwb, prio, - ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); + + lwb->lwb_root_zio = zio_root(zilog->zl_spa, + zil_lwb_flush_vdevs_done, lwb, ZIO_FLAG_CANFAIL); + ASSERT3P(lwb->lwb_root_zio, !=, NULL); + + lwb->lwb_write_zio = zio_rewrite(lwb->lwb_root_zio, + zilog->zl_spa, 0, &lwb->lwb_blk, lwb_abd, + BP_GET_LSIZE(&lwb->lwb_blk), zil_lwb_write_done, lwb, + prio, ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); + ASSERT3P(lwb->lwb_write_zio, !=, NULL); + + lwb->lwb_state = LWB_STATE_OPENED; + + mutex_enter(&zilog->zl_lock); + + /* + * The zilog's "zl_last_lwb_opened" field is used to + * build the lwb/zio dependency chain, which is used to + * preserve the ordering of lwb completions that is + * required by the semantics of the ZIL. Each new lwb + * zio becomes a parent of the "previous" lwb zio, such + * that the new lwb's zio cannot complete until the + * "previous" lwb's zio completes. + * + * This is required by the semantics of zil_commit(); + * the commit waiters attached to the lwbs will be woken + * in the lwb zio's completion callback, so this zio + * dependency graph ensures the waiters are woken in the + * correct order (the same order the lwbs were created). + */ + lwb_t *last_lwb_opened = zilog->zl_last_lwb_opened; + if (last_lwb_opened != NULL && + last_lwb_opened->lwb_state != LWB_STATE_DONE) { + ASSERT(last_lwb_opened->lwb_state == LWB_STATE_OPENED || + last_lwb_opened->lwb_state == LWB_STATE_ISSUED); + ASSERT3P(last_lwb_opened->lwb_root_zio, !=, NULL); + zio_add_child(lwb->lwb_root_zio, + last_lwb_opened->lwb_root_zio); + } + zilog->zl_last_lwb_opened = lwb; + + mutex_exit(&zilog->zl_lock); } + + ASSERT3P(lwb->lwb_root_zio, !=, NULL); + ASSERT3P(lwb->lwb_write_zio, !=, NULL); + ASSERT3S(lwb->lwb_state, ==, LWB_STATE_OPENED); } /* @@ -953,7 +1189,7 @@ uint64_t zil_block_buckets[] = { * Calls are serialized. */ static lwb_t * -zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolean_t last) +zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) { lwb_t *nlwb = NULL; zil_chain_t *zilc; @@ -965,6 +1201,11 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolea int i, error; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Sep 26 11:11:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48475E07016; Tue, 26 Sep 2017 11:11:18 +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 17E6C2251; Tue, 26 Sep 2017 11:11:18 +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 v8QBBH2h003340; Tue, 26 Sep 2017 11:11:17 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QBBHuW003339; Tue, 26 Sep 2017 11:11:17 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709261111.v8QBBHuW003339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 11:11:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324012 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 324012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 11:11:18 -0000 Author: manu Date: Tue Sep 26 11:11:17 2017 New Revision: 324012 URL: https://svnweb.freebsd.org/changeset/base/324012 Log: mountd: Remove unneeded cast Reported by: kib MFC after: 1 week X MFC With: r324007 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Sep 26 11:04:08 2017 (r324011) +++ head/usr.sbin/mountd/mountd.c Tue Sep 26 11:11:17 2017 (r324012) @@ -1936,7 +1936,7 @@ add_expdir(struct dirlist **dpp, char *cp, int len) { struct dirlist *dp; - dp = (struct dirlist *)malloc(sizeof (struct dirlist)); + dp = malloc(sizeof (struct dirlist)); if (dp == (struct dirlist *)NULL) out_of_mem(); dp->dp_left = *dpp; From owner-svn-src-head@freebsd.org Tue Sep 26 11:11:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB43BE070B8; Tue, 26 Sep 2017 11:11:45 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BA72E24D0; Tue, 26 Sep 2017 11:11:44 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 9f68714d; Tue, 26 Sep 2017 13:11:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=H1yjNDjuLiXNJhpOs9RNkwf3jbo=; b=g/ZYirsUta7edfZR8Dy6ZokhOdhd F4s/5SouJuz/r3grTMwENvzM+/wVKl3z8C7CVopH+lQ+92LQz8gmjnqCYQum5W2n ic3IESXBIk8D3OvK7KXX/i6yXvMM4oLl1+/qGf1QaYD8ItRG7HmpOLsRjw4OywWF tDziwXkld5C2y10= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=C9MeahM1m8s3JDzZHws/fVixAZ4shWcRQpze8PyKugufSMwcGJo5xtyh PplQUUxCRe6vV2oee5AQxAMsSGV5hPlrS8c/3km8UQiufdlbKGOPn7cjzWFu5Shz Xycqh811p/8PBqNguU4kis7l/l5wAJuugI2ElH1hHdJ/ZYs/hZk= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 80533fe2 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 26 Sep 2017 13:11:35 +0200 (CEST) Date: Tue, 26 Sep 2017 13:11:35 +0200 From: Emmanuel Vadot To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324007 - head/usr.sbin/mountd Message-Id: <20170926131135.73b1f216e9448d863f7b48a9@bidouilliste.com> In-Reply-To: <20170926102457.GG2271@kib.kiev.ua> References: <201709260918.v8Q9II14056929@repo.freebsd.org> <20170926102457.GG2271@kib.kiev.ua> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 11:11:45 -0000 On Tue, 26 Sep 2017 13:24:57 +0300 Konstantin Belousov wrote: > On Tue, Sep 26, 2017 at 09:18:18AM +0000, Emmanuel Vadot wrote: > > @@ -1940,14 +1936,16 @@ add_expdir(struct dirlist **dpp, char *cp, int len) > > { > > struct dirlist *dp; > > > > - dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len); > > + dp = (struct dirlist *)malloc(sizeof (struct dirlist)); > You might remove the unneeded cast as well. Right, done in 324012. Thanks, -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Tue Sep 26 11:16:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 610E6E0762A; Tue, 26 Sep 2017 11:16: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 2ECDD295D; Tue, 26 Sep 2017 11:16: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 v8QBGXGL006417; Tue, 26 Sep 2017 11:16:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QBGX0W006416; Tue, 26 Sep 2017 11:16:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709261116.v8QBGX0W006416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 26 Sep 2017 11:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324013 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 324013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 11:16:34 -0000 Author: bapt Date: Tue Sep 26 11:16:33 2017 New Revision: 324013 URL: https://svnweb.freebsd.org/changeset/base/324013 Log: calendar: replace strcpy/strcat with asprintf Modified: head/usr.bin/calendar/events.c Modified: head/usr.bin/calendar/events.c ============================================================================== --- head/usr.bin/calendar/events.c Tue Sep 26 11:11:17 2017 (r324012) +++ head/usr.bin/calendar/events.c Tue Sep 26 11:16:33 2017 (r324013) @@ -86,12 +86,9 @@ event_continue(struct event *e, char *txt) errx(1, "event_continue: cannot allocate memory"); free(e->text); - e->text = (char *)malloc(strlen(text) + strlen(txt) + 3); + asprintf(&e->text, "%s\n%s", text, txt); if (e->text == NULL) errx(1, "event_continue: cannot allocate memory"); - strcpy(e->text, text); - strcat(e->text, "\n"); - strcat(e->text, txt); free(text); return; From owner-svn-src-head@freebsd.org Tue Sep 26 12:10:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC9CDE08C96; Tue, 26 Sep 2017 12:10:03 +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 B52933FED; Tue, 26 Sep 2017 12:10:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 4428D42356C; Tue, 26 Sep 2017 22:09:54 +1000 (AEST) Date: Tue, 26 Sep 2017 22:09:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Emmanuel Vadot cc: Konstantin Belousov , Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324007 - head/usr.sbin/mountd In-Reply-To: <20170926131135.73b1f216e9448d863f7b48a9@bidouilliste.com> Message-ID: <20170926212215.T1299@besplex.bde.org> References: <201709260918.v8Q9II14056929@repo.freebsd.org> <20170926102457.GG2271@kib.kiev.ua> <20170926131135.73b1f216e9448d863f7b48a9@bidouilliste.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LI0WeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=w7ArmIgtcycLYhWLe3YA:9 a=o3NbsaZe5tbfgi_4:21 a=9YDDRxIWfjNFlw7z:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 12:10:04 -0000 On Tue, 26 Sep 2017, Emmanuel Vadot wrote: > On Tue, 26 Sep 2017 13:24:57 +0300 > Konstantin Belousov wrote: > >> On Tue, Sep 26, 2017 at 09:18:18AM +0000, Emmanuel Vadot wrote: >>> @@ -1940,14 +1936,16 @@ add_expdir(struct dirlist **dpp, char *cp, int len) >>> { >>> struct dirlist *dp; >>> >>> - dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len); >>> + dp = (struct dirlist *)malloc(sizeof (struct dirlist)); >> You might remove the unneeded cast as well. > > Right, done in 324012. Er, mountd has many similar casts, not just the one fixed, and worse ones like casting dp to caddr_t before passing it to free() (caddr_t is bogus, and free() doesn't actually take it -- its prototype converts caddr_t to void *, just like it would convert dp's type to void *)). Some of these casts were needed in 1987 for unprototyped pre-StandardC code. caddr_t was more needed in 1977 before void * existed (free() takes a char * arg in K&R1). But the main hug near here is leaking memory for strdup()). The above malloc() allocates 2 storage areas together (1 for the string at the end), and seems to have a corresponding free(). Now there is an extra separate storage error for the string and no separate free() for it. This is not much more than a style bug too. mountd is a long-lived daemon, so it should avoid leaking memory, but it would probably work OK for a few thousand mounts with no free()s at all or a few million with no frees of strings. But it tries to free() most things, so it is a style bug to not try for some. Bruce From owner-svn-src-head@freebsd.org Tue Sep 26 12:15:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 635DEE08F13; Tue, 26 Sep 2017 12:15:14 +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 2FA9063765; Tue, 26 Sep 2017 12:15:14 +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 v8QCFDDM030811; Tue, 26 Sep 2017 12:15:13 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QCFDg2030810; Tue, 26 Sep 2017 12:15:13 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709261215.v8QCFDg2030810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 12:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324014 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 324014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 12:15:14 -0000 Author: manu Date: Tue Sep 26 12:15:13 2017 New Revision: 324014 URL: https://svnweb.freebsd.org/changeset/base/324014 Log: mountd: Avoid memory leak by freeing dp_dirp Introduced in r324007, the data alloced by strdup was never free'ed. While here, remove cast to caddr_t when freeing dp. Reported by: bde MFC after: 1 week X MFC With: r324007 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Sep 26 11:16:33 2017 (r324013) +++ head/usr.sbin/mountd/mountd.c Tue Sep 26 12:15:13 2017 (r324014) @@ -2159,7 +2159,8 @@ free_dir(struct dirlist *dp) free_dir(dp->dp_left); free_dir(dp->dp_right); free_host(dp->dp_hosts); - free((caddr_t)dp); + free(dp->dp_dirp); + free(dp); } } From owner-svn-src-head@freebsd.org Tue Sep 26 12:16:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24B18E08FFF; Tue, 26 Sep 2017 12:16:35 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 299F863938; Tue, 26 Sep 2017 12:16:33 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 6882f2e8; Tue, 26 Sep 2017 14:16:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=nt5RnFcvohjtPaF45IXMvRTJHzs=; b=fcCt/Y8oFr5lO2ax/6isTrqNW9JU eDwITGr+7EkXu1rwLrUAwARFwx5eU2g6F7ex8cQsOMByvMYlRAgY7H1ZdJ8YS/QL XVf6QzjdjAYcaDZ8D3kkqWeMBrWNtOlOkA9X4Gv3GgOoo+DaG2D+Y/5fll4yYWt+ asahlcR9R37QM64= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=JrZ5aZrclpxKZv51tK/DJ8MFHIyQ55YPGVNAJOdFCR620TWXOswAEz/U Rm7WXYWQffKIHoiUgxxfwwLw5ZjUR1VD9ijIjFVm3O5BWgCYkrRBRGRRBFwcRaD6 iSGYXWrS/CuAK25yOvL1+fIJddbeZL42Qk6nC+s0sRZOI75DqbA= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id ef280b6b TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 26 Sep 2017 14:16:30 +0200 (CEST) Date: Tue, 26 Sep 2017 14:16:30 +0200 From: Emmanuel Vadot To: Bruce Evans Cc: Konstantin Belousov , Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324007 - head/usr.sbin/mountd Message-Id: <20170926141630.9bdf32c09ac3a71e33e08b68@bidouilliste.com> In-Reply-To: <20170926212215.T1299@besplex.bde.org> References: <201709260918.v8Q9II14056929@repo.freebsd.org> <20170926102457.GG2271@kib.kiev.ua> <20170926131135.73b1f216e9448d863f7b48a9@bidouilliste.com> <20170926212215.T1299@besplex.bde.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 12:16:35 -0000 On Tue, 26 Sep 2017 22:09:53 +1000 (EST) Bruce Evans wrote: > On Tue, 26 Sep 2017, Emmanuel Vadot wrote: > > > On Tue, 26 Sep 2017 13:24:57 +0300 > > Konstantin Belousov wrote: > > > >> On Tue, Sep 26, 2017 at 09:18:18AM +0000, Emmanuel Vadot wrote: > >>> @@ -1940,14 +1936,16 @@ add_expdir(struct dirlist **dpp, char *cp, int len) > >>> { > >>> struct dirlist *dp; > >>> > >>> - dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len); > >>> + dp = (struct dirlist *)malloc(sizeof (struct dirlist)); > >> You might remove the unneeded cast as well. > > > > Right, done in 324012. Hi Bruce, > Er, mountd has many similar casts, not just the one fixed, and worse ones > like casting dp to caddr_t before passing it to free() (caddr_t is bogus, > and free() doesn't actually take it -- its prototype converts caddr_t to > void *, just like it would convert dp's type to void *)). Some of these > casts were needed in 1987 for unprototyped pre-StandardC code. caddr_t > was more needed in 1977 before void * existed (free() takes a char * arg > in K&R1). I've fixed this one in 324014 and will probably apply style(9) to the whole file at some point. > But the main hug near here is leaking memory for strdup()). The above > malloc() allocates 2 storage areas together (1 for the string at the > end), and seems to have a corresponding free(). Now there is an extra > separate storage error for the string and no separate free() for it. Yes, sorry for that, this is fixed in 324014 too. > This is not much more than a style bug too. mountd is a long-lived > daemon, so it should avoid leaking memory, but it would probably work > OK for a few thousand mounts with no free()s at all or a few million > with no frees of strings. But it tries to free() most things, so it > is a style bug to not try for some. > > Bruce Thanks, -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Tue Sep 26 13:48:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7D9AE0C425; Tue, 26 Sep 2017 13:48:53 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEEEB66831; Tue, 26 Sep 2017 13:48:52 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from freyja.zeit4.iv.bundesimmobilien.de ([87.138.105.249]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LfXmv-1dZ44u317R-00p8ma; Tue, 26 Sep 2017 15:48:50 +0200 Date: Tue, 26 Sep 2017 15:48:43 +0200 From: "O. Hartmann" To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324011 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/cddl/contrib/opensolaris/uts/... Message-ID: <20170926154843.35a405e3@freyja.zeit4.iv.bundesimmobilien.de> In-Reply-To: <201709261104.v8QB480K002320@repo.freebsd.org> References: <201709261104.v8QB480K002320@repo.freebsd.org> Organization: Walstatt MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:bWC2ZU0Az9rB5di3jeR9/DRroP1R0eNwEZUAyEIK0+eqiEFQ2Ty PAcJhYL7ZAa9TLANq95hrtcnnlWpKcSIbqtskdOkn5NaZlUl12b0iW1Pjn4kTlXjdbPtxt5 h0GyGCfRTJkJ/8l6nAWK04TUXhJYJoyIvN7uqMTfFj/ZmtyZxDWxbr78x8edWWZh3eoC5JV LADILwS3EZw6XMjchIP6w== X-UI-Out-Filterresults: notjunk:1;V01:K0:IO7K62YCd4o=:mu9ipAFeT5WJ9flV2CtPjr Xfa0fVMiOY34W8HHXjZXtZ9vJb/UR7HA38DuROArBr5B/Gjvhqtl/OXkikj1LG51qaDxhsIw2 4l/367sB4GZ82kNX+VBrfRvLuJbE5NKHjfgAaPU1lR24SbE8R9ZuzI4gBiyqgNml7RQuynLp3 lOiW8pZovEjEvCi8xzoK3rpWYXRcWt0KYooNoIXEQXkLKzLOSVg88hkULWzV3Y+udNZEz6G96 Ls6d9xMEyOzTEPkz64J8rf81LZlm4dM383FGZmN2wxopiePNc9q0dhsTFqdR2TBeQkA8NBgiJ or2MvyAXF41WiJHC2yXMGL/C7ZIlhQv2zIimc0jU8gK5jDGVOEbvzKbX0wGuyfUbIdnLwVdBd Kdx04/7UG+yingzxrvh2ZVQpZT7iJCGuKDF3dBCaOocUw0WeBmRCMwr1JTvu4qddUlv9UYP1N ntkylYzmjJSrr8OQLMetF7os4jlTh3hF5Xsb1T0CnsBue9L7WpXCi+eon2yhg7EbDvb2CUUP5 6M9yYRnpuubVG+zGLAFMJhZREdVulW2ZzFTMzO4ek/l7k5mFYIR2ZQ6B19goBC3e9qYFpleaZ T/f2fZJHlSCI8sfuhtjeS7ii917bfQ2o/ZV2tndVjOiEAuS21o9ujM2zHWzs6IlHQkmUmDmnk tNLS2xuzdrcEVp0GTrfyXNeBJzQkYQ34yJLiN5hWiYyE3+zvUMezddr2SeMgNKHnh5aaWfHuY bI8hx4h8Z1ToVlg4odXJajg34yK+VH9e5c98ivE5N7sMKgR1h3TSAjBCAIAdA7GmVU1jnOuCn EitdseEdod+ICJtuXV6vRJ7Apa6OlYg7pD1yiMHsXB6kQR0YS0= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 13:48:53 -0000 On Tue, 26 Sep 2017 11:04:08 +0000 (UTC) Andriy Gapon wrote: > Author: avg > Date: Tue Sep 26 11:04:08 2017 > New Revision: 324011 > URL: https://svnweb.freebsd.org/changeset/base/324011 > > Log: > MFV r323535: 8585 improve batching done in zil_commit() > > FreeBSD notes: > - this MFV reverts FreeBSD commit r314549 to make the merge easier > - at present our emulation of cv_timedwait_hires is rather poor, > so I elected to use cv_timedwait_sbt directly > Please see the differential revision for details. > Unfortunately, I did not get any positive reviews, so there could be > bugs in the FreeBSD-specific piece of the merge. > Hence, the long MFC timeout. > > illumos/illumos-gate@1271e4b10dfaaed576c08a812f466f6e81370e5e > https://github.com/illumos/illumos-gate/commit/1271e4b10dfaaed576c08a812f466f6e81370e5e > > https://www.illumos.org/issues/8585 > The current implementation of zil_commit() can introduce significant > latency, beyond what is inherent due to the latency of the underlying > storage. The additional latency comes from two main problems: > 1. When there's outstanding ZIL blocks being written (i.e. there's > already a "writer thread" in progress), then any new calls to > zil_commit() will block waiting for the currently oustanding ZIL > blocks to complete. The blocks written for each "writer thread" is > coined a "batch", and there can only ever be a single "batch" being > written at a time. When a batch is being written, any new ZIL > transactions will have to wait for the next batch to be written, > which won't occur until the current batch finishes. > As a result, the underlying storage may not be used as efficiently > as possible. While "new" threads enter zil_commit() and are blocked > waiting for the next batch, it's possible that the underlying > storage isn't fully utilized by the current batch of ZIL blocks. In > that case, it'd be better to allow these new threads to generate > (and issue) a new ZIL block, such that it could be serviced by the > underlying storage concurrently with the other ZIL blocks that are > being serviced. > 2. Any call to zil_commit() must wait for all ZIL blocks in its "batch" > to complete, prior to zil_commit() returning. The size of any given > batch is proportional to the number of ZIL transaction in the queue > at the time that the batch starts processing the queue; which > doesn't occur until the previous batch completes. Thus, if there's a > lot of transactions in the queue, the batch could be composed of > many ZIL blocks, and each call to zil_commit() will have to wait for > all of these writes to complete (even if the thread calling > zil_commit() only cared about one of the transactions in the batch). > > Reviewed by: Brad Lewis > Reviewed by: Matt Ahrens > Reviewed by: George Wilson > Approved by: Dan McDonald > Author: Prakash Surya > > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D12355 > > Modified: > head/cddl/contrib/opensolaris/cmd/ztest/ztest.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c > head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h > Directory Properties: > head/cddl/contrib/opensolaris/ (props changed) > head/sys/cddl/contrib/opensolaris/ (props changed) > > Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Sep 26 > 09:34:18 2017 (r324010) +++ > head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Sep 26 11:04:08 > 2017 (r324011) @@ -1825,13 +1825,14 @@ ztest_get_done(zgd_t *zgd, int > error) ztest_object_unlock(zd, object); > if (error == 0 && zgd->zgd_bp) > - zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); > + zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp); > > umem_free(zgd, sizeof (*zgd)); > } > > static int > -ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) > +ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, > + zio_t *zio) > { > ztest_ds_t *zd = arg; > objset_t *os = zd->zd_os; > @@ -1845,6 +1846,10 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z > zgd_t *zgd; > int error; > > + ASSERT3P(lwb, !=, NULL); > + ASSERT3P(zio, !=, NULL); > + ASSERT3U(size, !=, 0); > + > ztest_object_lock(zd, object, RL_READER); > error = dmu_bonus_hold(os, object, FTAG, &db); > if (error) { > @@ -1865,7 +1870,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z > db = NULL; > > zgd = umem_zalloc(sizeof (*zgd), UMEM_NOFAIL); > - zgd->zgd_zilog = zd->zd_zilog; > + zgd->zgd_lwb = lwb; > zgd->zgd_private = zd; > > if (buf != NULL) { /* immediate write */ > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Sep > 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Sep 26 > 11:04:08 2017 (r324011) @@ -1728,6 +1728,13 @@ > dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy return > (SET_ERROR(EIO)); } > + /* > + * In order to prevent the zgd's lwb from being free'd prior to > + * dmu_sync_late_arrival_done() being called, we have to ensure > + * the lwb's "max txg" takes this tx's txg into account. > + */ > + zil_lwb_add_txg(zgd->zgd_lwb, dmu_tx_get_txg(tx)); > + > dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP); > dsa->dsa_dr = NULL; > dsa->dsa_done = done; > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue > Sep 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Tue Sep > 26 11:04:08 2017 (r324011) @@ -920,7 +920,7 @@ uint64_t > dmu_tx_get_txg(dmu_tx_t *tx); > * {zfs,zvol,ztest}_get_done() args > */ > typedef struct zgd { > - struct zilog *zgd_zilog; > + struct lwb *zgd_lwb; > struct blkptr *zgd_bp; > dmu_buf_t *zgd_db; > struct rl *zgd_rl; > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue > Sep 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Tue Sep > 26 11:04:08 2017 (r324011) @@ -40,6 +40,7 @@ extern "C" { > struct dsl_pool; > struct dsl_dataset; > +struct lwb; > > /* > * Intent log format: > @@ -140,6 +141,7 @@ typedef enum zil_create { > /* > * Intent log transaction types and record structures > */ > +#define TX_COMMIT 0 /* Commit marker (no > on-disk state) */ #define TX_CREATE 1 /* Create > file */ #define TX_MKDIR 2 /* Make directory */ > #define TX_MKXATTR 3 /* Make XATTR directory */ > @@ -388,7 +390,8 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, blkpt > typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, > uint64_t txg); > typedef int zil_replay_func_t(); > -typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t > *zio); +typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, > + struct lwb *lwb, zio_t *zio); > > extern int zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func, > zil_parse_lr_func_t *parse_lr_func, void *arg, uint64_t txg); > @@ -427,7 +430,8 @@ extern void zil_clean(zilog_t *zilog, uint64_t > synced_ extern int zil_suspend(const char *osname, void **cookiep); > extern void zil_resume(void *cookie); > > -extern void zil_add_block(zilog_t *zilog, const blkptr_t *bp); > +extern void zil_lwb_add_block(struct lwb *lwb, const blkptr_t *bp); > +extern void zil_lwb_add_txg(struct lwb *lwb, uint64_t txg); > extern int zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp); > > extern void zil_set_sync(zilog_t *zilog, uint64_t syncval); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h > Tue Sep 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Tue > Sep 26 11:04:08 2017 (r324011) @@ -20,7 +20,7 @@ */ > /* > * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights > reserved. > - * Copyright (c) 2012 by Delphix. All rights reserved. > + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > */ > > @@ -37,22 +37,76 @@ extern "C" { > #endif > > /* > - * Log write buffer. > + * Possbile states for a given lwb structure. An lwb will start out in > + * the "closed" state, and then transition to the "opened" state via a > + * call to zil_lwb_write_open(). After the lwb is "open", it can > + * transition into the "issued" state via zil_lwb_write_issue(). After > + * the lwb's zio completes, and the vdev's are flushed, the lwb will > + * transition into the "done" state via zil_lwb_write_done(), and the > + * structure eventually freed. > */ > +typedef enum { > + LWB_STATE_CLOSED, > + LWB_STATE_OPENED, > + LWB_STATE_ISSUED, > + LWB_STATE_DONE, > + LWB_NUM_STATES > +} lwb_state_t; > + > +/* > + * Log write block (lwb) > + * > + * Prior to an lwb being issued to disk via zil_lwb_write_issue(), it > + * will be protected by the zilog's "zl_writer_lock". Basically, prior > + * to it being issued, it will only be accessed by the thread that's > + * holding the "zl_writer_lock". After the lwb is issued, the zilog's > + * "zl_lock" is used to protect the lwb against concurrent access. > + */ > typedef struct lwb { > zilog_t *lwb_zilog; /* back pointer to log > struct */ blkptr_t lwb_blk; /* on disk address of this log blk > */ boolean_t lwb_slog; /* lwb_blk is on SLOG device */ > int lwb_nused; /* # used bytes in buffer */ > int lwb_sz; /* size of block and > buffer */ > + lwb_state_t lwb_state; /* the state of this lwb */ > char *lwb_buf; /* log write buffer */ > - zio_t *lwb_zio; /* zio for this buffer */ > + zio_t *lwb_write_zio; /* zio for the lwb > buffer */ > + zio_t *lwb_root_zio; /* root zio for lwb write > and flushes */ dmu_tx_t *lwb_tx; /* tx for log block allocation > */ uint64_t lwb_max_txg; /* highest txg in this lwb */ > list_node_t lwb_node; /* zilog->zl_lwb_list linkage */ > + list_t lwb_waiters; /* list of > zil_commit_waiter's */ > + avl_tree_t lwb_vdev_tree; /* vdevs to flush after lwb > write */ > + kmutex_t lwb_vdev_lock; /* protects lwb_vdev_tree */ > + hrtime_t lwb_issued_timestamp; /* when was the lwb issued? */ > } lwb_t; > > /* > + * ZIL commit waiter. > + * > + * This structure is allocated each time zil_commit() is called, and is > + * used by zil_commit() to communicate with other parts of the ZIL, such > + * that zil_commit() can know when it safe for it return. For more > + * details, see the comment above zil_commit(). > + * > + * The "zcw_lock" field is used to protect the commit waiter against > + * concurrent access. This lock is often acquired while already holding > + * the zilog's "zl_writer_lock" or "zl_lock"; see the functions > + * zil_process_commit_list() and zil_lwb_flush_vdevs_done() as examples > + * of this. Thus, one must be careful not to acquire the > + * "zl_writer_lock" or "zl_lock" when already holding the "zcw_lock"; > + * e.g. see the zil_commit_waiter_timeout() function. > + */ > +typedef struct zil_commit_waiter { > + kcondvar_t zcw_cv; /* signalled when "done" */ > + kmutex_t zcw_lock; /* protects fields of this struct */ > + list_node_t zcw_node; /* linkage in lwb_t:lwb_waiter > list */ > + lwb_t *zcw_lwb; /* back pointer to lwb when > linked */ > + boolean_t zcw_done; /* B_TRUE when "done", else > B_FALSE */ > + int zcw_zio_error; /* contains the zio > io_error value */ +} zil_commit_waiter_t; > + > +/* > * Intent log transaction lists > */ > typedef struct itxs { > @@ -94,20 +148,20 @@ struct zilog { > const zil_header_t *zl_header; /* log header buffer */ > objset_t *zl_os; /* object set we're logging */ > zil_get_data_t *zl_get_data; /* callback to get object > content */ > - zio_t *zl_root_zio; /* log writer root zio */ > + lwb_t *zl_last_lwb_opened; /* most recent lwb opened > */ > + hrtime_t zl_last_lwb_latency; /* zio latency of last lwb done > */ uint64_t zl_lr_seq; /* on-disk log record sequence number */ > uint64_t zl_commit_lr_seq; /* last committed on-disk lr seq */ > uint64_t zl_destroy_txg; /* txg of last zil_destroy() > */ uint64_t zl_replayed_seq[TXG_SIZE]; /* last replayed rec seq */ > uint64_t zl_replaying_seq; /* current replay seq number */ > uint32_t zl_suspend; /* log suspend count */ > - kcondvar_t zl_cv_writer; /* log writer thread > completion */ kcondvar_t zl_cv_suspend; /* log suspend > completion */ uint8_t zl_suspending; /* log is > currently suspending */ uint8_t zl_keep_first; /* keep > first log block in destroy */ uint8_t zl_replay; /* > replaying records while set */ uint8_t zl_stop_sync; /* > for debugging */ > - uint8_t zl_writer; /* boolean: write setup in > progress */ > + kmutex_t zl_writer_lock; /* single writer, per ZIL, at > a time */ uint8_t zl_logbias; /* latency or throughput > */ uint8_t zl_sync; /* synchronous or asynchronous */ > int zl_parse_error; /* last zil_parse() error > */ @@ -115,15 +169,10 @@ struct zilog { > uint64_t zl_parse_lr_seq; /* highest lr seq on last parse */ > uint64_t zl_parse_blk_count; /* number of blocks parsed */ > uint64_t zl_parse_lr_count; /* number of log records parsed */ > - uint64_t zl_next_batch; /* next batch number */ > - uint64_t zl_com_batch; /* committed batch number */ > - kcondvar_t zl_cv_batch[2]; /* batch condition > variables */ itxg_t zl_itxg[TXG_SIZE]; /* intent log txg > chains */ list_t zl_itx_commit_list; /* itx list to be > committed */ uint64_t zl_cur_used; /* current commit log size > used */ list_t zl_lwb_list; /* in-flight log write list > */ > - kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */ > - avl_tree_t zl_vdev_tree; /* vdevs to flush in > zil_commit() */ avl_tree_t zl_bp_tree; /* track bps during log > parse */ clock_t zl_replay_time; /* lbolt of when > replay started */ uint64_t zl_replay_blks; /* number of log > blocks replayed */ @@ -131,6 +180,7 @@ struct zilog { > uint_t zl_prev_blks[ZIL_PREV_BLKS]; /* size - sector > rounded */ uint_t zl_prev_rotor; /* rotor for zl_prev[] > */ txg_node_t zl_dirty_link; /* protected by dp_dirty_zilogs > list */ > + uint64_t zl_dirty_max_txg; /* highest txg used to dirty zilog > */ }; > > typedef struct zil_bp_node { > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Tue > Sep 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Tue Sep > 26 11:04:08 2017 (r324011) @@ -593,6 +593,7 @@ extern enum > zio_checksum zio_checksum_dedup_select(spa extern enum zio_compress > zio_compress_select(spa_t *spa, enum zio_compress child, enum zio_compress > parent); +extern void zio_cancel(zio_t *zio); > extern void zio_suspend(spa_t *spa, zio_t *zio); > extern int zio_resume(spa_t *spa); > extern void zio_resume_wait(spa_t *spa); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Sep > 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Sep 26 > 11:04:08 2017 (r324011) @@ -163,7 +163,7 @@ txg_fini(dsl_pool_t *dp) > tx_state_t *tx = &dp->dp_tx; int c; > > - ASSERT(tx->tx_threads == 0); > + ASSERT0(tx->tx_threads); > > mutex_destroy(&tx->tx_sync_lock); > > @@ -204,7 +204,7 @@ txg_sync_start(dsl_pool_t *dp) > > dprintf("pool %p\n", dp); > > - ASSERT(tx->tx_threads == 0); > + ASSERT0(tx->tx_threads); > > tx->tx_threads = 2; > > @@ -265,7 +265,7 @@ txg_sync_stop(dsl_pool_t *dp) > /* > * Finish off any work in progress. > */ > - ASSERT(tx->tx_threads == 2); > + ASSERT3U(tx->tx_threads, ==, 2); > > /* > * We need to ensure that we've vacated the deferred space_maps. > @@ -277,7 +277,7 @@ txg_sync_stop(dsl_pool_t *dp) > */ > mutex_enter(&tx->tx_sync_lock); > > - ASSERT(tx->tx_threads == 2); > + ASSERT3U(tx->tx_threads, ==, 2); > > tx->tx_exiting = 1; > > @@ -616,7 +616,7 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) > ASSERT(!dsl_pool_config_held(dp)); > > mutex_enter(&tx->tx_sync_lock); > - ASSERT(tx->tx_threads == 2); > + ASSERT3U(tx->tx_threads, ==, 2); > if (txg == 0) > txg = tx->tx_open_txg + TXG_DEFER_SIZE; > if (tx->tx_sync_txg_waiting < txg) > @@ -641,7 +641,7 @@ txg_wait_open(dsl_pool_t *dp, uint64_t txg) > ASSERT(!dsl_pool_config_held(dp)); > > mutex_enter(&tx->tx_sync_lock); > - ASSERT(tx->tx_threads == 2); > + ASSERT3U(tx->tx_threads, ==, 2); > if (txg == 0) > txg = tx->tx_open_txg + 1; > if (tx->tx_quiesce_txg_waiting < txg) > > 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 > Tue Sep 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue > Sep 26 11:04:08 2017 (r324011) @@ -76,6 +76,7 @@ #include > #include > #include > +#include > > /* > * Programming rules. > @@ -1276,7 +1277,7 @@ zfs_get_done(zgd_t *zgd, int error) > VN_RELE_ASYNC(ZTOV(zp), dsl_pool_vnrele_taskq(dmu_objset_pool(os))); > > if (error == 0 && zgd->zgd_bp) > - zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); > + zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp); > > kmem_free(zgd, sizeof (zgd_t)); > } > @@ -1289,7 +1290,7 @@ static int zil_fault_io = 0; > * Get data to generate a TX_WRITE intent log record. > */ > int > -zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) > +zfs_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, zio_t > *zio) { > zfsvfs_t *zfsvfs = arg; > objset_t *os = zfsvfs->z_os; > @@ -1301,8 +1302,9 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio > zgd_t *zgd; > int error = 0; > > - ASSERT(zio != NULL); > - ASSERT(size != 0); > + ASSERT3P(lwb, !=, NULL); > + ASSERT3P(zio, !=, NULL); > + ASSERT3U(size, !=, 0); > > /* > * Nothing to do if the file has been removed > @@ -1320,7 +1322,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio > } > > zgd = (zgd_t *)kmem_zalloc(sizeof (zgd_t), KM_SLEEP); > - zgd->zgd_zilog = zfsvfs->z_log; > + zgd->zgd_lwb = lwb; > zgd->zgd_private = zp; > > /* > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep > 26 09:34:18 2017 (r324010) +++ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep 26 > 11:04:08 2017 (r324011) @@ -42,32 +42,53 @@ #include > > /* > - * The zfs intent log (ZIL) saves transaction records of system calls > - * that change the file system in memory with enough information > - * to be able to replay them. These are stored in memory until > - * either the DMU transaction group (txg) commits them to the stable pool > - * and they can be discarded, or they are flushed to the stable log > - * (also in the pool) due to a fsync, O_DSYNC or other synchronous > - * requirement. In the event of a panic or power fail then those log > - * records (transactions) are replayed. > + * The ZFS Intent Log (ZIL) saves "transaction records" (itxs) of system > + * calls that change the file system. Each itx has enough information to > + * be able to replay them after a system crash, power loss, or > + * equivalent failure mode. These are stored in memory until either: > * > - * There is one ZIL per file system. Its on-disk (pool) format consists > - * of 3 parts: > + * 1. they are committed to the pool by the DMU transaction group > + * (txg), at which point they can be discarded; or > + * 2. they are committed to the on-disk ZIL for the dataset being > + * modified (e.g. due to an fsync, O_DSYNC, or other synchronous > + * requirement). > * > - * - ZIL header > - * - ZIL blocks > - * - ZIL records > + * In the event of a crash or power loss, the itxs contained by each > + * dataset's on-disk ZIL will be replayed when that dataset is first > + * instantianted (e.g. if the dataset is a normal fileystem, when it is > + * first mounted). > * > - * A log record holds a system call transaction. Log blocks can > - * hold many log records and the blocks are chained together. > - * Each ZIL block contains a block pointer (blkptr_t) to the next > - * ZIL block in the chain. The ZIL header points to the first > - * block in the chain. Note there is not a fixed place in the pool > - * to hold blocks. They are dynamically allocated and freed as > - * needed from the blocks available. Figure X shows the ZIL structure: > + * As hinted at above, there is one ZIL per dataset (both the in-memory > + * representation, and the on-disk representation). The on-disk format > + * consists of 3 parts: > + * > + * - a single, per-dataset, ZIL header; which points to a chain of > + * - zero or more ZIL blocks; each of which contains > + * - zero or more ZIL records > + * > + * A ZIL record holds the information necessary to replay a single > + * system call transaction. A ZIL block can hold many ZIL records, and > + * the blocks are chained together, similarly to a singly linked list. > + * > + * Each ZIL block contains a block pointer (blkptr_t) to the next ZIL > + * block in the chain, and the ZIL header points to the first block in > + * the chain. > + * > + * Note, there is not a fixed place in the pool to hold these ZIL > + * blocks; they are dynamically allocated and freed as needed from the > + * blocks available on the pool, though they can be preferentially > + * allocated from a dedicated "log" vdev. > */ > > /* > + * This controls the amount of time that a ZIL block (lwb) will remain > + * "open" when it isn't "full", and it has a thread waiting for it to be > + * committed to stable storage. Please refer to the zil_commit_waiter() > + * function (and the comments within it) for more details. > + */ > +int zfs_commit_timeout_pct = 5; > + > +/* > * Disable intent logging replay. This global ZIL switch affects all pools. > */ > int zil_replay_disable = 0; > @@ -98,6 +119,7 @@ SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_bulk, CTLFLAG > &zil_slog_bulk, 0, "Maximal SLOG commit size with sync priority"); > > static kmem_cache_t *zil_lwb_cache; > +static kmem_cache_t *zil_zcw_cache; > > #define LWB_EMPTY(lwb) ((BP_GET_LSIZE(&lwb->lwb_blk) - \ > sizeof (zil_chain_t)) == (lwb->lwb_sz - lwb->lwb_nused)) > @@ -445,6 +467,20 @@ zil_free_log_record(zilog_t *zilog, lr_t *lrc, void *t > return (0); > } > > +static int > +zil_lwb_vdev_compare(const void *x1, const void *x2) > +{ > + const uint64_t v1 = ((zil_vdev_node_t *)x1)->zv_vdev; > + const uint64_t v2 = ((zil_vdev_node_t *)x2)->zv_vdev; > + > + if (v1 < v2) > + return (-1); > + if (v1 > v2) > + return (1); > + > + return (0); > +} > + > static lwb_t * > zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg) > { > @@ -454,10 +490,13 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t > lwb->lwb_zilog = zilog; > lwb->lwb_blk = *bp; > lwb->lwb_slog = slog; > + lwb->lwb_state = LWB_STATE_CLOSED; > lwb->lwb_buf = zio_buf_alloc(BP_GET_LSIZE(bp)); > lwb->lwb_max_txg = txg; > - lwb->lwb_zio = NULL; > + lwb->lwb_write_zio = NULL; > + lwb->lwb_root_zio = NULL; > lwb->lwb_tx = NULL; > + lwb->lwb_issued_timestamp = 0; > if (BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_ZILOG2) { > lwb->lwb_nused = sizeof (zil_chain_t); > lwb->lwb_sz = BP_GET_LSIZE(bp); > @@ -470,9 +509,54 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t > list_insert_tail(&zilog->zl_lwb_list, lwb); > mutex_exit(&zilog->zl_lock); > > + ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); > + ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); > + ASSERT(list_is_empty(&lwb->lwb_waiters)); > + > return (lwb); > } > > +static void > +zil_free_lwb(zilog_t *zilog, lwb_t *lwb) > +{ > + ASSERT(MUTEX_HELD(&zilog->zl_lock)); > + ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); > + ASSERT(list_is_empty(&lwb->lwb_waiters)); > + > + if (lwb->lwb_state == LWB_STATE_OPENED) { > + avl_tree_t *t = &lwb->lwb_vdev_tree; > + void *cookie = NULL; > + zil_vdev_node_t *zv; > + > + while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) > + kmem_free(zv, sizeof (*zv)); > + > + ASSERT3P(lwb->lwb_root_zio, !=, NULL); > + ASSERT3P(lwb->lwb_write_zio, !=, NULL); > + > + zio_cancel(lwb->lwb_root_zio); > + zio_cancel(lwb->lwb_write_zio); > + > + lwb->lwb_root_zio = NULL; > + lwb->lwb_write_zio = NULL; > + } else { > + ASSERT3S(lwb->lwb_state, !=, LWB_STATE_ISSUED); > + } > + > + ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); > + ASSERT3P(lwb->lwb_write_zio, ==, NULL); > + ASSERT3P(lwb->lwb_root_zio, ==, NULL); > + > + /* > + * Clear the zilog's field to indicate this lwb is no longer > + * valid, and prevent use-after-free errors. > + */ > + if (zilog->zl_last_lwb_opened == lwb) > + zilog->zl_last_lwb_opened = NULL; > + > + kmem_cache_free(zil_lwb_cache, lwb); > +} > + > /* > * Called when we create in-memory log transactions so that we know > * to cleanup the itxs at the end of spa_sync(). > @@ -483,12 +567,16 @@ zilog_dirty(zilog_t *zilog, uint64_t txg) > dsl_pool_t *dp = zilog->zl_dmu_pool; > dsl_dataset_t *ds = dmu_objset_ds(zilog->zl_os); > > + ASSERT(spa_writeable(zilog->zl_spa)); > + > if (ds->ds_is_snapshot) > panic("dirtying snapshot!"); > > if (txg_list_add(&dp->dp_dirty_zilogs, zilog, txg)) { > /* up the hold count until we can be written out */ > dmu_buf_add_ref(ds->ds_dbuf, zilog); > + > + zilog->zl_dirty_max_txg = MAX(txg, zilog->zl_dirty_max_txg); > } > } > > @@ -556,7 +644,7 @@ zil_create(zilog_t *zilog) > */ > if (BP_IS_HOLE(&blk) || BP_SHOULD_BYTESWAP(&blk)) { > tx = dmu_tx_create(zilog->zl_os); > - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); > + VERIFY0(dmu_tx_assign(tx, TXG_WAIT)); > dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); > txg = dmu_tx_get_txg(tx); > > @@ -573,7 +661,7 @@ zil_create(zilog_t *zilog) > } > > /* > - * Allocate a log write buffer (lwb) for the first log block. > + * Allocate a log write block (lwb) for the first log block. > */ > if (error == 0) > lwb = zil_alloc_lwb(zilog, &blk, slog, txg); > @@ -594,13 +682,13 @@ zil_create(zilog_t *zilog) > } > > /* > - * In one tx, free all log blocks and clear the log header. > - * If keep_first is set, then we're replaying a log with no content. > - * We want to keep the first block, however, so that the first > - * synchronous transaction doesn't require a txg_wait_synced() > - * in zil_create(). We don't need to txg_wait_synced() here either > - * when keep_first is set, because both zil_create() and zil_destroy() > - * will wait for any in-progress destroys to complete. > + * In one tx, free all log blocks and clear the log header. If keep_first > + * is set, then we're replaying a log with no content. We want to keep the > + * first block, however, so that the first synchronous transaction doesn't > + * require a txg_wait_synced() in zil_create(). We don't need to > + * txg_wait_synced() here either when keep_first is set, because both > + * zil_create() and zil_destroy() will wait for any in-progress destroys > + * to complete. > */ > void > zil_destroy(zilog_t *zilog, boolean_t keep_first) > @@ -621,7 +709,7 @@ zil_destroy(zilog_t *zilog, boolean_t keep_first) > return; > > tx = dmu_tx_create(zilog->zl_os); > - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); > + VERIFY0(dmu_tx_assign(tx, TXG_WAIT)); > dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); > txg = dmu_tx_get_txg(tx); > > @@ -638,8 +726,8 @@ zil_destroy(zilog_t *zilog, boolean_t keep_first) > list_remove(&zilog->zl_lwb_list, lwb); > if (lwb->lwb_buf != NULL) > zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); > - zio_free_zil(zilog->zl_spa, txg, &lwb->lwb_blk); > - kmem_cache_free(zil_lwb_cache, lwb); > + zio_free(zilog->zl_spa, txg, &lwb->lwb_blk); > + zil_free_lwb(zilog, lwb); > } > } else if (!keep_first) { > zil_destroy_sync(zilog, tx); > @@ -777,24 +865,64 @@ zil_check_log_chain(dsl_pool_t *dp, dsl_dataset_t *ds, > return ((error == ECKSUM || error == ENOENT) ? 0 : error); > } > > -static int > -zil_vdev_compare(const void *x1, const void *x2) > +/* > + * When an itx is "skipped", this function is used to properly mark the > + * waiter as "done, and signal any thread(s) waiting on it. An itx can > + * be skipped (and not committed to an lwb) for a variety of reasons, > + * one of them being that the itx was committed via spa_sync(), prior to > + * it being committed to an lwb; this can happen if a thread calling > + * zil_commit() is racing with spa_sync(). > + */ > +static void > +zil_commit_waiter_skip(zil_commit_waiter_t *zcw) > { > - const uint64_t v1 = ((zil_vdev_node_t *)x1)->zv_vdev; > - const uint64_t v2 = ((zil_vdev_node_t *)x2)->zv_vdev; > + mutex_enter(&zcw->zcw_lock); > + ASSERT3B(zcw->zcw_done, ==, B_FALSE); > + zcw->zcw_done = B_TRUE; > + cv_broadcast(&zcw->zcw_cv); > + mutex_exit(&zcw->zcw_lock); > +} > > - if (v1 < v2) > - return (-1); > - if (v1 > v2) > - return (1); > +/* > + * This function is used when the given waiter is to be linked into an > + * lwb's "lwb_waiter" list; i.e. when the itx is committed to the lwb. > + * At this point, the waiter will no longer be referenced by the itx, > + * and instead, will be referenced by the lwb. > + */ > +static void > +zil_commit_waiter_link_lwb(zil_commit_waiter_t *zcw, lwb_t *lwb) > +{ > + mutex_enter(&zcw->zcw_lock); > + ASSERT(!list_link_active(&zcw->zcw_node)); > + ASSERT3P(zcw->zcw_lwb, ==, NULL); > + ASSERT3P(lwb, !=, NULL); > + ASSERT(lwb->lwb_state == LWB_STATE_OPENED || > + lwb->lwb_state == LWB_STATE_ISSUED); > > - return (0); > + list_insert_tail(&lwb->lwb_waiters, zcw); > + zcw->zcw_lwb = lwb; > + mutex_exit(&zcw->zcw_lock); > } > > +/* > + * This function is used when zio_alloc_zil() fails to allocate a ZIL > + * block, and the given waiter must be linked to the "nolwb waiters" > + * list inside of zil_process_commit_list(). > + */ > +static void > +zil_commit_waiter_link_nolwb(zil_commit_waiter_t *zcw, list_t *nolwb) > +{ > + mutex_enter(&zcw->zcw_lock); > + ASSERT(!list_link_active(&zcw->zcw_node)); > + ASSERT3P(zcw->zcw_lwb, ==, NULL); > + list_insert_tail(nolwb, zcw); > + mutex_exit(&zcw->zcw_lock); > +} > + > void > -zil_add_block(zilog_t *zilog, const blkptr_t *bp) > +zil_lwb_add_block(lwb_t *lwb, const blkptr_t *bp) > { > - avl_tree_t *t = &zilog->zl_vdev_tree; > + avl_tree_t *t = &lwb->lwb_vdev_tree; > avl_index_t where; > zil_vdev_node_t *zv, zvsearch; > int ndvas = BP_GET_NDVAS(bp); > @@ -803,14 +931,7 @@ zil_add_block(zilog_t *zilog, const blkptr_t *bp) > if (zfs_nocacheflush) > return; > > - ASSERT(zilog->zl_writer); > - > - /* > - * Even though we're zl_writer, we still need a lock because the > - * zl_get_data() callbacks may have dmu_sync() done callbacks > - * that will run concurrently. > - */ > - mutex_enter(&zilog->zl_vdev_lock); > + mutex_enter(&lwb->lwb_vdev_lock); > for (i = 0; i < ndvas; i++) { > zvsearch.zv_vdev = DVA_GET_VDEV(&bp->blk_dva[i]); > if (avl_find(t, &zvsearch, &where) == NULL) { > @@ -819,59 +940,117 @@ zil_add_block(zilog_t *zilog, const blkptr_t *bp) > avl_insert(t, zv, where); > } > } > - mutex_exit(&zilog->zl_vdev_lock); > + mutex_exit(&lwb->lwb_vdev_lock); > } > > +void > +zil_lwb_add_txg(lwb_t *lwb, uint64_t txg) > +{ > + lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); > +} > + > +/* > + * This function is a called after all VDEVs associated with a given lwb > + * write have completed their DKIOCFLUSHWRITECACHE command; or as soon > + * as the lwb write completes, if "zfs_nocacheflush" is set. > + * > + * The intention is for this function to be called as soon as the > + * contents of an lwb are considered "stable" on disk, and will survive > + * any sudden loss of power. At this point, any threads waiting for the > + * lwb to reach this state are signalled, and the "waiter" structures > + * are marked "done". > + */ > static void > -zil_flush_vdevs(zilog_t *zilog) > +zil_lwb_flush_vdevs_done(zio_t *zio) > { > - spa_t *spa = zilog->zl_spa; > - avl_tree_t *t = &zilog->zl_vdev_tree; > - void *cookie = NULL; > - zil_vdev_node_t *zv; > - zio_t *zio = NULL; > + lwb_t *lwb = zio->io_private; > + zilog_t *zilog = lwb->lwb_zilog; > + dmu_tx_t *tx = lwb->lwb_tx; > + zil_commit_waiter_t *zcw; > > - ASSERT(zilog->zl_writer); > + spa_config_exit(zilog->zl_spa, SCL_STATE, lwb); > > + zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); > + > + mutex_enter(&zilog->zl_lock); > + > /* > - * We don't need zl_vdev_lock here because we're the zl_writer, > - * and all zl_get_data() callbacks are done. > + * Ensure the lwb buffer pointer is cleared before releasing the > + * txg. If we have had an allocation failure and the txg is > + * waiting to sync then we want zil_sync() to remove the lwb so > + * that it's not picked up as the next new one in > + * zil_process_commit_list(). zil_sync() will only remove the > + * lwb if lwb_buf is null. > */ > - if (avl_numnodes(t) == 0) > - return; > + lwb->lwb_buf = NULL; > + lwb->lwb_tx = NULL; > > - spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); > + ASSERT3U(lwb->lwb_issued_timestamp, >, 0); > + zilog->zl_last_lwb_latency = gethrtime() - lwb->lwb_issued_timestamp; > > - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { > - vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); > - if (vd != NULL && !vd->vdev_nowritecache) { > - if (zio == NULL) > - zio = zio_root(spa, NULL, NULL, > ZIO_FLAG_CANFAIL); > - zio_flush(zio, vd); > - } > - kmem_free(zv, sizeof (*zv)); > + lwb->lwb_root_zio = NULL; > + lwb->lwb_state = LWB_STATE_DONE; > + > + if (zilog->zl_last_lwb_opened == lwb) { > + /* > + * Remember the highest committed log sequence number > + * for ztest. We only update this value when all the log > + * writes succeeded, because ztest wants to ASSERT that > + * it got the whole log chain. > + */ > + zilog->zl_commit_lr_seq = zilog->zl_lr_seq; > } > > + while ((zcw = list_head(&lwb->lwb_waiters)) != NULL) { > + mutex_enter(&zcw->zcw_lock); > + > + ASSERT(list_link_active(&zcw->zcw_node)); > + list_remove(&lwb->lwb_waiters, zcw); > + > + ASSERT3P(zcw->zcw_lwb, ==, lwb); > + zcw->zcw_lwb = NULL; > + > + zcw->zcw_zio_error = zio->io_error; > + > + ASSERT3B(zcw->zcw_done, ==, B_FALSE); > + zcw->zcw_done = B_TRUE; > + cv_broadcast(&zcw->zcw_cv); > + > + mutex_exit(&zcw->zcw_lock); > + } > + > + mutex_exit(&zilog->zl_lock); > + > /* > - * Wait for all the flushes to complete. Not all devices actually > - * support the DKIOCFLUSHWRITECACHE ioctl, so it's OK if it fails. > + * Now that we've written this log block, we have a stable pointer > + * to the next block in the chain, so it's OK to let the txg in > + * which we allocated the next block sync. > */ > - if (zio) > - (void) zio_wait(zio); > - > - spa_config_exit(spa, SCL_STATE, FTAG); > + dmu_tx_commit(tx); > } > > /* > - * Function called when a log block write completes > + * This is called when an lwb write completes. This means, this specific > + * lwb was written to disk, and all dependent lwb have also been > + * written to disk. > + * > + * At this point, a DKIOCFLUSHWRITECACHE command hasn't been issued to > + * the VDEVs involved in writing out this specific lwb. The lwb will be > + * "done" once zil_lwb_flush_vdevs_done() is called, which occurs in the > + * zio completion callback for the lwb's root zio. > */ > static void > zil_lwb_write_done(zio_t *zio) > { > lwb_t *lwb = zio->io_private; > + spa_t *spa = zio->io_spa; > zilog_t *zilog = lwb->lwb_zilog; > - dmu_tx_t *tx = lwb->lwb_tx; > + avl_tree_t *t = &lwb->lwb_vdev_tree; > + void *cookie = NULL; > + zil_vdev_node_t *zv; > > + ASSERT3S(spa_config_held(spa, SCL_STATE, RW_READER), !=, 0); > + > ASSERT(BP_GET_COMPRESS(zio->io_bp) == ZIO_COMPRESS_OFF); > ASSERT(BP_GET_TYPE(zio->io_bp) == DMU_OT_INTENT_LOG); > ASSERT(BP_GET_LEVEL(zio->io_bp) == 0); > @@ -880,58 +1059,115 @@ zil_lwb_write_done(zio_t *zio) > ASSERT(!BP_IS_HOLE(zio->io_bp)); > ASSERT(BP_GET_FILL(zio->io_bp) == 0); > > - /* > - * Ensure the lwb buffer pointer is cleared before releasing > - * the txg. If we have had an allocation failure and > - * the txg is waiting to sync then we want want zil_sync() > - * to remove the lwb so that it's not picked up as the next new > - * one in zil_commit_writer(). zil_sync() will only remove > - * the lwb if lwb_buf is null. > - */ > abd_put(zio->io_abd); > - zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); > + > + ASSERT3S(lwb->lwb_state, ==, LWB_STATE_ISSUED); > + > mutex_enter(&zilog->zl_lock); > - lwb->lwb_buf = NULL; > - lwb->lwb_tx = NULL; > + lwb->lwb_write_zio = NULL; > mutex_exit(&zilog->zl_lock); > > + if (avl_numnodes(t) == 0) > + return; > + > /* > - * Now that we've written this log block, we have a stable pointer > - * to the next block in the chain, so it's OK to let the txg in > - * which we allocated the next block sync. > + * If there was an IO error, we're not going to call zio_flush() > + * on these vdevs, so we simply empty the tree and free the > + * nodes. We avoid calling zio_flush() since there isn't any > + * good reason for doing so, after the lwb block failed to be > + * written out. > */ > - dmu_tx_commit(tx); > + if (zio->io_error != 0) { > + while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) > + kmem_free(zv, sizeof (*zv)); > + return; > + } > + > + while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { > + vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); > + if (vd != NULL) > + zio_flush(lwb->lwb_root_zio, vd); > + kmem_free(zv, sizeof (*zv)); > + } > } > > /* > - * Initialize the io for a log block. > + * This function's purpose is to "open" an lwb such that it is ready to > + * accept new itxs being committed to it. To do this, the lwb's zio > + * structures are created, and linked to the lwb. This function is > + * idempotent; if the passed in lwb has already been opened, this > + * function is essentially a no-op. > */ > static void > -zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb) > +zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) > { > zbookmark_phys_t zb; > zio_priority_t prio; > > + ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); > + ASSERT3P(lwb, !=, NULL); > + EQUIV(lwb->lwb_root_zio == NULL, lwb->lwb_state == LWB_STATE_CLOSED); > + EQUIV(lwb->lwb_root_zio != NULL, lwb->lwb_state == LWB_STATE_OPENED); > + > SET_BOOKMARK(&zb, lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_OBJSET], > ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, > lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_SEQ]); > > - if (zilog->zl_root_zio == NULL) { > - zilog->zl_root_zio = zio_root(zilog->zl_spa, NULL, NULL, > - ZIO_FLAG_CANFAIL); > - } > - if (lwb->lwb_zio == NULL) { > + if (lwb->lwb_root_zio == NULL) { > abd_t *lwb_abd = abd_get_from_buf(lwb->lwb_buf, > BP_GET_LSIZE(&lwb->lwb_blk)); > + > if (!lwb->lwb_slog || zilog->zl_cur_used <= zil_slog_bulk) > prio = ZIO_PRIORITY_SYNC_WRITE; > else > prio = ZIO_PRIORITY_ASYNC_WRITE; > - lwb->lwb_zio = zio_rewrite(zilog->zl_root_zio, zilog->zl_spa, > - 0, &lwb->lwb_blk, lwb_abd, BP_GET_LSIZE(&lwb->lwb_blk), > - zil_lwb_write_done, lwb, prio, > - ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); > + > + lwb->lwb_root_zio = zio_root(zilog->zl_spa, > + zil_lwb_flush_vdevs_done, lwb, ZIO_FLAG_CANFAIL); > + ASSERT3P(lwb->lwb_root_zio, !=, NULL); > + > + lwb->lwb_write_zio = zio_rewrite(lwb->lwb_root_zio, > + zilog->zl_spa, 0, &lwb->lwb_blk, lwb_abd, > + BP_GET_LSIZE(&lwb->lwb_blk), zil_lwb_write_done, lwb, > + prio, ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE, &zb); > + ASSERT3P(lwb->lwb_write_zio, !=, NULL); > + > + lwb->lwb_state = LWB_STATE_OPENED; > + > + mutex_enter(&zilog->zl_lock); > + > + /* > + * The zilog's "zl_last_lwb_opened" field is used to > + * build the lwb/zio dependency chain, which is used to > + * preserve the ordering of lwb completions that is > + * required by the semantics of the ZIL. Each new lwb > + * zio becomes a parent of the "previous" lwb zio, such > + * that the new lwb's zio cannot complete until the > + * "previous" lwb's zio completes. > + * > + * This is required by the semantics of zil_commit(); > + * the commit waiters attached to the lwbs will be woken > + * in the lwb zio's completion callback, so this zio > + * dependency graph ensures the waiters are woken in the > + * correct order (the same order the lwbs were created). > + */ > + lwb_t *last_lwb_opened = zilog->zl_last_lwb_opened; > + if (last_lwb_opened != NULL && > + last_lwb_opened->lwb_state != LWB_STATE_DONE) { > + ASSERT(last_lwb_opened->lwb_state == > LWB_STATE_OPENED || > + last_lwb_opened->lwb_state == LWB_STATE_ISSUED); > + ASSERT3P(last_lwb_opened->lwb_root_zio, !=, NULL); > + zio_add_child(lwb->lwb_root_zio, > + last_lwb_opened->lwb_root_zio); > + } > + zilog->zl_last_lwb_opened = lwb; > + > + mutex_exit(&zilog->zl_lock); > } > + > + ASSERT3P(lwb->lwb_root_zio, !=, NULL); > + ASSERT3P(lwb->lwb_write_zio, !=, NULL); > + ASSERT3S(lwb->lwb_state, ==, LWB_STATE_OPENED); > } > > /* > @@ -953,7 +1189,7 @@ uint64_t zil_block_buckets[] = { > * Calls are serialized. > */ > static lwb_t * > -zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolean_t last) > +zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) > { > lwb_t *nlwb = NULL; > zil_chain_t *zilc; > @@ -965,6 +1201,11 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolea > int i, error; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" Build world/kernel on r324015 fails due to: [...] ===> lib/libpam/modules/pam_login_access (obj) --- cddl/lib__L --- --- zil.o --- /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c:2333:19: warning: implicit declaration of function 'cv_timedwait_sbt' is invalid in C99 [-Wimplicit-function-declaration] int wait_err = cv_timedwait_sbt(&zcw->zcw_cv, ^ /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c:2335:8: error: use of undeclared identifier 'C_ABSOLUTE' C_ABSOLUTE); ^ --- lib__L --- --- obj_subdir_lib/libpam/modules/pam_nologin --- ===> lib/libpam/modules/pam_nologin (obj) --- cddl/lib__L --- 1 warning and 1 error generated. From owner-svn-src-head@freebsd.org Tue Sep 26 15:10:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43C19E0E1EE; Tue, 26 Sep 2017 15:10:00 +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 1DD0E69BD2; Tue, 26 Sep 2017 15:09:52 +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 SAA22956; Tue, 26 Sep 2017 18:09:42 +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 1dwrUT-000DDF-Rd; Tue, 26 Sep 2017 18:09:41 +0300 Subject: Re: svn commit: r324011 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/cddl/contrib/opensolaris/uts/... To: "O. Hartmann" Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201709261104.v8QB480K002320@repo.freebsd.org> <20170926154843.35a405e3@freyja.zeit4.iv.bundesimmobilien.de> From: Andriy Gapon Message-ID: Date: Tue, 26 Sep 2017 18:08:40 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170926154843.35a405e3@freyja.zeit4.iv.bundesimmobilien.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 15:10:00 -0000 On 26/09/2017 16:48, O. Hartmann wrote: > Build world/kernel on r324015 fails due to: > > [...] > ===> lib/libpam/modules/pam_login_access (obj) > --- cddl/lib__L --- > --- zil.o --- > /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c:2333:19: warning: > implicit declaration of function 'cv_timedwait_sbt' is invalid in C99 > [-Wimplicit-function-declaration] int wait_err = cv_timedwait_sbt(&zcw->zcw_cv, > ^ /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c:2335:8: error: > use of undeclared identifier 'C_ABSOLUTE' C_ABSOLUTE); > ^ > --- lib__L --- > --- obj_subdir_lib/libpam/modules/pam_nologin --- > ===> lib/libpam/modules/pam_nologin (obj) > --- cddl/lib__L --- > 1 warning and 1 error generated. Seems like messed up the commit. Not only I managed to somehow commit an older version of what I had in the review request, but I also forget that zil.c is compiled in userland mode as well. A fix is coming shortly. Apologies for the breakage. -- Andriy Gapon From owner-svn-src-head@freebsd.org Tue Sep 26 15:38:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD8AFE0EB46; Tue, 26 Sep 2017 15:38:17 +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 98F876A9EE; Tue, 26 Sep 2017 15:38:17 +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 v8QFcGDm013080; Tue, 26 Sep 2017 15:38:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QFcGcA013078; Tue, 26 Sep 2017 15:38:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709261538.v8QFcGcA013078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 26 Sep 2017 15:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324016 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 324016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 15:38:17 -0000 Author: avg Date: Tue Sep 26 15:38:16 2017 New Revision: 324016 URL: https://svnweb.freebsd.org/changeset/base/324016 Log: fix r324011, MFV of r323535, 8585 improve batching done in zil_commit() I managed to commit an older version of the change. Plus, even the latest version was not ready for userland compilation. Reported by: "O. Hartmann" , cy MFC after: 1 week X-MFC with: r324011 Modified: head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Tue Sep 26 12:46:17 2017 (r324015) +++ head/sys/cddl/compat/opensolaris/sys/time.h Tue Sep 26 15:38:16 2017 (r324016) @@ -40,6 +40,9 @@ #define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC)) #define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC)) +#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC)) +#define NSEC2USEC(n) ((n) / (NANOSEC / MICROSEC)) + #define NSEC2SEC(n) ((n) / (NANOSEC / SEC)) #define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC)) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep 26 12:46:17 2017 (r324015) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Sep 26 15:38:16 2017 (r324016) @@ -2283,8 +2283,13 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t * zil_process_commit_list() function. */ int pct = MAX(zfs_commit_timeout_pct, 1); +#if defined(illumos) || !defined(_KERNEL) hrtime_t sleep = (zilog->zl_last_lwb_latency * pct) / 100; hrtime_t wakeup = gethrtime() + sleep; +#else + sbintime_t sleep = nstosbt((zilog->zl_last_lwb_latency * pct) / 100); + sbintime_t wakeup = getsbinuptime() + sleep; +#endif boolean_t timedout = B_FALSE; while (!zcw->zcw_done) { @@ -2322,7 +2327,7 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t * timeout is reached; responsibility (2) from * the comment above this function. */ -#ifdef illumos +#if defined(illumos) || !defined(_KERNEL) clock_t timeleft = cv_timedwait_hires(&zcw->zcw_cv, &zcw->zcw_lock, wakeup, USEC2NSEC(1), CALLOUT_FLAG_ABSOLUTE); @@ -2331,8 +2336,7 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t continue; #else int wait_err = cv_timedwait_sbt(&zcw->zcw_cv, - &zcw->zcw_lock, wakeup * SBT_1NS, SBT_1NS, - C_ABSOLUTE); + &zcw->zcw_lock, wakeup, SBT_1NS, C_ABSOLUTE); if (wait_err != EWOULDBLOCK || zcw->zcw_done) continue; #endif From owner-svn-src-head@freebsd.org Tue Sep 26 16:18:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8C43E0FD67; Tue, 26 Sep 2017 16:18:12 +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 847596C65A; Tue, 26 Sep 2017 16:18:12 +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 v8QGIBfj030919; Tue, 26 Sep 2017 16:18:11 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QGIAG2030909; Tue, 26 Sep 2017 16:18:10 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709261618.v8QGIAG2030909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 26 Sep 2017 16:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324017 - in head/sys: crypto/via netipsec opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: crypto/via netipsec opencrypto X-SVN-Commit-Revision: 324017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 16:18:12 -0000 Author: cem Date: Tue Sep 26 16:18:10 2017 New Revision: 324017 URL: https://svnweb.freebsd.org/changeset/base/324017 Log: opencrypto: Loosen restriction on HMAC key sizes Theoretically, HMACs do not actually have any limit on key sizes. Transforms should compact input keys larger than the HMAC block size by using the transform (hash) on the input key. (Short input keys are padded out with zeros to the HMAC block size.) Still, not all FreeBSD crypto drivers that provide HMAC functionality handle longer-than-blocksize keys appropriately, so enforce a "maximum" key length in the crypto API for auth_hashes that previously expressed a requirement. (The "maximum" is the size of a single HMAC block for the given transform.) Unconstrained auth_hashes are left as-is. I believe the previous hardcoded sizes were committed in the original import of opencrypto from OpenBSD and are due to specific protocol details of IPSec. Note that none of the previous sizes actually matched the appropriate HMAC block size. The previous hardcoded sizes made the SHA tests in cryptotest.py useless for testing FreeBSD crypto drivers; none of the NIST-KAT example inputs had keys sized to the previous expectations. The following drivers were audited to check that they handled keys up to the block size of the HMAC safely: Software HMAC: * padlock(4) * cesa * glxsb * safe(4) * ubsec(4) Hardware accelerated HMAC: * ccr(4) * hifn(4) * sec(4) (Only supports up to 64 byte keys despite claiming to support SHA2 HMACs, but validates input key sizes) * cryptocteon (MIPS) * nlmsec (MIPS) * rmisec (MIPS) (Amusingly, does not appear to use key material at all -- presumed broken) Reviewed by: jhb (previous version), rlibby (previous version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12437 Modified: head/sys/crypto/via/padlock_hash.c head/sys/netipsec/xform_ah.c head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/xform_md5.c head/sys/opencrypto/xform_null.c head/sys/opencrypto/xform_rmd160.c head/sys/opencrypto/xform_sha1.c head/sys/opencrypto/xform_sha2.c Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/crypto/via/padlock_hash.c Tue Sep 26 16:18:10 2017 (r324017) @@ -82,7 +82,8 @@ static void padlock_sha256_final(uint8_t *hash, struct static struct auth_hash padlock_hmac_sha1 = { CRYPTO_SHA1_HMAC, "HMAC-SHA1", - 20, SHA1_HASH_LEN, SHA1_HMAC_BLOCK_LEN, sizeof(struct padlock_sha_ctx), + SHA1_HMAC_BLOCK_LEN, SHA1_HASH_LEN, sizeof(struct padlock_sha_ctx), + SHA1_HMAC_BLOCK_LEN, (void (*)(void *))padlock_sha_init, NULL, NULL, (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, (void (*)(uint8_t *, void *))padlock_sha1_final @@ -90,7 +91,8 @@ static struct auth_hash padlock_hmac_sha1 = { static struct auth_hash padlock_hmac_sha256 = { CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256", - 32, SHA2_256_HASH_LEN, SHA2_256_HMAC_BLOCK_LEN, sizeof(struct padlock_sha_ctx), + SHA2_256_HMAC_BLOCK_LEN, SHA2_256_HASH_LEN, + sizeof(struct padlock_sha_ctx), SHA2_256_HMAC_BLOCK_LEN, (void (*)(void *))padlock_sha_init, NULL, NULL, (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, (void (*)(uint8_t *, void *))padlock_sha256_final Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/netipsec/xform_ah.c Tue Sep 26 16:18:10 2017 (r324017) @@ -193,9 +193,9 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp, st return EINVAL; } keylen = _KEYLEN(sav->key_auth); - if (keylen != thash->keysize && thash->keysize != 0) { + if (keylen > thash->keysize && thash->keysize != 0) { DPRINTF(("%s: invalid keylength %d, algorithm %s requires " - "keysize %d\n", __func__, + "keysize less than %d\n", __func__, keylen, thash->name, thash->keysize)); return EINVAL; } Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/cryptodev.c Tue Sep 26 16:18:10 2017 (r324017) @@ -520,7 +520,8 @@ cryptof_ioctl( if (thash) { cria.cri_alg = thash->type; cria.cri_klen = sop->mackeylen * 8; - if (sop->mackeylen != thash->keysize) { + if (thash->keysize != 0 && + sop->mackeylen > thash->keysize) { CRYPTDEB("invalid mac key length"); error = EINVAL; goto bail; Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/cryptodev.h Tue Sep 26 16:18:10 2017 (r324017) @@ -95,13 +95,6 @@ #define HMAC_IPAD_VAL 0x36 #define HMAC_OPAD_VAL 0x5C /* HMAC Key Length */ -#define NULL_HMAC_KEY_LEN 0 -#define MD5_HMAC_KEY_LEN 16 -#define SHA1_HMAC_KEY_LEN 20 -#define RIPEMD160_HMAC_KEY_LEN 20 -#define SHA2_256_HMAC_KEY_LEN 32 -#define SHA2_384_HMAC_KEY_LEN 48 -#define SHA2_512_HMAC_KEY_LEN 64 #define AES_128_GMAC_KEY_LEN 16 #define AES_192_GMAC_KEY_LEN 24 #define AES_256_GMAC_KEY_LEN 32 Modified: head/sys/opencrypto/xform_md5.c ============================================================================== --- head/sys/opencrypto/xform_md5.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/xform_md5.c Tue Sep 26 16:18:10 2017 (r324017) @@ -58,14 +58,14 @@ static int MD5Update_int(void *, const u_int8_t *, u_i /* Authentication instances */ struct auth_hash auth_hash_hmac_md5 = { CRYPTO_MD5_HMAC, "HMAC-MD5", - MD5_HMAC_KEY_LEN, MD5_HASH_LEN, sizeof(MD5_CTX), MD5_HMAC_BLOCK_LEN, + MD5_HMAC_BLOCK_LEN, MD5_HASH_LEN, sizeof(MD5_CTX), MD5_HMAC_BLOCK_LEN, (void (*) (void *)) MD5Init, NULL, NULL, MD5Update_int, (void (*) (u_int8_t *, void *)) MD5Final }; struct auth_hash auth_hash_key_md5 = { CRYPTO_MD5_KPDK, "Keyed MD5", - NULL_HMAC_KEY_LEN, MD5_KPDK_HASH_LEN, sizeof(MD5_CTX), 0, + 0, MD5_KPDK_HASH_LEN, sizeof(MD5_CTX), 0, (void (*)(void *)) MD5Init, NULL, NULL, MD5Update_int, (void (*)(u_int8_t *, void *)) MD5Final }; Modified: head/sys/opencrypto/xform_null.c ============================================================================== --- head/sys/opencrypto/xform_null.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/xform_null.c Tue Sep 26 16:18:10 2017 (r324017) @@ -78,7 +78,7 @@ struct enc_xform enc_xform_null = { /* Authentication instances */ struct auth_hash auth_hash_null = { /* NB: context isn't used */ CRYPTO_NULL_HMAC, "NULL-HMAC", - NULL_HMAC_KEY_LEN, NULL_HASH_LEN, sizeof(int), NULL_HMAC_BLOCK_LEN, + 0, NULL_HASH_LEN, sizeof(int), NULL_HMAC_BLOCK_LEN, null_init, null_reinit, null_reinit, null_update, null_final }; Modified: head/sys/opencrypto/xform_rmd160.c ============================================================================== --- head/sys/opencrypto/xform_rmd160.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/xform_rmd160.c Tue Sep 26 16:18:10 2017 (r324017) @@ -58,7 +58,7 @@ static int RMD160Update_int(void *, const u_int8_t *, /* Authentication instances */ struct auth_hash auth_hash_hmac_ripemd_160 = { CRYPTO_RIPEMD160_HMAC, "HMAC-RIPEMD-160", - RIPEMD160_HMAC_KEY_LEN, RIPEMD160_HASH_LEN, sizeof(RMD160_CTX), + RIPEMD160_HMAC_BLOCK_LEN, RIPEMD160_HASH_LEN, sizeof(RMD160_CTX), RIPEMD160_HMAC_BLOCK_LEN, (void (*)(void *)) RMD160Init, NULL, NULL, RMD160Update_int, (void (*)(u_int8_t *, void *)) RMD160Final Modified: head/sys/opencrypto/xform_sha1.c ============================================================================== --- head/sys/opencrypto/xform_sha1.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/xform_sha1.c Tue Sep 26 16:18:10 2017 (r324017) @@ -60,13 +60,13 @@ static void SHA1Final_int(u_int8_t *, void *); /* Authentication instances */ struct auth_hash auth_hash_hmac_sha1 = { CRYPTO_SHA1_HMAC, "HMAC-SHA1", - SHA1_HMAC_KEY_LEN, SHA1_HASH_LEN, sizeof(SHA1_CTX), SHA1_HMAC_BLOCK_LEN, + SHA1_HMAC_BLOCK_LEN, SHA1_HASH_LEN, sizeof(SHA1_CTX), SHA1_HMAC_BLOCK_LEN, SHA1Init_int, NULL, NULL, SHA1Update_int, SHA1Final_int }; struct auth_hash auth_hash_key_sha1 = { CRYPTO_SHA1_KPDK, "Keyed SHA1", - NULL_HMAC_KEY_LEN, SHA1_KPDK_HASH_LEN, sizeof(SHA1_CTX), 0, + 0, SHA1_KPDK_HASH_LEN, sizeof(SHA1_CTX), 0, SHA1Init_int, NULL, NULL, SHA1Update_int, SHA1Final_int }; Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Tue Sep 26 15:38:16 2017 (r324016) +++ head/sys/opencrypto/xform_sha2.c Tue Sep 26 16:18:10 2017 (r324017) @@ -62,7 +62,7 @@ static int SHA512Update_int(void *, const u_int8_t *, /* Authentication instances */ struct auth_hash auth_hash_hmac_sha2_256 = { CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256", - SHA2_256_HMAC_KEY_LEN, SHA2_256_HASH_LEN, sizeof(SHA256_CTX), + SHA2_256_HMAC_BLOCK_LEN, SHA2_256_HASH_LEN, sizeof(SHA256_CTX), SHA2_256_HMAC_BLOCK_LEN, (void (*)(void *)) SHA256_Init, NULL, NULL, SHA256Update_int, (void (*)(u_int8_t *, void *)) SHA256_Final @@ -70,7 +70,7 @@ struct auth_hash auth_hash_hmac_sha2_256 = { struct auth_hash auth_hash_hmac_sha2_384 = { CRYPTO_SHA2_384_HMAC, "HMAC-SHA2-384", - SHA2_384_HMAC_KEY_LEN, SHA2_384_HASH_LEN, sizeof(SHA384_CTX), + SHA2_384_HMAC_BLOCK_LEN, SHA2_384_HASH_LEN, sizeof(SHA384_CTX), SHA2_384_HMAC_BLOCK_LEN, (void (*)(void *)) SHA384_Init, NULL, NULL, SHA384Update_int, (void (*)(u_int8_t *, void *)) SHA384_Final @@ -78,7 +78,7 @@ struct auth_hash auth_hash_hmac_sha2_384 = { struct auth_hash auth_hash_hmac_sha2_512 = { CRYPTO_SHA2_512_HMAC, "HMAC-SHA2-512", - SHA2_512_HMAC_KEY_LEN, SHA2_512_HASH_LEN, sizeof(SHA512_CTX), + SHA2_512_HMAC_BLOCK_LEN, SHA2_512_HASH_LEN, sizeof(SHA512_CTX), SHA2_512_HMAC_BLOCK_LEN, (void (*)(void *)) SHA512_Init, NULL, NULL, SHA512Update_int, (void (*)(u_int8_t *, void *)) SHA512_Final From owner-svn-src-head@freebsd.org Tue Sep 26 17:52:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 809CBE122F4; Tue, 26 Sep 2017 17:52:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E2BA6F53F; Tue, 26 Sep 2017 17:52:54 +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 v8QHqrpc071889; Tue, 26 Sep 2017 17:52:53 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QHqq87071883; Tue, 26 Sep 2017 17:52:52 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709261752.v8QHqq87071883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 26 Sep 2017 17:52:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324019 - in head/sys: crypto/via opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: crypto/via opencrypto X-SVN-Commit-Revision: 324019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 17:52:54 -0000 Author: cem Date: Tue Sep 26 17:52:52 2017 New Revision: 324019 URL: https://svnweb.freebsd.org/changeset/base/324019 Log: opencrypto: Use C99 initializers for auth_hash instances A misordering in the Via padlock driver really strongly suggested that these should use C99 named initializers. No functional change. Sponsored by: Dell EMC Isilon Modified: head/sys/crypto/via/padlock_hash.c head/sys/opencrypto/xform_md5.c head/sys/opencrypto/xform_null.c head/sys/opencrypto/xform_rmd160.c head/sys/opencrypto/xform_sha1.c head/sys/opencrypto/xform_sha2.c Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Tue Sep 26 17:35:53 2017 (r324018) +++ head/sys/crypto/via/padlock_hash.c Tue Sep 26 17:52:52 2017 (r324019) @@ -81,21 +81,27 @@ static void padlock_sha1_final(uint8_t *hash, struct p static void padlock_sha256_final(uint8_t *hash, struct padlock_sha_ctx *ctx); static struct auth_hash padlock_hmac_sha1 = { - CRYPTO_SHA1_HMAC, "HMAC-SHA1", - SHA1_HMAC_BLOCK_LEN, SHA1_HASH_LEN, sizeof(struct padlock_sha_ctx), - SHA1_HMAC_BLOCK_LEN, - (void (*)(void *))padlock_sha_init, NULL, NULL, - (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, - (void (*)(uint8_t *, void *))padlock_sha1_final + .type = CRYPTO_SHA1_HMAC, + .name = "HMAC-SHA1", + .keysize = SHA1_HMAC_BLOCK_LEN, + .hashsize = SHA1_HASH_LEN, + .ctxsize = sizeof(struct padlock_sha_ctx), + .blocksize = SHA1_HMAC_BLOCK_LEN, + .Init = (void (*)(void *))padlock_sha_init, + .Update = (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, + .Final = (void (*)(uint8_t *, void *))padlock_sha1_final, }; static struct auth_hash padlock_hmac_sha256 = { - CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256", - SHA2_256_HMAC_BLOCK_LEN, SHA2_256_HASH_LEN, - sizeof(struct padlock_sha_ctx), SHA2_256_HMAC_BLOCK_LEN, - (void (*)(void *))padlock_sha_init, NULL, NULL, - (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, - (void (*)(uint8_t *, void *))padlock_sha256_final + .type = CRYPTO_SHA2_256_HMAC, + .name = "HMAC-SHA2-256", + .keysize = SHA2_256_HMAC_BLOCK_LEN, + .hashsize = SHA2_256_HASH_LEN, + .ctxsize = sizeof(struct padlock_sha_ctx), + .blocksize = SHA2_256_HMAC_BLOCK_LEN, + .Init = (void (*)(void *))padlock_sha_init, + .Update = (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, + .Final = (void (*)(uint8_t *, void *))padlock_sha256_final, }; MALLOC_DECLARE(M_PADLOCK); Modified: head/sys/opencrypto/xform_md5.c ============================================================================== --- head/sys/opencrypto/xform_md5.c Tue Sep 26 17:35:53 2017 (r324018) +++ head/sys/opencrypto/xform_md5.c Tue Sep 26 17:52:52 2017 (r324019) @@ -57,17 +57,27 @@ static int MD5Update_int(void *, const u_int8_t *, u_i /* Authentication instances */ struct auth_hash auth_hash_hmac_md5 = { - CRYPTO_MD5_HMAC, "HMAC-MD5", - MD5_HMAC_BLOCK_LEN, MD5_HASH_LEN, sizeof(MD5_CTX), MD5_HMAC_BLOCK_LEN, - (void (*) (void *)) MD5Init, NULL, NULL, MD5Update_int, - (void (*) (u_int8_t *, void *)) MD5Final + .type = CRYPTO_MD5_HMAC, + .name = "HMAC-MD5", + .keysize = MD5_HMAC_BLOCK_LEN, + .hashsize = MD5_HASH_LEN, + .ctxsize = sizeof(MD5_CTX), + .blocksize = MD5_HMAC_BLOCK_LEN, + .Init = (void (*) (void *)) MD5Init, + .Update = MD5Update_int, + .Final = (void (*) (u_int8_t *, void *)) MD5Final, }; struct auth_hash auth_hash_key_md5 = { - CRYPTO_MD5_KPDK, "Keyed MD5", - 0, MD5_KPDK_HASH_LEN, sizeof(MD5_CTX), 0, - (void (*)(void *)) MD5Init, NULL, NULL, MD5Update_int, - (void (*)(u_int8_t *, void *)) MD5Final + .type = CRYPTO_MD5_KPDK, + .name = "Keyed MD5", + .keysize = 0, + .hashsize = MD5_KPDK_HASH_LEN, + .ctxsize = sizeof(MD5_CTX), + .blocksize = 0, + .Init = (void (*)(void *)) MD5Init, + .Update = MD5Update_int, + .Final = (void (*)(u_int8_t *, void *)) MD5Final, }; /* Modified: head/sys/opencrypto/xform_null.c ============================================================================== --- head/sys/opencrypto/xform_null.c Tue Sep 26 17:35:53 2017 (r324018) +++ head/sys/opencrypto/xform_null.c Tue Sep 26 17:52:52 2017 (r324019) @@ -76,10 +76,18 @@ struct enc_xform enc_xform_null = { }; /* Authentication instances */ -struct auth_hash auth_hash_null = { /* NB: context isn't used */ - CRYPTO_NULL_HMAC, "NULL-HMAC", - 0, NULL_HASH_LEN, sizeof(int), NULL_HMAC_BLOCK_LEN, - null_init, null_reinit, null_reinit, null_update, null_final +struct auth_hash auth_hash_null = { + .type = CRYPTO_NULL_HMAC, + .name = "NULL-HMAC", + .keysize = 0, + .hashsize = NULL_HASH_LEN, + .ctxsize = sizeof(int), /* NB: context isn't used */ + .blocksize = NULL_HMAC_BLOCK_LEN, + .Init = null_init, + .Setkey = null_reinit, + .Reinit = null_reinit, + .Update = null_update, + .Final = null_final, }; /* Modified: head/sys/opencrypto/xform_rmd160.c ============================================================================== --- head/sys/opencrypto/xform_rmd160.c Tue Sep 26 17:35:53 2017 (r324018) +++ head/sys/opencrypto/xform_rmd160.c Tue Sep 26 17:52:52 2017 (r324019) @@ -57,11 +57,15 @@ static int RMD160Update_int(void *, const u_int8_t *, /* Authentication instances */ struct auth_hash auth_hash_hmac_ripemd_160 = { - CRYPTO_RIPEMD160_HMAC, "HMAC-RIPEMD-160", - RIPEMD160_HMAC_BLOCK_LEN, RIPEMD160_HASH_LEN, sizeof(RMD160_CTX), - RIPEMD160_HMAC_BLOCK_LEN, - (void (*)(void *)) RMD160Init, NULL, NULL, RMD160Update_int, - (void (*)(u_int8_t *, void *)) RMD160Final + .type = CRYPTO_RIPEMD160_HMAC, + .name = "HMAC-RIPEMD-160", + .keysize = RIPEMD160_HMAC_BLOCK_LEN, + .hashsize = RIPEMD160_HASH_LEN, + .ctxsize = sizeof(RMD160_CTX), + .blocksize = RIPEMD160_HMAC_BLOCK_LEN, + .Init = (void (*)(void *)) RMD160Init, + .Update = RMD160Update_int, + .Final = (void (*)(u_int8_t *, void *)) RMD160Final, }; /* Modified: head/sys/opencrypto/xform_sha1.c ============================================================================== --- head/sys/opencrypto/xform_sha1.c Tue Sep 26 17:35:53 2017 (r324018) +++ head/sys/opencrypto/xform_sha1.c Tue Sep 26 17:52:52 2017 (r324019) @@ -59,15 +59,27 @@ static void SHA1Final_int(u_int8_t *, void *); /* Authentication instances */ struct auth_hash auth_hash_hmac_sha1 = { - CRYPTO_SHA1_HMAC, "HMAC-SHA1", - SHA1_HMAC_BLOCK_LEN, SHA1_HASH_LEN, sizeof(SHA1_CTX), SHA1_HMAC_BLOCK_LEN, - SHA1Init_int, NULL, NULL, SHA1Update_int, SHA1Final_int + .type = CRYPTO_SHA1_HMAC, + .name = "HMAC-SHA1", + .keysize = SHA1_HMAC_BLOCK_LEN, + .hashsize = SHA1_HASH_LEN, + .ctxsize = sizeof(SHA1_CTX), + .blocksize = SHA1_HMAC_BLOCK_LEN, + .Init = SHA1Init_int, + .Update = SHA1Update_int, + .Final = SHA1Final_int, }; struct auth_hash auth_hash_key_sha1 = { - CRYPTO_SHA1_KPDK, "Keyed SHA1", - 0, SHA1_KPDK_HASH_LEN, sizeof(SHA1_CTX), 0, - SHA1Init_int, NULL, NULL, SHA1Update_int, SHA1Final_int + .type = CRYPTO_SHA1_KPDK, + .name = "Keyed SHA1", + .keysize = 0, + .hashsize = SHA1_KPDK_HASH_LEN, + .ctxsize = sizeof(SHA1_CTX), + .blocksize = 0, + .Init = SHA1Init_int, + .Update = SHA1Update_int, + .Final = SHA1Final_int, }; /* Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Tue Sep 26 17:35:53 2017 (r324018) +++ head/sys/opencrypto/xform_sha2.c Tue Sep 26 17:52:52 2017 (r324019) @@ -61,27 +61,39 @@ static int SHA512Update_int(void *, const u_int8_t *, /* Authentication instances */ struct auth_hash auth_hash_hmac_sha2_256 = { - CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256", - SHA2_256_HMAC_BLOCK_LEN, SHA2_256_HASH_LEN, sizeof(SHA256_CTX), - SHA2_256_HMAC_BLOCK_LEN, - (void (*)(void *)) SHA256_Init, NULL, NULL, SHA256Update_int, - (void (*)(u_int8_t *, void *)) SHA256_Final + .type = CRYPTO_SHA2_256_HMAC, + .name = "HMAC-SHA2-256", + .keysize = SHA2_256_HMAC_BLOCK_LEN, + .hashsize = SHA2_256_HASH_LEN, + .ctxsize = sizeof(SHA256_CTX), + .blocksize = SHA2_256_HMAC_BLOCK_LEN, + .Init = (void (*)(void *)) SHA256_Init, + .Update = SHA256Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA256_Final, }; struct auth_hash auth_hash_hmac_sha2_384 = { - CRYPTO_SHA2_384_HMAC, "HMAC-SHA2-384", - SHA2_384_HMAC_BLOCK_LEN, SHA2_384_HASH_LEN, sizeof(SHA384_CTX), - SHA2_384_HMAC_BLOCK_LEN, - (void (*)(void *)) SHA384_Init, NULL, NULL, SHA384Update_int, - (void (*)(u_int8_t *, void *)) SHA384_Final + .type = CRYPTO_SHA2_384_HMAC, + .name = "HMAC-SHA2-384", + .keysize = SHA2_384_HMAC_BLOCK_LEN, + .hashsize = SHA2_384_HASH_LEN, + .ctxsize = sizeof(SHA384_CTX), + .blocksize = SHA2_384_HMAC_BLOCK_LEN, + .Init = (void (*)(void *)) SHA384_Init, + .Update = SHA384Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA384_Final, }; struct auth_hash auth_hash_hmac_sha2_512 = { - CRYPTO_SHA2_512_HMAC, "HMAC-SHA2-512", - SHA2_512_HMAC_BLOCK_LEN, SHA2_512_HASH_LEN, sizeof(SHA512_CTX), - SHA2_512_HMAC_BLOCK_LEN, - (void (*)(void *)) SHA512_Init, NULL, NULL, SHA512Update_int, - (void (*)(u_int8_t *, void *)) SHA512_Final + .type = CRYPTO_SHA2_512_HMAC, + .name = "HMAC-SHA2-512", + .keysize = SHA2_512_HMAC_BLOCK_LEN, + .hashsize = SHA2_512_HASH_LEN, + .ctxsize = sizeof(SHA512_CTX), + .blocksize = SHA2_512_HMAC_BLOCK_LEN, + .Init = (void (*)(void *)) SHA512_Init, + .Update = SHA512Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA512_Final, }; /* From owner-svn-src-head@freebsd.org Tue Sep 26 19:19:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7476E16472; Tue, 26 Sep 2017 19:19:46 +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 D2BEC725BE; Tue, 26 Sep 2017 19:19:45 +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 v8QJJjCp006043; Tue, 26 Sep 2017 19:19:45 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QJJjx1006042; Tue, 26 Sep 2017 19:19:45 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709261919.v8QJJjx1006042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 19:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324020 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 19:19:46 -0000 Author: manu Date: Tue Sep 26 19:19:44 2017 New Revision: 324020 URL: https://svnweb.freebsd.org/changeset/base/324020 Log: aw_usbphy: Fix write of unknown register Some SoC require a write to a unknown register to work corectly. This write should be in the pmu region not in the phy ctrl one. Reported by: Mark Millard (markmi@dsl-only.net) Modified: head/sys/arm/allwinner/aw_usbphy.c Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Tue Sep 26 17:52:52 2017 (r324019) +++ head/sys/arm/allwinner/aw_usbphy.c Tue Sep 26 19:19:44 2017 (r324020) @@ -158,7 +158,7 @@ awusbphy_configure(device_t dev, int phyno) return; if (sc->phy_conf->pmu_unk1 == true) - CLR4(sc->phy_ctrl, PMU_UNK_H3, PMU_UNK_H3_CLR); + CLR4(sc->pmu[phyno], PMU_UNK_H3, PMU_UNK_H3_CLR); if (sc->phy_conf->phy0_route == true) { if (phyno == 0) From owner-svn-src-head@freebsd.org Tue Sep 26 19:20:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E0A4E164FA; Tue, 26 Sep 2017 19:20:52 +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 D1D507274D; Tue, 26 Sep 2017 19:20:51 +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 v8QJKpb9006141; Tue, 26 Sep 2017 19:20:51 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QJKp9M006140; Tue, 26 Sep 2017 19:20:51 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709261920.v8QJKp9M006140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 19:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324021 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 19:20:52 -0000 Author: manu Date: Tue Sep 26 19:20:50 2017 New Revision: 324021 URL: https://svnweb.freebsd.org/changeset/base/324021 Log: aw_usbphy: Only reroute OTG for phy0 We only need to route OTG port to host mode on phy0 and if no VBUS is present on the port, otherwise leave the port in periperal mode. Modified: head/sys/arm/allwinner/aw_usbphy.c Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Tue Sep 26 19:19:44 2017 (r324020) +++ head/sys/arm/allwinner/aw_usbphy.c Tue Sep 26 19:20:50 2017 (r324021) @@ -160,13 +160,6 @@ awusbphy_configure(device_t dev, int phyno) if (sc->phy_conf->pmu_unk1 == true) CLR4(sc->pmu[phyno], PMU_UNK_H3, PMU_UNK_H3_CLR); - if (sc->phy_conf->phy0_route == true) { - if (phyno == 0) - SET4(sc->phy_ctrl, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG); - else - CLR4(sc->phy_ctrl, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG); - } - SET4(sc->pmu[phyno], PMU_IRQ_ENABLE, PMU_ULPI_BYPASS | PMU_AHB_INCR8 | PMU_AHB_INCR4 | PMU_AHB_INCRX_ALIGN); } @@ -266,8 +259,11 @@ awusbphy_vbus_detect(device_t dev, int *val) if (sc->vbus_det_valid) { error = gpio_pin_is_active(sc->vbus_det_pin, &active); - if (error != 0) + if (error != 0) { + device_printf(dev, "Cannot get status of id pin %d\n", + error); return (error); + } *val = active; return (0); } @@ -300,7 +296,21 @@ awusbphy_phy_enable(device_t dev, intptr_t phy, bool e /* If an external vbus is detected, do not enable phy 0 */ if (phy == 0) { error = awusbphy_vbus_detect(dev, &vbus_det); - if (error == 0 && vbus_det == 1) + if (error) + goto out; + + /* Depending on the PHY we need to route OTG to OHCI/EHCI */ + if (sc->phy_conf->phy0_route == true) { + if (vbus_det == 0) + /* Host mode */ + CLR4(sc->phy_ctrl, OTG_PHY_CFG, + OTG_PHY_ROUTE_OTG); + else + /* Peripheral mode */ + SET4(sc->phy_ctrl, OTG_PHY_CFG, + OTG_PHY_ROUTE_OTG); + } + if (vbus_det == 1) return (0); } else error = 0; @@ -308,6 +318,8 @@ awusbphy_phy_enable(device_t dev, intptr_t phy, bool e error = regulator_enable(reg); } else error = regulator_disable(reg); + +out: if (error != 0) { device_printf(dev, "couldn't %s regulator for phy %jd\n", From owner-svn-src-head@freebsd.org Tue Sep 26 19:21:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AA7FE166E7; Tue, 26 Sep 2017 19:21:45 +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 D15057292D; Tue, 26 Sep 2017 19:21:44 +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 v8QJLhgY007720; Tue, 26 Sep 2017 19:21:43 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QJLhGG007719; Tue, 26 Sep 2017 19:21:43 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709261921.v8QJLhGG007719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 19:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324022 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 19:21:45 -0000 Author: manu Date: Tue Sep 26 19:21:43 2017 New Revision: 324022 URL: https://svnweb.freebsd.org/changeset/base/324022 Log: a10_ehci: Enable all clocks and reset a10_ehci can have multiple clocks and reset, enable them all instead of only the first one. Modified: head/sys/arm/allwinner/a10_ehci.c Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Tue Sep 26 19:20:50 2017 (r324021) +++ head/sys/arm/allwinner/a10_ehci.c Tue Sep 26 19:21:43 2017 (r324022) @@ -88,11 +88,21 @@ __FBSDID("$FreeBSD$"); static device_attach_t a10_ehci_attach; static device_detach_t a10_ehci_detach; +struct clk_list { + TAILQ_ENTRY(clk_list) next; + clk_t clk; +}; + +struct hwrst_list { + TAILQ_ENTRY(hwrst_list) next; + hwreset_t rst; +}; + struct aw_ehci_softc { ehci_softc_t sc; - clk_t clk; - hwreset_t rst; - phy_t phy; + TAILQ_HEAD(, clk_list) clk_list; + TAILQ_HEAD(, hwrst_list) rst_list; + phy_t phy; }; struct aw_ehci_conf { @@ -114,6 +124,7 @@ static struct ofw_compat_data compat_data[] = { { "allwinner,sun7i-a20-ehci", (uintptr_t)&a10_ehci_conf }, { "allwinner,sun8i-a83t-ehci", (uintptr_t)&a31_ehci_conf }, { "allwinner,sun8i-h3-ehci", (uintptr_t)&a31_ehci_conf }, + /* { "allwinner,sun50i-a64-ehci", (uintptr_t)&a31_ehci_conf }, */ { NULL, (uintptr_t)NULL } }; @@ -139,8 +150,11 @@ a10_ehci_attach(device_t self) ehci_softc_t *sc = &aw_sc->sc; const struct aw_ehci_conf *conf; bus_space_handle_t bsh; - int err; - int rid; + int err, rid, off; + struct clk_list *clkp; + clk_t clk; + struct hwrst_list *rstp; + hwreset_t rst; uint32_t reg_value = 0; conf = USB_CONF(self); @@ -204,27 +218,33 @@ a10_ehci_attach(device_t self) sc->sc_flags |= EHCI_SCFLG_DONTRESET; + /* Enable clock for USB */ + TAILQ_INIT(&aw_sc->clk_list); + for (off = 0; clk_get_by_ofw_index(self, 0, off, &clk) == 0; off++) { + err = clk_enable(clk); + if (err != 0) { + device_printf(self, "Could not enable clock %s\n", + clk_get_name(clk)); + goto error; + } + clkp = malloc(sizeof(*clkp), M_DEVBUF, M_WAITOK | M_ZERO); + clkp->clk = clk; + TAILQ_INSERT_TAIL(&aw_sc->clk_list, clkp, next); + } + /* De-assert reset */ - if (hwreset_get_by_ofw_idx(self, 0, 0, &aw_sc->rst) == 0) { - err = hwreset_deassert(aw_sc->rst); + TAILQ_INIT(&aw_sc->rst_list); + for (off = 0; hwreset_get_by_ofw_idx(self, 0, off, &rst) == 0; off++) { + err = hwreset_deassert(rst); if (err != 0) { device_printf(self, "Could not de-assert reset\n"); goto error; } + rstp = malloc(sizeof(*rstp), M_DEVBUF, M_WAITOK | M_ZERO); + rstp->rst = rst; + TAILQ_INSERT_TAIL(&aw_sc->rst_list, rstp, next); } - /* Enable clock for USB */ - err = clk_get_by_ofw_index(self, 0, 0, &aw_sc->clk); - if (err != 0) { - device_printf(self, "Could not get clock\n"); - goto error; - } - err = clk_enable(aw_sc->clk); - if (err != 0) { - device_printf(self, "Could not enable clock\n"); - goto error; - } - /* Enable USB PHY */ if (phy_get_by_ofw_name(self, 0, "usb", &aw_sc->phy) == 0) { err = phy_enable(self, aw_sc->phy); @@ -272,6 +292,8 @@ a10_ehci_detach(device_t self) const struct aw_ehci_conf *conf; int err; uint32_t reg_value = 0; + struct clk_list *clk, *clk_tmp; + struct hwrst_list *rst, *rst_tmp; conf = USB_CONF(self); @@ -319,16 +341,26 @@ a10_ehci_detach(device_t self) reg_value &= ~SW_ULPI_BYPASS; /* ULPI bypass disable */ A10_WRITE_4(sc, SW_USB_PMU_IRQ_ENABLE, reg_value); - /* Disable clock for USB */ - if (aw_sc->clk != NULL) { - clk_disable(aw_sc->clk); - clk_release(aw_sc->clk); + /* Disable clock */ + TAILQ_FOREACH_SAFE(clk, &aw_sc->clk_list, next, clk_tmp) { + err = clk_disable(clk->clk); + if (err != 0) + device_printf(self, "Could not disable clock %s\n", + clk_get_name(clk->clk)); + err = clk_release(clk->clk); + if (err != 0) + device_printf(self, "Could not release clock %s\n", + clk_get_name(clk->clk)); + TAILQ_REMOVE(&aw_sc->clk_list, clk, next); + free(clk, M_DEVBUF); } /* Assert reset */ - if (aw_sc->rst != NULL) { - hwreset_assert(aw_sc->rst); - hwreset_release(aw_sc->rst); + TAILQ_FOREACH_SAFE(rst, &aw_sc->rst_list, next, rst_tmp) { + hwreset_assert(rst->rst); + hwreset_release(rst->rst); + TAILQ_REMOVE(&aw_sc->rst_list, rst, next); + free(rst, M_DEVBUF); } return (0); From owner-svn-src-head@freebsd.org Tue Sep 26 20:23:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E51B9E207A0; Tue, 26 Sep 2017 20:23:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF1F674E14; Tue, 26 Sep 2017 20:23:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QKN9dZ034408; Tue, 26 Sep 2017 20:23:09 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QKN9Ul034407; Tue, 26 Sep 2017 20:23:09 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709262023.v8QKN9Ul034407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 26 Sep 2017 20:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324024 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 20:23:11 -0000 Author: manu Date: Tue Sep 26 20:23:09 2017 New Revision: 324024 URL: https://svnweb.freebsd.org/changeset/base/324024 Log: a10_gpio: Enable all needed clocks Do not enable only the first clock, enable them all. Modified: head/sys/arm/allwinner/a10_gpio.c Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Tue Sep 26 19:56:36 2017 (r324023) +++ head/sys/arm/allwinner/a10_gpio.c Tue Sep 26 20:23:09 2017 (r324024) @@ -165,6 +165,11 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0} }; +struct clk_list { + TAILQ_ENTRY(clk_list) next; + clk_t clk; +}; + struct a10_gpio_softc { device_t sc_dev; device_t sc_busdev; @@ -175,6 +180,7 @@ struct a10_gpio_softc { bus_space_handle_t sc_bsh; void * sc_intrhand; const struct allwinner_padconf * padconf; + TAILQ_HEAD(, clk_list) clk_list; }; #define A10_GPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) @@ -766,8 +772,10 @@ a10_gpio_attach(device_t dev) int rid, error; phandle_t gpio; struct a10_gpio_softc *sc; + struct clk_list *clkp, *clkp_tmp; clk_t clk; - hwreset_t rst; + hwreset_t rst = NULL; + int off, err; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -811,12 +819,17 @@ a10_gpio_attach(device_t dev) } } - if (clk_get_by_ofw_index(dev, 0, 0, &clk) == 0) { - error = clk_enable(clk); - if (error != 0) { - device_printf(dev, "could not enable clock\n"); - return (error); + TAILQ_INIT(&sc->clk_list); + for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) { + err = clk_enable(clk); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(clk)); + goto fail; } + clkp = malloc(sizeof(*clkp), M_DEVBUF, M_WAITOK | M_ZERO); + clkp->clk = clk; + TAILQ_INSERT_TAIL(&sc->clk_list, clkp, next); } sc->sc_busdev = gpiobus_attach_bus(dev); @@ -839,6 +852,26 @@ fail: if (sc->sc_mem_res) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); mtx_destroy(&sc->sc_mtx); + + /* Disable clock */ + TAILQ_FOREACH_SAFE(clkp, &sc->clk_list, next, clkp_tmp) { + err = clk_disable(clkp->clk); + if (err != 0) + device_printf(dev, "Could not disable clock %s\n", + clk_get_name(clkp->clk)); + err = clk_release(clkp->clk); + if (err != 0) + device_printf(dev, "Could not release clock %s\n", + clk_get_name(clkp->clk)); + TAILQ_REMOVE(&sc->clk_list, clkp, next); + free(clkp, M_DEVBUF); + } + + /* Assert resets */ + if (rst) { + hwreset_assert(rst); + hwreset_release(rst); + } return (ENXIO); } From owner-svn-src-head@freebsd.org Tue Sep 26 20:53:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F33DE213E5; Tue, 26 Sep 2017 20:53:27 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C0F675E1F; Tue, 26 Sep 2017 20:53:27 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QKrQoN046936; Tue, 26 Sep 2017 20:53:26 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QKrQUN046933; Tue, 26 Sep 2017 20:53:26 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201709262053.v8QKrQUN046933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 26 Sep 2017 20:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324026 - head/sys/dev/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: head/sys/dev/qlxgbe X-SVN-Commit-Revision: 324026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 20:53:27 -0000 Author: davidcs Date: Tue Sep 26 20:53:25 2017 New Revision: 324026 URL: https://svnweb.freebsd.org/changeset/base/324026 Log: Fix delete all multicast addresses Submitted by:Anand.Khoje@cavium.com MFC after:5 days Modified: head/sys/dev/qlxgbe/ql_glbl.h head/sys/dev/qlxgbe/ql_hw.c head/sys/dev/qlxgbe/ql_os.c Modified: head/sys/dev/qlxgbe/ql_glbl.h ============================================================================== --- head/sys/dev/qlxgbe/ql_glbl.h Tue Sep 26 20:26:48 2017 (r324025) +++ head/sys/dev/qlxgbe/ql_glbl.h Tue Sep 26 20:53:25 2017 (r324026) @@ -75,6 +75,7 @@ extern int ql_hw_check_health(qla_host_t *ha); extern void qla_hw_async_event(qla_host_t *ha); extern int qla_get_nic_partition(qla_host_t *ha, uint32_t *supports_9kb, uint32_t *num_rcvq); +extern int qla_hw_del_all_mcast(qla_host_t *ha); extern int ql_iscsi_pdu(qla_host_t *ha, struct mbuf *mp); extern void ql_minidump(qla_host_t *ha); Modified: head/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.c Tue Sep 26 20:26:48 2017 (r324025) +++ head/sys/dev/qlxgbe/ql_hw.c Tue Sep 26 20:53:25 2017 (r324026) @@ -64,7 +64,6 @@ static int qla_link_event_req(qla_host_t *ha, uint16_t static int qla_tx_tso(qla_host_t *ha, struct mbuf *mp, q80_tx_cmd_t *tx_cmd, uint8_t *hdr); static int qla_hw_add_all_mcast(qla_host_t *ha); -static int qla_hw_del_all_mcast(qla_host_t *ha); static int qla_add_rcv_rings(qla_host_t *ha, uint32_t sds_idx, uint32_t nsds); static int qla_init_nic_func(qla_host_t *ha); @@ -3413,7 +3412,7 @@ qla_hw_add_all_mcast(qla_host_t *ha) return (ret); } -static int +int qla_hw_del_all_mcast(qla_host_t *ha) { int ret; Modified: head/sys/dev/qlxgbe/ql_os.c ============================================================================== --- head/sys/dev/qlxgbe/ql_os.c Tue Sep 26 20:26:48 2017 (r324025) +++ head/sys/dev/qlxgbe/ql_os.c Tue Sep 26 20:53:25 2017 (r324026) @@ -975,7 +975,19 @@ qla_set_multi(qla_host_t *ha, uint32_t add_multi) return (-1); if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ret = ql_hw_set_multi(ha, mta, mcnt, add_multi); + + if (!add_multi) { + ret = qla_hw_del_all_mcast(ha); + + if (ret) + device_printf(ha->pci_dev, + "%s: qla_hw_del_all_mcast() failed\n", + __func__); + } + + if (!ret) + ret = ql_hw_set_multi(ha, mta, mcnt, 1); + } QLA_UNLOCK(ha, __func__); From owner-svn-src-head@freebsd.org Tue Sep 26 21:54:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B437DE23122; Tue, 26 Sep 2017 21:54:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83A5A7C57F; Tue, 26 Sep 2017 21:54:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QLsJvK072447; Tue, 26 Sep 2017 21:54:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QLsJYa072446; Tue, 26 Sep 2017 21:54:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201709262154.v8QLsJYa072446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 26 Sep 2017 21:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324033 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 324033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 21:54:20 -0000 Author: glebius Date: Tue Sep 26 21:54:19 2017 New Revision: 324033 URL: https://svnweb.freebsd.org/changeset/base/324033 Log: Fix regression from r323855. The EXIT trap now isn't cleared, so upon exit it tried to unmount already unmounted partition, resulting in failure. Modified: head/tools/tools/nanobsd/legacy.sh Modified: head/tools/tools/nanobsd/legacy.sh ============================================================================== --- head/tools/tools/nanobsd/legacy.sh Tue Sep 26 21:18:43 2017 (r324032) +++ head/tools/tools/nanobsd/legacy.sh Tue Sep 26 21:54:19 2017 (r324033) @@ -197,7 +197,7 @@ create_diskimage ( ) ( fi mdconfig -d -u $MD - trap - 1 2 15 + trap - 1 2 15 EXIT ) > ${NANO_LOG}/_.di 2>&1 ) From owner-svn-src-head@freebsd.org Tue Sep 26 23:12:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4059E24FC7; Tue, 26 Sep 2017 23:12:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66CE37F2A4; Tue, 26 Sep 2017 23:12:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QNCXBN005331; Tue, 26 Sep 2017 23:12:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QNCXvB005324; Tue, 26 Sep 2017 23:12:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709262312.v8QNCXvB005324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 26 Sep 2017 23:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324037 - in head: share/man/man4 sys/conf sys/crypto/aesni sys/modules/aesni tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/crypto/aesni sys/modules/aesni tests/sys/opencrypto X-SVN-Commit-Revision: 324037 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 23:12:34 -0000 Author: cem Date: Tue Sep 26 23:12:32 2017 New Revision: 324037 URL: https://svnweb.freebsd.org/changeset/base/324037 Log: aesni(4): Add support for x86 SHA intrinsics Some x86 class CPUs have accelerated intrinsics for SHA1 and SHA256. Provide this functionality on CPUs that support it. This implements CRYPTO_SHA1, CRYPTO_SHA1_HMAC, and CRYPTO_SHA2_256_HMAC. Correctness: The cryptotest.py suite in tests/sys/opencrypto has been enhanced to verify SHA1 and SHA256 HMAC using standard NIST test vectors. The test passes on this driver. Additionally, jhb's cryptocheck tool has been used to compare various random inputs against OpenSSL. This test also passes. Rough performance averages on AMD Ryzen 1950X (4kB buffer): aesni: SHA1: ~8300 Mb/s SHA256: ~8000 Mb/s cryptosoft: ~1800 Mb/s SHA256: ~1800 Mb/s So ~4.4-4.6x speedup depending on algorithm choice. This is consistent with the results the Linux folks saw for 4kB buffers. The driver borrows SHA update code from sys/crypto sha1 and sha256. The intrinsic step function comes from Intel under a 3-clause BSDL.[0] The intel_sha_extensions_sha_intrinsic.c files were renamed and lightly modified (added const, resolved a warning or two; included the sha_sse header to declare the functions). [0]: https://software.intel.com/en-us/articles/intel-sha-extensions-implementations Reviewed by: jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12452 Added: head/sys/crypto/aesni/intel_sha1.c (contents, props changed) head/sys/crypto/aesni/intel_sha256.c (contents, props changed) head/sys/crypto/aesni/sha_sse.h (contents, props changed) Modified: head/share/man/man4/aesni.4 head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni.h head/sys/modules/aesni/Makefile head/tests/sys/opencrypto/cryptotest.py Modified: head/share/man/man4/aesni.4 ============================================================================== --- head/share/man/man4/aesni.4 Tue Sep 26 22:32:08 2017 (r324036) +++ head/share/man/man4/aesni.4 Tue Sep 26 23:12:32 2017 (r324037) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2015 +.Dd September 26, 2017 .Dt AESNI 4 .Os .Sh NAME .Nm aesni -.Nd "driver for the AES accelerator on Intel CPUs" +.Nd "driver for the AES and SHA accelerator on x86 CPUs" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -47,8 +47,8 @@ module at boot time, place the following line in aesni_load="YES" .Ed .Sh DESCRIPTION -Starting with some models of Core i5/i7, Intel processors implement -a new set of instructions called AESNI. +Starting with Intel Westmere and AMD Bulldozer, some x86 processors implement a +new set of instructions called AESNI. The set of six instructions accelerates the calculation of the key schedule for key lengths of 128, 192, and 256 of the Advanced Encryption Standard (AES) symmetric cipher, and provides a hardware @@ -56,13 +56,24 @@ implementation of the regular and the last encryption rounds. .Pp The processor capability is reported as AESNI in the Features2 line at boot. +.Pp +Starting with the Intel Goldmont and AMD Ryzen microarchitectures, some x86 +processors implement a new set of SHA instructions. +The set of seven instructions accelerates the calculation of SHA1 and SHA256 +hashes. +.Pp +The processor capability is reported as SHA in the Structured Extended Features +line at boot. +.Pp The .Nm -driver does not attach on systems that lack the required CPU capability. +driver does not attach on systems that lack both CPU capabilities. +On systems that support only one of AESNI or SHA extensions, the driver will +attach and support that one function. .Pp The .Nm -driver registers itself to accelerate AES operations for +driver registers itself to accelerate AES and SHA operations for .Xr crypto 4 . Besides speed, the advantage of using the .Nm @@ -83,13 +94,18 @@ The .Nm driver first appeared in .Fx 9.0 . +SHA support was added in +.Fx 12.0 . .Sh AUTHORS .An -nosplit The .Nm driver was written by -.An Konstantin Belousov Aq Mt kib@FreeBSD.org . +.An Konstantin Belousov Aq Mt kib@FreeBSD.org +and +.An Conrad Meyer Aq Mt cem@FreeBSD.org . The key schedule calculation code was adopted from the sample provided by Intel and used in the analogous .Ox driver. +The hash step intrinsics implementations were supplied by Intel. Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Sep 26 22:32:08 2017 (r324036) +++ head/sys/conf/files.amd64 Tue Sep 26 23:12:32 2017 (r324037) @@ -182,6 +182,16 @@ aesni_wrap.o optional aesni \ crypto/blowfish/bf_enc.c optional crypto | ipsec | ipsec_support crypto/des/des_enc.c optional crypto | ipsec | \ ipsec_support | netsmb +intel_sha1.o optional aesni \ + dependency "$S/crypto/aesni/intel_sha1.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -msha ${.IMPSRC}" \ + no-implicit-rule \ + clean "intel_sha1.o" +intel_sha256.o optional aesni \ + dependency "$S/crypto/aesni/intel_sha256.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -msha ${.IMPSRC}" \ + no-implicit-rule \ + clean "intel_sha256.o" crypto/via/padlock.c optional padlock crypto/via/padlock_cipher.c optional padlock crypto/via/padlock_hash.c optional padlock Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Sep 26 22:32:08 2017 (r324036) +++ head/sys/conf/files.i386 Tue Sep 26 23:12:32 2017 (r324037) @@ -132,6 +132,16 @@ aesni_wrap.o optional aesni \ no-implicit-rule \ clean "aesni_wrap.o" crypto/des/arch/i386/des_enc.S optional crypto | ipsec | ipsec_support | netsmb +intel_sha1.o optional aesni \ + dependency "$S/crypto/aesni/intel_sha1.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -msha ${.IMPSRC}" \ + no-implicit-rule \ + clean "intel_sha1.o" +intel_sha256.o optional aesni \ + dependency "$S/crypto/aesni/intel_sha256.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -msha ${.IMPSRC}" \ + no-implicit-rule \ + clean "intel_sha256.o" crypto/via/padlock.c optional padlock crypto/via/padlock_cipher.c optional padlock crypto/via/padlock_hash.c optional padlock Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Tue Sep 26 22:32:08 2017 (r324036) +++ head/sys/crypto/aesni/aesni.c Tue Sep 26 23:12:32 2017 (r324037) @@ -2,6 +2,7 @@ * Copyright (c) 2005-2008 Pawel Jakub Dawidek * Copyright (c) 2010 Konstantin Belousov * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2017 Conrad Meyer * All rights reserved. * * Portions of this software were developed by John-Mark Gurney @@ -46,10 +47,24 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include -#include +#include +#include +#include + +#include #include +#include +#include +#include +#if defined(__i386__) +#include +#elif defined(__amd64__) +#include +#endif + static struct mtx_padalign *ctx_mtx; static struct fpu_kern_ctx **ctx_fpu; @@ -57,6 +72,8 @@ struct aesni_softc { int dieing; int32_t cid; uint32_t sid; + bool has_aes; + bool has_sha; TAILQ_HEAD(aesni_sessions_head, aesni_session) sessions; struct rwlock lock; }; @@ -79,9 +96,13 @@ static int aesni_freesession(device_t, uint64_t tid); static void aesni_freesession_locked(struct aesni_softc *sc, struct aesni_session *ses); static int aesni_cipher_setup(struct aesni_session *ses, - struct cryptoini *encini); + struct cryptoini *encini, struct cryptoini *authini); static int aesni_cipher_process(struct aesni_session *ses, struct cryptodesc *enccrd, struct cryptodesc *authcrd, struct cryptop *crp); +static int aesni_cipher_crypt(struct aesni_session *ses, + struct cryptodesc *enccrd, struct cryptodesc *authcrd, struct cryptop *crp); +static int aesni_cipher_mac(struct aesni_session *ses, struct cryptodesc *crd, + struct cryptop *crp); MALLOC_DEFINE(M_AESNI, "aesni_data", "AESNI Data"); @@ -95,21 +116,33 @@ aesni_identify(driver_t *drv, device_t parent) panic("aesni: could not attach"); } +static void +detect_cpu_features(bool *has_aes, bool *has_sha) +{ + + *has_aes = ((cpu_feature2 & CPUID2_AESNI) != 0 && + (cpu_feature2 & CPUID2_SSE41) != 0); + *has_sha = ((cpu_stdext_feature & CPUID_STDEXT_SHA) != 0 && + (cpu_feature2 & CPUID2_SSSE3) != 0); +} + static int aesni_probe(device_t dev) { + bool has_aes, has_sha; - if ((cpu_feature2 & CPUID2_AESNI) == 0) { - device_printf(dev, "No AESNI support.\n"); + detect_cpu_features(&has_aes, &has_sha); + if (!has_aes && !has_sha) { + device_printf(dev, "No AES or SHA support.\n"); return (EINVAL); - } + } else if (has_aes && has_sha) + device_set_desc(dev, + "AES-CBC,AES-XTS,AES-GCM,AES-ICM,SHA1,SHA256"); + else if (has_aes) + device_set_desc(dev, "AES-CBC,AES-XTS,AES-GCM,AES-ICM"); + else + device_set_desc(dev, "SHA1,SHA256"); - if ((cpu_feature2 & CPUID2_SSE41) == 0) { - device_printf(dev, "No SSE4.1 support.\n"); - return (EINVAL); - } - - device_set_desc_copy(dev, "AES-CBC,AES-XTS,AES-GCM,AES-ICM"); return (0); } @@ -161,13 +194,22 @@ aesni_attach(device_t dev) } rw_init(&sc->lock, "aesni_lock"); - crypto_register(sc->cid, CRYPTO_AES_CBC, 0, 0); - crypto_register(sc->cid, CRYPTO_AES_ICM, 0, 0); - crypto_register(sc->cid, CRYPTO_AES_NIST_GCM_16, 0, 0); - crypto_register(sc->cid, CRYPTO_AES_128_NIST_GMAC, 0, 0); - crypto_register(sc->cid, CRYPTO_AES_192_NIST_GMAC, 0, 0); - crypto_register(sc->cid, CRYPTO_AES_256_NIST_GMAC, 0, 0); - crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0); + + detect_cpu_features(&sc->has_aes, &sc->has_sha); + if (sc->has_aes) { + crypto_register(sc->cid, CRYPTO_AES_CBC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_ICM, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_NIST_GCM_16, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_128_NIST_GMAC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_192_NIST_GMAC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_256_NIST_GMAC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0); + } + if (sc->has_sha) { + crypto_register(sc->cid, CRYPTO_SHA1, 0, 0); + crypto_register(sc->cid, CRYPTO_SHA1_HMAC, 0, 0); + crypto_register(sc->cid, CRYPTO_SHA2_256_HMAC, 0, 0); + } return (0); } @@ -208,7 +250,8 @@ aesni_newsession(device_t dev, uint32_t *sidp, struct { struct aesni_softc *sc; struct aesni_session *ses; - struct cryptoini *encini; + struct cryptoini *encini, *authini; + bool gcm_hash, gcm; int error; if (sidp == NULL || cri == NULL) { @@ -221,13 +264,20 @@ aesni_newsession(device_t dev, uint32_t *sidp, struct return (EINVAL); ses = NULL; + authini = NULL; encini = NULL; + gcm = false; + gcm_hash = false; for (; cri != NULL; cri = cri->cri_next) { switch (cri->cri_alg) { + case CRYPTO_AES_NIST_GCM_16: + gcm = true; + /* FALLTHROUGH */ case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: case CRYPTO_AES_XTS: - case CRYPTO_AES_NIST_GCM_16: + if (!sc->has_aes) + goto unhandled; if (encini != NULL) { CRYPTDEB("encini already set"); return (EINVAL); @@ -241,16 +291,35 @@ aesni_newsession(device_t dev, uint32_t *sidp, struct * nothing to do here, maybe in the future cache some * values for GHASH */ + gcm_hash = true; break; + case CRYPTO_SHA1: + case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_256_HMAC: + if (!sc->has_sha) + goto unhandled; + if (authini != NULL) { + CRYPTDEB("authini already set"); + return (EINVAL); + } + authini = cri; + break; default: +unhandled: CRYPTDEB("unhandled algorithm"); return (EINVAL); } } - if (encini == NULL) { + if (encini == NULL && authini == NULL) { CRYPTDEB("no cipher"); return (EINVAL); } + /* + * GMAC algorithms are only supported with simultaneous GCM. Likewise + * GCM is not supported without GMAC. + */ + if (gcm_hash != gcm) + return (EINVAL); rw_wlock(&sc->lock); if (sc->dieing) { @@ -275,9 +344,13 @@ aesni_newsession(device_t dev, uint32_t *sidp, struct ses->used = 1; TAILQ_INSERT_TAIL(&sc->sessions, ses, next); rw_wunlock(&sc->lock); - ses->algo = encini->cri_alg; - error = aesni_cipher_setup(ses, encini); + if (encini != NULL) + ses->algo = encini->cri_alg; + if (authini != NULL) + ses->auth_algo = authini->cri_alg; + + error = aesni_cipher_setup(ses, encini, authini); if (error != 0) { CRYPTDEB("setup failed"); rw_wlock(&sc->lock); @@ -299,7 +372,7 @@ aesni_freesession_locked(struct aesni_softc *sc, struc sid = ses->id; TAILQ_REMOVE(&sc->sessions, ses, next); - *ses = (struct aesni_session){}; + explicit_bzero(ses, sizeof(*ses)); ses->id = sid; TAILQ_INSERT_HEAD(&sc->sessions, ses, next); } @@ -351,6 +424,9 @@ aesni_process(device_t dev, struct cryptop *crp, int h for (crd = crp->crp_desc; crd != NULL; crd = crd->crd_next) { switch (crd->crd_alg) { + case CRYPTO_AES_NIST_GCM_16: + needauth = 1; + /* FALLTHROUGH */ case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: case CRYPTO_AES_XTS: @@ -361,24 +437,17 @@ aesni_process(device_t dev, struct cryptop *crp, int h enccrd = crd; break; - case CRYPTO_AES_NIST_GCM_16: - if (enccrd != NULL) { - error = EINVAL; - goto out; - } - enccrd = crd; - needauth = 1; - break; - case CRYPTO_AES_128_NIST_GMAC: case CRYPTO_AES_192_NIST_GMAC: case CRYPTO_AES_256_NIST_GMAC: + case CRYPTO_SHA1: + case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_256_HMAC: if (authcrd != NULL) { error = EINVAL; goto out; } authcrd = crd; - needauth = 1; break; default: @@ -387,14 +456,16 @@ aesni_process(device_t dev, struct cryptop *crp, int h } } - if (enccrd == NULL || (needauth && authcrd == NULL)) { + if ((enccrd == NULL && authcrd == NULL) || + (needauth && authcrd == NULL)) { error = EINVAL; goto out; } /* CBC & XTS can only handle full blocks for now */ - if ((enccrd->crd_alg == CRYPTO_AES_CBC || enccrd->crd_alg == - CRYPTO_AES_XTS) && (enccrd->crd_len % AES_BLOCK_LEN) != 0) { + if (enccrd != NULL && (enccrd->crd_alg == CRYPTO_AES_CBC || + enccrd->crd_alg == CRYPTO_AES_XTS) && + (enccrd->crd_len % AES_BLOCK_LEN) != 0) { error = EINVAL; goto out; } @@ -420,9 +491,9 @@ out: return (error); } -uint8_t * +static uint8_t * aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, - int *allocated) + bool *allocated) { struct mbuf *m; struct uio *uio; @@ -442,18 +513,18 @@ aesni_cipher_alloc(struct cryptodesc *enccrd, struct c addr = (uint8_t *)iov->iov_base; } else addr = (uint8_t *)crp->crp_buf; - *allocated = 0; + *allocated = false; addr += enccrd->crd_skip; return (addr); alloc: addr = malloc(enccrd->crd_len, M_AESNI, M_NOWAIT); if (addr != NULL) { - *allocated = 1; + *allocated = true; crypto_copydata(crp->crp_flags, crp->crp_buf, enccrd->crd_skip, enccrd->crd_len, addr); } else - *allocated = 0; + *allocated = false; return (addr); } @@ -482,13 +553,28 @@ MODULE_VERSION(aesni, 1); MODULE_DEPEND(aesni, crypto, 1, 1, 1); static int -aesni_cipher_setup(struct aesni_session *ses, struct cryptoini *encini) +aesni_cipher_setup(struct aesni_session *ses, struct cryptoini *encini, + struct cryptoini *authini) { struct fpu_kern_ctx *ctx; - int error; - int kt, ctxidx; + int kt, ctxidx, keylen, error; - kt = is_fpu_kern_thread(0); + switch (ses->auth_algo) { + case CRYPTO_SHA1: + case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_256_HMAC: + if (authini->cri_klen % 8 != 0) + return (EINVAL); + keylen = authini->cri_klen / 8; + if (keylen > sizeof(ses->hmac_key)) + return (EINVAL); + if (ses->auth_algo == CRYPTO_SHA1 && keylen > 0) + return (EINVAL); + memcpy(ses->hmac_key, authini->cri_key, keylen); + ses->mlen = authini->cri_mlen; + } + + kt = is_fpu_kern_thread(0) || (encini == NULL); if (!kt) { ACQUIRE_CTX(ctxidx, ctx); error = fpu_kern_enter(curthread, ctx, @@ -497,8 +583,10 @@ aesni_cipher_setup(struct aesni_session *ses, struct c goto out; } - error = aesni_cipher_setup_common(ses, encini->cri_key, - encini->cri_klen); + error = 0; + if (encini != NULL) + error = aesni_cipher_setup_common(ses, encini->cri_key, + encini->cri_klen); if (!kt) { fpu_kern_leave(curthread, ctx); @@ -508,52 +596,198 @@ out: return (error); } +static int +intel_sha1_update(void *vctx, const void *vdata, u_int datalen) +{ + struct sha1_ctxt *ctx = vctx; + const char *data = vdata; + size_t gaplen; + size_t gapstart; + size_t off; + size_t copysiz; + u_int blocks; + + off = 0; + /* Do any aligned blocks without redundant copying. */ + if (datalen >= 64 && ctx->count % 64 == 0) { + blocks = datalen / 64; + ctx->c.b64[0] += blocks * 64 * 8; + intel_sha1_step(ctx->h.b32, data + off, blocks); + off += blocks * 64; + } + + while (off < datalen) { + gapstart = ctx->count % 64; + gaplen = 64 - gapstart; + + copysiz = (gaplen < datalen - off) ? gaplen : datalen - off; + bcopy(&data[off], &ctx->m.b8[gapstart], copysiz); + ctx->count += copysiz; + ctx->count %= 64; + ctx->c.b64[0] += copysiz * 8; + if (ctx->count % 64 == 0) + intel_sha1_step(ctx->h.b32, (void *)ctx->m.b8, 1); + off += copysiz; + } + return (0); +} + +static void +SHA1_Finalize_fn(void *digest, void *ctx) +{ + sha1_result(ctx, digest); +} + +static int +intel_sha256_update(void *vctx, const void *vdata, u_int len) +{ + SHA256_CTX *ctx = vctx; + uint64_t bitlen; + uint32_t r; + u_int blocks; + const unsigned char *src = vdata; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count >> 3) & 0x3f; + + /* Convert the length into a number of bits */ + bitlen = len << 3; + + /* Update number of bits */ + ctx->count += bitlen; + + /* Handle the case where we don't need to perform any transforms */ + if (len < 64 - r) { + memcpy(&ctx->buf[r], src, len); + return (0); + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, 64 - r); + intel_sha256_step(ctx->state, ctx->buf, 1); + src += 64 - r; + len -= 64 - r; + + /* Perform complete blocks */ + if (len >= 64) { + blocks = len / 64; + intel_sha256_step(ctx->state, src, blocks); + src += blocks * 64; + len -= blocks * 64; + } + + /* Copy left over data into buffer */ + memcpy(ctx->buf, src, len); + return (0); +} + +static void +SHA256_Finalize_fn(void *digest, void *ctx) +{ + SHA256_Final(digest, ctx); +} + /* - * authcrd contains the associated date. + * Compute the HASH( (key ^ xorbyte) || buf ) */ +static void +hmac_internal(void *ctx, uint32_t *res, + int (*update)(void *, const void *, u_int), + void (*finalize)(void *, void *), uint8_t *key, uint8_t xorbyte, + const void *buf, size_t off, size_t buflen, int crpflags) +{ + size_t i; + + for (i = 0; i < 64; i++) + key[i] ^= xorbyte; + update(ctx, key, 64); + for (i = 0; i < 64; i++) + key[i] ^= xorbyte; + + crypto_apply(crpflags, __DECONST(void *, buf), off, buflen, + __DECONST(int (*)(void *, void *, u_int), update), ctx); + finalize(res, ctx); +} + static int aesni_cipher_process(struct aesni_session *ses, struct cryptodesc *enccrd, struct cryptodesc *authcrd, struct cryptop *crp) { struct fpu_kern_ctx *ctx; - uint8_t iv[AES_BLOCK_LEN]; - uint8_t tag[GMAC_DIGEST_LEN]; - uint8_t *buf, *authbuf; - int error, allocated, authallocated; - int ivlen, encflag; - int kt, ctxidx; + int error, ctxidx; + bool kt; - encflag = (enccrd->crd_flags & CRD_F_ENCRYPT) == CRD_F_ENCRYPT; + if (enccrd != NULL) { + if ((enccrd->crd_alg == CRYPTO_AES_ICM || + enccrd->crd_alg == CRYPTO_AES_NIST_GCM_16) && + (enccrd->crd_flags & CRD_F_IV_EXPLICIT) == 0) + return (EINVAL); + } - if ((enccrd->crd_alg == CRYPTO_AES_ICM || - enccrd->crd_alg == CRYPTO_AES_NIST_GCM_16) && - (enccrd->crd_flags & CRD_F_IV_EXPLICIT) == 0) - return (EINVAL); + error = 0; + kt = is_fpu_kern_thread(0); + if (!kt) { + ACQUIRE_CTX(ctxidx, ctx); + error = fpu_kern_enter(curthread, ctx, + FPU_KERN_NORMAL | FPU_KERN_KTHR); + if (error != 0) + goto out2; + } + /* Do work */ + if (enccrd != NULL && authcrd != NULL) { + /* Perform the first operation */ + if (crp->crp_desc == enccrd) + error = aesni_cipher_crypt(ses, enccrd, authcrd, crp); + else + error = aesni_cipher_mac(ses, authcrd, crp); + if (error != 0) + goto out; + /* Perform the second operation */ + if (crp->crp_desc == enccrd) + error = aesni_cipher_mac(ses, authcrd, crp); + else + error = aesni_cipher_crypt(ses, enccrd, authcrd, crp); + } else if (enccrd != NULL) + error = aesni_cipher_crypt(ses, enccrd, authcrd, crp); + else + error = aesni_cipher_mac(ses, authcrd, crp); + + if (error != 0) + goto out; + +out: + if (!kt) { + fpu_kern_leave(curthread, ctx); +out2: + RELEASE_CTX(ctxidx, ctx); + } + return (error); +} + +static int +aesni_cipher_crypt(struct aesni_session *ses, struct cryptodesc *enccrd, + struct cryptodesc *authcrd, struct cryptop *crp) +{ + uint8_t iv[AES_BLOCK_LEN], tag[GMAC_DIGEST_LEN], *buf, *authbuf; + int error, ivlen; + bool encflag, allocated, authallocated; + buf = aesni_cipher_alloc(enccrd, crp, &allocated); if (buf == NULL) return (ENOMEM); - error = 0; - authbuf = NULL; - authallocated = 0; - if (authcrd != NULL) { + authallocated = false; + if (ses->algo == CRYPTO_AES_NIST_GCM_16 && authcrd != NULL) { authbuf = aesni_cipher_alloc(authcrd, crp, &authallocated); if (authbuf == NULL) { error = ENOMEM; - goto out1; + goto out; } } - kt = is_fpu_kern_thread(0); - if (!kt) { - ACQUIRE_CTX(ctxidx, ctx); - error = fpu_kern_enter(curthread, ctx, - FPU_KERN_NORMAL|FPU_KERN_KTHR); - if (error != 0) - goto out2; - } - + error = 0; + encflag = (enccrd->crd_flags & CRD_F_ENCRYPT) == CRD_F_ENCRYPT; if ((enccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) { error = aesni_cipher_setup_common(ses, enccrd->crd_key, enccrd->crd_klen); @@ -561,7 +795,6 @@ aesni_cipher_process(struct aesni_session *ses, struct goto out; } - /* XXX - validate that enccrd and authcrd have/use same key? */ switch (enccrd->crd_alg) { case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: @@ -593,13 +826,6 @@ aesni_cipher_process(struct aesni_session *ses, struct enccrd->crd_inject, ivlen, iv); } - if (authcrd != NULL && !encflag) - crypto_copydata(crp->crp_flags, crp->crp_buf, - authcrd->crd_inject, GMAC_DIGEST_LEN, tag); - else - bzero(tag, sizeof tag); - - /* Do work */ switch (ses->algo) { case CRYPTO_AES_CBC: if (encflag) @@ -625,11 +851,21 @@ aesni_cipher_process(struct aesni_session *ses, struct iv); break; case CRYPTO_AES_NIST_GCM_16: - if (encflag) + if (authcrd != NULL && !encflag) + crypto_copydata(crp->crp_flags, crp->crp_buf, + authcrd->crd_inject, GMAC_DIGEST_LEN, tag); + else + bzero(tag, sizeof tag); + + if (encflag) { AES_GCM_encrypt(buf, buf, authbuf, iv, tag, enccrd->crd_len, authcrd->crd_len, ivlen, ses->enc_schedule, ses->rounds); - else { + + if (authcrd != NULL) + crypto_copyback(crp->crp_flags, crp->crp_buf, + authcrd->crd_inject, GMAC_DIGEST_LEN, tag); + } else { if (!AES_GCM_decrypt(buf, buf, authbuf, iv, tag, enccrd->crd_len, authcrd->crd_len, ivlen, ses->enc_schedule, ses->rounds)) @@ -638,28 +874,78 @@ aesni_cipher_process(struct aesni_session *ses, struct break; } - if (allocated) - crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_skip, - enccrd->crd_len, buf); - - if (!error && authcrd != NULL) { - crypto_copyback(crp->crp_flags, crp->crp_buf, - authcrd->crd_inject, GMAC_DIGEST_LEN, tag); - } - out: - if (!kt) { - fpu_kern_leave(curthread, ctx); -out2: - RELEASE_CTX(ctxidx, ctx); - } - -out1: if (allocated) { - bzero(buf, enccrd->crd_len); + explicit_bzero(buf, enccrd->crd_len); free(buf, M_AESNI); } - if (authallocated) + if (authallocated) { + explicit_bzero(authbuf, authcrd->crd_len); free(authbuf, M_AESNI); + } return (error); +} + +static int +aesni_cipher_mac(struct aesni_session *ses, struct cryptodesc *crd, + struct cryptop *crp) +{ + union { + struct SHA256Context sha2 __aligned(16); + struct sha1_ctxt sha1 __aligned(16); + } sctx; + uint32_t res[SHA2_256_HASH_LEN / sizeof(uint32_t)]; + int hashlen; + + if (crd->crd_flags != 0) + return (EINVAL); + + switch (ses->auth_algo) { + case CRYPTO_SHA1_HMAC: + hashlen = SHA1_HASH_LEN; + /* Inner hash: (K ^ IPAD) || data */ + sha1_init(&sctx.sha1); + hmac_internal(&sctx.sha1, res, intel_sha1_update, + SHA1_Finalize_fn, ses->hmac_key, 0x36, crp->crp_buf, + crd->crd_skip, crd->crd_len, crp->crp_flags); + /* Outer hash: (K ^ OPAD) || inner hash */ + sha1_init(&sctx.sha1); + hmac_internal(&sctx.sha1, res, intel_sha1_update, + SHA1_Finalize_fn, ses->hmac_key, 0x5C, res, 0, hashlen, 0); + break; + case CRYPTO_SHA1: + hashlen = SHA1_HASH_LEN; + sha1_init(&sctx.sha1); + crypto_apply(crp->crp_flags, crp->crp_buf, crd->crd_skip, + crd->crd_len, __DECONST(int (*)(void *, void *, u_int), + intel_sha1_update), &sctx.sha1); + sha1_result(&sctx.sha1, (void *)res); + break; + case CRYPTO_SHA2_256_HMAC: + hashlen = SHA2_256_HASH_LEN; + /* Inner hash: (K ^ IPAD) || data */ + SHA256_Init(&sctx.sha2); + hmac_internal(&sctx.sha2, res, intel_sha256_update, + SHA256_Finalize_fn, ses->hmac_key, 0x36, crp->crp_buf, + crd->crd_skip, crd->crd_len, crp->crp_flags); + /* Outer hash: (K ^ OPAD) || inner hash */ + SHA256_Init(&sctx.sha2); + hmac_internal(&sctx.sha2, res, intel_sha256_update, + SHA256_Finalize_fn, ses->hmac_key, 0x5C, res, 0, hashlen, + 0); + break; + default: + /* + * AES-GMAC authentication is verified while processing the + * enccrd + */ + return (0); + } + + if (ses->mlen != 0 && ses->mlen < hashlen) + hashlen = ses->mlen; + + crypto_copyback(crp->crp_flags, crp->crp_buf, crd->crd_inject, hashlen, + (void *)res); + return (0); } Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Tue Sep 26 22:32:08 2017 (r324036) +++ head/sys/crypto/aesni/aesni.h Tue Sep 26 23:12:32 2017 (r324037) @@ -56,12 +56,16 @@ struct aesni_session { uint8_t enc_schedule[AES_SCHED_LEN] __aligned(16); uint8_t dec_schedule[AES_SCHED_LEN] __aligned(16); uint8_t xts_schedule[AES_SCHED_LEN] __aligned(16); + /* Same as the SHA256 Blocksize. */ + uint8_t hmac_key[SHA1_HMAC_BLOCK_LEN] __aligned(16); int algo; int rounds; /* uint8_t *ses_ictx; */ /* uint8_t *ses_octx; */ /* int ses_mlen; */ int used; + int auth_algo; + int mlen; uint32_t id; TAILQ_ENTRY(aesni_session) next; }; @@ -111,7 +115,5 @@ int AES_GCM_decrypt(const unsigned char *in, unsigned int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, int keylen); -uint8_t *aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, - int *allocated); #endif /* _AESNI_H_ */ Added: head/sys/crypto/aesni/intel_sha1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/aesni/intel_sha1.c Tue Sep 26 23:12:32 2017 (r324037) @@ -0,0 +1,261 @@ +/******************************************************************************* +* Copyright (c) 2013, Intel Corporation +* +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the +* distribution. +* +* * Neither the name of the Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* +* THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""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 INTEL CORPORATION 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. +******************************************************************************** +* +* Intel SHA Extensions optimized implementation of a SHA-1 update function +* +* The function takes a pointer to the current hash values, a pointer to the +* input data, and a number of 64 byte blocks to process. Once all blocks have +* been processed, the digest pointer is updated with the resulting hash value. +* The function only processes complete blocks, there is no functionality to +* store partial blocks. All message padding and hash value initialization must +* be done outside the update function. +* +* The indented lines in the loop are instructions related to rounds processing. +* The non-indented lines are instructions related to the message schedule. +* +* Author: Sean Gulley +* Date: July 2013 +* +******************************************************************************** +* +* Example complier command line: +* icc intel_sha_extensions_sha1_intrinsic.c +* gcc -msha -msse4 intel_sha_extensions_sha1_intrinsic.c +* +*******************************************************************************/ +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +void intel_sha1_step(uint32_t *digest, const char *data, uint32_t num_blks) { + __m128i abcd, e0, e1; + __m128i abcd_save, e_save; + __m128i msg0, msg1, msg2, msg3; + __m128i shuf_mask, e_mask; + +#if 0 + e_mask = _mm_set_epi64x(0xFFFFFFFF00000000ull, 0x0000000000000000ull); +#else + (void)e_mask; + e0 = _mm_set_epi64x(0, 0); +#endif + shuf_mask = _mm_set_epi64x(0x0001020304050607ull, 0x08090a0b0c0d0e0full); + + // Load initial hash values + abcd = _mm_loadu_si128((__m128i*) digest); + e0 = _mm_insert_epi32(e0, *(digest+4), 3); + abcd = _mm_shuffle_epi32(abcd, 0x1B); +#if 0 + e0 = _mm_and_si128(e0, e_mask); +#endif + + while (num_blks > 0) { + // Save hash values for addition after rounds + abcd_save = abcd; + e_save = e0; + + // Rounds 0-3 + msg0 = _mm_loadu_si128((const __m128i*) data); + msg0 = _mm_shuffle_epi8(msg0, shuf_mask); + e0 = _mm_add_epi32(e0, msg0); + e1 = abcd; + abcd = _mm_sha1rnds4_epu32(abcd, e0, 0); + + // Rounds 4-7 + msg1 = _mm_loadu_si128((const __m128i*) (data+16)); + msg1 = _mm_shuffle_epi8(msg1, shuf_mask); + e1 = _mm_sha1nexte_epu32(e1, msg1); + e0 = abcd; + abcd = _mm_sha1rnds4_epu32(abcd, e1, 0); + msg0 = _mm_sha1msg1_epu32(msg0, msg1); + + // Rounds 8-11 + msg2 = _mm_loadu_si128((const __m128i*) (data+32)); + msg2 = _mm_shuffle_epi8(msg2, shuf_mask); + e0 = _mm_sha1nexte_epu32(e0, msg2); + e1 = abcd; + abcd = _mm_sha1rnds4_epu32(abcd, e0, 0); + msg1 = _mm_sha1msg1_epu32(msg1, msg2); + msg0 = _mm_xor_si128(msg0, msg2); + + // Rounds 12-15 + msg3 = _mm_loadu_si128((const __m128i*) (data+48)); + msg3 = _mm_shuffle_epi8(msg3, shuf_mask); + e1 = _mm_sha1nexte_epu32(e1, msg3); + e0 = abcd; + msg0 = _mm_sha1msg2_epu32(msg0, msg3); + abcd = _mm_sha1rnds4_epu32(abcd, e1, 0); + msg2 = _mm_sha1msg1_epu32(msg2, msg3); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Sep 26 23:24:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D917E2548B; Tue, 26 Sep 2017 23:24:00 +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 07D657F8B6; Tue, 26 Sep 2017 23:23:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QNNxtR009540; Tue, 26 Sep 2017 23:23:59 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QNNw34009531; Tue, 26 Sep 2017 23:23:58 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709262323.v8QNNw34009531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 26 Sep 2017 23:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324038 - in head/sys: dev/bnxt dev/drm dev/drm2/i915 dev/drm2/radeon dev/e1000 net X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: dev/bnxt dev/drm dev/drm2/i915 dev/drm2/radeon dev/e1000 net X-SVN-Commit-Revision: 324038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 23:24:00 -0000 Author: cem Date: Tue Sep 26 23:23:58 2017 New Revision: 324038 URL: https://svnweb.freebsd.org/changeset/base/324038 Log: Add PNP metadata to more drivers GPUs: radeonkms, i915kms NICs: if_em, if_igb, if_bnxt This metadata isn't used yet, but it will be handy to have later to implement automatic module loading. Reviewed by: imp, mmacy Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12488 Modified: head/sys/dev/bnxt/if_bnxt.c head/sys/dev/drm/drmP.h head/sys/dev/drm2/i915/i915_drv.c head/sys/dev/drm2/radeon/radeon_drv.c head/sys/dev/e1000/if_em.c head/sys/net/iflib.h Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Tue Sep 26 23:12:32 2017 (r324037) +++ head/sys/dev/bnxt/if_bnxt.c Tue Sep 26 23:23:58 2017 (r324038) @@ -243,6 +243,8 @@ MODULE_DEPEND(bnxt, pci, 1, 1, 1); MODULE_DEPEND(bnxt, ether, 1, 1, 1); MODULE_DEPEND(bnxt, iflib, 1, 1, 1); +IFLIB_PNP_INFO(pci, bnxt, bnxt_vendor_info_array); + static device_method_t bnxt_iflib_methods[] = { DEVMETHOD(ifdi_tx_queues_alloc, bnxt_tx_queues_alloc), DEVMETHOD(ifdi_rx_queues_alloc, bnxt_rx_queues_alloc), Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Tue Sep 26 23:12:32 2017 (r324037) +++ head/sys/dev/drm/drmP.h Tue Sep 26 23:23:58 2017 (r324038) @@ -321,7 +321,7 @@ typedef struct drm_pci_id_list { int vendor; int device; - long driver_private; + intptr_t driver_private; char *name; } drm_pci_id_list_t; Modified: head/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- head/sys/dev/drm2/i915/i915_drv.c Tue Sep 26 23:12:32 2017 (r324037) +++ head/sys/dev/drm2/i915/i915_drv.c Tue Sep 26 23:23:58 2017 (r324038) @@ -1236,6 +1236,8 @@ MODULE_DEPEND(i915kms, agp, 1, 1, 1); MODULE_DEPEND(i915kms, iicbus, 1, 1, 1); MODULE_DEPEND(i915kms, iic, 1, 1, 1); MODULE_DEPEND(i915kms, iicbb, 1, 1, 1); +MODULE_PNP_INFO("U32:vendor;U32:device;P;D:human", vgapci, i915, pciidlist, + sizeof(pciidlist[0]), nitems(pciidlist)); /* We give fast paths for the really cool registers */ #define NEEDS_FORCE_WAKE(dev_priv, reg) \ Modified: head/sys/dev/drm2/radeon/radeon_drv.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_drv.c Tue Sep 26 23:12:32 2017 (r324037) +++ head/sys/dev/drm2/radeon/radeon_drv.c Tue Sep 26 23:23:58 2017 (r324038) @@ -401,3 +401,5 @@ MODULE_DEPEND(radeonkms, iicbus, 1, 1, 1); MODULE_DEPEND(radeonkms, iic, 1, 1, 1); MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1); MODULE_DEPEND(radeonkms, firmware, 1, 1, 1); +MODULE_PNP_INFO("U32:vendor;U32:device;P;D:human", vgapci, radeonkms, + pciidlist, sizeof(pciidlist[0]), nitems(pciidlist)); Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Sep 26 23:12:32 2017 (r324037) +++ head/sys/dev/e1000/if_em.c Tue Sep 26 23:23:58 2017 (r324038) @@ -339,6 +339,8 @@ MODULE_DEPEND(em, pci, 1, 1, 1); MODULE_DEPEND(em, ether, 1, 1, 1); MODULE_DEPEND(em, iflib, 1, 1, 1); +IFLIB_PNP_INFO(pci, em, em_vendor_info_array); + static driver_t igb_driver = { "igb", igb_methods, sizeof(struct adapter), }; @@ -350,6 +352,7 @@ MODULE_DEPEND(igb, pci, 1, 1, 1); MODULE_DEPEND(igb, ether, 1, 1, 1); MODULE_DEPEND(igb, iflib, 1, 1, 1); +IFLIB_PNP_INFO(pci, igb, igb_vendor_info_array); static device_method_t em_if_methods[] = { DEVMETHOD(ifdi_attach_pre, em_if_attach_pre), Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Tue Sep 26 23:12:32 2017 (r324037) +++ head/sys/net/iflib.h Tue Sep 26 23:23:58 2017 (r324038) @@ -173,6 +173,11 @@ typedef struct pci_vendor_info { #define PVID_OEM(vendor, devid, svid, sdevid, revid, name) {vendor, devid, svid, sdevid, revid, 0, name} #define PVID_END {0, 0, 0, 0, 0, 0, NULL} +#define IFLIB_PNP_DESCR "U32:vendor;U32:device;U32:subvendor;U32:subdevice;" \ + "U32:revision;U32:class;D:human" +#define IFLIB_PNP_INFO(b, u, t) \ + MODULE_PNP_INFO(IFLIB_PNP_DESCR, b, u, t, sizeof(t[0]), nitems(t)) + typedef struct if_txrx { int (*ift_txd_encap) (void *, if_pkt_info_t); void (*ift_txd_flush) (void *, uint16_t, qidx_t pidx); From owner-svn-src-head@freebsd.org Tue Sep 26 23:24:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD341E254ED; Tue, 26 Sep 2017 23:24:16 +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 8824B7F9FA; Tue, 26 Sep 2017 23:24:16 +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 v8QNOF03009599; Tue, 26 Sep 2017 23:24:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QNOFCZ009598; Tue, 26 Sep 2017 23:24:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709262324.v8QNOFCZ009598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 26 Sep 2017 23:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324039 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 324039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 23:24:16 -0000 Author: jhb Date: Tue Sep 26 23:24:15 2017 New Revision: 324039 URL: https://svnweb.freebsd.org/changeset/base/324039 Log: Don't defer wakeup()s for completed journal workitems. Normally wakeups() are performed for completed softupdates work items in workitem_free() before the underlying memory is free()'d. complete_jseg() was clearing the "wakeup needed" flag in work items to defer the wakeup until the end of each loop iteration. However, this resulted in the item being free'd before it's address was used with wakeup(). As a result, another part of the kernel could allocate this memory from malloc() and use it as a wait channel for a different "event" with a different lock. This triggered an assertion failure when the lock passed to sleepq_add() did not match the existing lock associated with the sleep queue. Fix this by removing the code to defer the wakeup in complete_jseg() allowing the wakeup to occur slightly earlier in workitem_free() before free() is called. The main reason I can think of for deferring a wakeup() would be to avoid waking up a waiter while holding a lock that the waiter would need. However, no locks are dropped in between the wakeup() in workitem_free() and the end of the loop in complete_jseg() as far as I can tell. In general I think it is not safe to do a wakeup() after free() as one cannot control how other parts of the kernel that might reuse the address for a different wait channel will handle spurious wakeups. Reported by: pho Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12494 Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Tue Sep 26 23:23:58 2017 (r324038) +++ head/sys/ufs/ffs/ffs_softdep.c Tue Sep 26 23:24:15 2017 (r324039) @@ -3596,15 +3596,13 @@ complete_jseg(jseg) { struct worklist *wk; struct jmvref *jmvref; - int waiting; #ifdef INVARIANTS int i = 0; #endif while ((wk = LIST_FIRST(&jseg->js_entries)) != NULL) { WORKLIST_REMOVE(wk); - waiting = wk->wk_state & IOWAITING; - wk->wk_state &= ~(INPROGRESS | IOWAITING); + wk->wk_state &= ~INPROGRESS; wk->wk_state |= COMPLETE; KASSERT(i++ < jseg->js_cnt, ("handle_written_jseg: overflow %d >= %d", @@ -3645,8 +3643,6 @@ complete_jseg(jseg) TYPENAME(wk->wk_type)); /* NOTREACHED */ } - if (waiting) - wakeup(wk); } /* Release the self reference so the structure may be freed. */ rele_jseg(jseg); From owner-svn-src-head@freebsd.org Tue Sep 26 23:42:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 118C7E25CB1; Tue, 26 Sep 2017 23:42:46 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2844804D2; Tue, 26 Sep 2017 23:42:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QNgjS6017701; Tue, 26 Sep 2017 23:42:45 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QNgi60017697; Tue, 26 Sep 2017 23:42:44 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709262342.v8QNgi60017697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 26 Sep 2017 23:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324040 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 324040 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Sep 2017 23:42:46 -0000 Author: rmacklem Date: Tue Sep 26 23:42:44 2017 New Revision: 324040 URL: https://svnweb.freebsd.org/changeset/base/324040 Log: Add major and minor version arguments to nfscl_reqstart(). This patch adds "vers" and "minorvers" arguments to nfscl_reqstart(). The patch always passes them in as "0" and that implies no change in semantics. These arguments will be used by a future commit that adds support for the Flexible File Layout. Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfscl.h head/sys/fs/nfsclient/nfs_clcomsubs.c head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Tue Sep 26 23:24:15 2017 (r324039) +++ head/sys/fs/nfs/nfs_var.h Tue Sep 26 23:42:44 2017 (r324040) @@ -303,7 +303,7 @@ struct ucred *nfsrv_getgrpscred(struct ucred *); void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int); struct mbuf *nfsm_uiombuflist(struct uio *, int, struct mbuf **, char **); void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *, - u_int8_t *, int, u_int32_t **, struct nfsclsession *); + u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int); nfsuint64 *nfscl_getcookie(struct nfsnode *, off_t off, int); void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *, vnode_t, int, u_int32_t); Modified: head/sys/fs/nfs/nfscl.h ============================================================================== --- head/sys/fs/nfs/nfscl.h Tue Sep 26 23:24:15 2017 (r324039) +++ head/sys/fs/nfs/nfscl.h Tue Sep 26 23:42:44 2017 (r324040) @@ -49,7 +49,8 @@ struct nfsv4node { */ #define NFSCL_REQSTART(n, p, v) \ nfscl_reqstart((n), (p), VFSTONFS((v)->v_mount), \ - VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL, NULL) + VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL, \ + NULL, 0, 0) /* * These two macros convert between a lease duration and renew interval. Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Tue Sep 26 23:24:15 2017 (r324039) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Tue Sep 26 23:42:44 2017 (r324040) @@ -131,7 +131,8 @@ static int nfs_bigrequest[NFSV41_NPROCS] = { */ APPLESTATIC void nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp, - u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep) + u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep, + int vers, int minorvers) { struct mbuf *mb; u_int32_t *tl; @@ -142,14 +143,22 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, * First, fill in some of the fields of nd. */ nd->nd_slotseq = NULL; - if (NFSHASNFSV4(nmp)) { + if (vers == NFS_VER4) { nd->nd_flag = ND_NFSV4 | ND_NFSCL; - if (NFSHASNFSV4N(nmp)) + if (minorvers == NFSV41_MINORVERSION) nd->nd_flag |= ND_NFSV41; - } else if (NFSHASNFSV3(nmp)) + } else if (vers == NFS_VER3) nd->nd_flag = ND_NFSV3 | ND_NFSCL; - else - nd->nd_flag = ND_NFSV2 | ND_NFSCL; + else { + if (NFSHASNFSV4(nmp)) { + nd->nd_flag = ND_NFSV4 | ND_NFSCL; + if (NFSHASNFSV4N(nmp)) + nd->nd_flag |= ND_NFSV41; + } else if (NFSHASNFSV3(nmp)) + nd->nd_flag = ND_NFSV3 | ND_NFSCL; + else + nd->nd_flag = ND_NFSV2 | ND_NFSCL; + } nd->nd_procnum = procnum; nd->nd_repstat = 0; Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Tue Sep 26 23:24:15 2017 (r324039) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Tue Sep 26 23:42:44 2017 (r324040) @@ -429,7 +429,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int dp = *dpp; *dpp = NULL; - nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); @@ -785,7 +785,7 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsm int error; nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, - op->nfso_fhlen, NULL, NULL); + op->nfso_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); if (NFSHASNFSV4N(nmp)) @@ -827,7 +827,8 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t *nfhp, int fhl nmp = VFSTONFS(vnode_mount(vp)); if (NFSHASNFSV4N(nmp)) return (0); /* No confirmation for NFSv4.1. */ - nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL, + 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = op->nfso_stateid.seqid; *tl++ = op->nfso_stateid.other[0]; @@ -941,7 +942,7 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli tsep = NFSMNT_MDSSESSION(nmp); NFSUNLOCKMNT(nmp); - nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(nfsboottime.tv_sec); *tl = txdr_unsigned(clp->nfsc_rev); @@ -1011,7 +1012,7 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli * and confirm it. */ nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, - NULL); + NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); *tl++ = tsep->nfsess_clientid.lval[0]; *tl++ = tsep->nfsess_clientid.lval[1]; @@ -1026,7 +1027,7 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli nd->nd_mrep = NULL; if (nd->nd_repstat == 0) { nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, nmp->nm_fh, - nmp->nm_fhsize, NULL, NULL); + nmp->nm_fhsize, NULL, NULL, 0, 0); NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_LEASETIME); (void) nfsrv_putattrbit(nd, &attrbits); @@ -1093,7 +1094,7 @@ nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp int error, vers = NFS_VER2; nfsattrbit_t attrbits; - nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL, 0, 0); if (nd->nd_flag & ND_NFSV4) { vers = NFS_VER4; NFSGETATTR_ATTRBIT(&attrbits); @@ -4009,7 +4010,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, struct nfsmoun int error; nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh, - lp->nfsl_open->nfso_fhlen, NULL, NULL); + lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(type); *tl = txdr_unsigned(lp->nfsl_seqid); @@ -4061,7 +4062,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, struct nfsmount uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; struct nfsclsession *tsep; - nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); if (type == F_RDLCK) *tl++ = txdr_unsigned(NFSV4LOCKT_READ); @@ -4334,10 +4335,11 @@ nfsrpc_renew(struct nfsclclient *clp, struct nfsclds * if (nmp == NULL) return (0); if (dsp == NULL) - nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL, 0, + 0); else nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess); + &dsp->nfsclds_sess, 0, 0); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -4381,11 +4383,11 @@ nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllo if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL, - NULL); + NULL, 0, 0); nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID); } else { nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, - NULL); + NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); tsep = nfsmnt_mdssession(nmp); *tl++ = tsep->nfsess_clientid.lval[0]; @@ -4418,7 +4420,8 @@ nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpat int error, cnt, len, setnil; u_int32_t *opcntp; - nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL); + nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0, + 0); cp = dirpath; cnt = 0; do { @@ -4485,7 +4488,7 @@ nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred int error; nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh, - dp->nfsdl_fhlen, NULL, NULL); + dp->nfsdl_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID); if (NFSHASNFSV4N(nmp)) *tl++ = 0; @@ -4595,7 +4598,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclcl int error, len; *dspp = NULL; - nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL, 0, 0); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(nfsboottime.tv_sec); /* Client owner */ *tl = txdr_unsigned(clp->nfsc_rev); @@ -4682,7 +4685,8 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc nmp->nm_rsize = NFS_MAXBSIZE; if (nmp->nm_wsize > NFS_MAXBSIZE || nmp->nm_wsize == 0) nmp->nm_wsize = NFS_MAXBSIZE; - nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); *tl++ = sep->nfsess_clientid.lval[0]; *tl++ = sep->nfsess_clientid.lval[1]; @@ -4796,7 +4800,8 @@ nfsrpc_destroysession(struct nfsmount *nmp, struct nfs int error; struct nfsclsession *tsep; - nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); tsep = nfsmnt_mdssession(nmp); bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); @@ -4823,7 +4828,8 @@ nfsrpc_destroyclient(struct nfsmount *nmp, struct nfsc int error; struct nfsclsession *tsep; - nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); tsep = nfsmnt_mdssession(nmp); *tl++ = tsep->nfsess_clientid.lval[0]; @@ -4850,7 +4856,8 @@ nfsrpc_layoutget(struct nfsmount *nmp, uint8_t *fhp, i struct nfsrv_descript nfsd, *nd = &nfsd; int error; - nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0, + 0); nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp, layoutlen, 0); nd->nd_flag |= ND_USEGSSNAME; @@ -4886,7 +4893,8 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de *ndip = NULL; ndi = NULL; - nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED); NFSBCOPY(deviceid, tl, NFSX_V4DEVICEID); tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); @@ -5039,7 +5047,8 @@ nfsrpc_layoutcommit(struct nfsmount *nmp, uint8_t *fh, struct nfsrv_descript nfsd, *nd = &nfsd; int error; - nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL, + 0, 0); NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER + NFSX_STATEID); txdr_hyper(off, tl); @@ -5088,7 +5097,8 @@ nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, struct nfsrv_descript nfsd, *nd = &nfsd; int error; - nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL, + 0, 0); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); if (reclaim != 0) *tl++ = newnfs_true; @@ -5390,7 +5400,8 @@ nfsrpc_reclaimcomplete(struct nfsmount *nmp, struct uc struct nfsrv_descript *nd = &nfsd; int error; - nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = newnfs_false; nd->nd_flag |= ND_USEGSSNAME; @@ -5697,7 +5708,7 @@ nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state nd->nd_mrep = NULL; nfscl_reqstart(nd, NFSPROC_READDS, nmp, fhp->nfh_fh, fhp->nfh_len, - NULL, &dsp->nfsclds_sess); + NULL, &dsp->nfsclds_sess, 0, 0); nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO); NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3); txdr_hyper(io_off, tl); @@ -5743,7 +5754,7 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo KASSERT(uiop->uio_iovcnt == 1, ("nfs: writerpc iovcnt > 1")); nd->nd_mrep = NULL; nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh, fhp->nfh_len, - NULL, &dsp->nfsclds_sess); + NULL, &dsp->nfsclds_sess, 0, 0); nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED); txdr_hyper(io_off, tl); @@ -5908,7 +5919,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, nd->nd_mrep = NULL; nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, - NULL, &dsp->nfsclds_sess); + NULL, &dsp->nfsclds_sess, 0, 0); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); txdr_hyper(offset, tl); tl += 2; @@ -6187,7 +6198,8 @@ nfsrpc_openlayoutrpc(struct nfsmount *nmp, vnode_t vp, *dpp = NULL; *laystatp = ENXIO; - nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL, + 0, 0); NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); From owner-svn-src-head@freebsd.org Wed Sep 27 00:57:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7550E274C6; Wed, 27 Sep 2017 00:57:06 +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 7E67F821F5; Wed, 27 Sep 2017 00:57:06 +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 v8R0v51E046293; Wed, 27 Sep 2017 00:57:05 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R0v5lY046291; Wed, 27 Sep 2017 00:57:05 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709270057.v8R0v5lY046291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 27 Sep 2017 00:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324041 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 324041 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 00:57:06 -0000 Author: mjg Date: Wed Sep 27 00:57:05 2017 New Revision: 324041 URL: https://svnweb.freebsd.org/changeset/base/324041 Log: mtx: drop the tid argument from _mtx_lock_sleep tid must be equal to curthread and the target routine was already reading it anyway, which is not a problem. Not passing it as a parameter allows for a little bit shorter code in callers. MFC after: 1 week Modified: head/sys/kern/kern_mutex.c head/sys/sys/mutex.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Tue Sep 26 23:42:44 2017 (r324040) +++ head/sys/kern/kern_mutex.c Wed Sep 27 00:57:05 2017 (r324041) @@ -248,7 +248,7 @@ __mtx_lock_flags(volatile uintptr_t *c, int opts, cons tid = (uintptr_t)curthread; v = MTX_UNOWNED; if (!_mtx_obtain_lock_fetch(m, &v, tid)) - _mtx_lock_sleep(m, v, tid, opts, file, line); + _mtx_lock_sleep(m, v, opts, file, line); else LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(adaptive__acquire, m, 0, 0, file, line); @@ -443,15 +443,17 @@ _mtx_trylock_flags_(volatile uintptr_t *c, int opts, c */ #if LOCK_DEBUG > 0 void -__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, int opts, - const char *file, int line) +__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, int opts, const char *file, + int line) #else void -__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid) +__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) #endif { + struct thread *td; struct mtx *m; struct turnstile *ts; + uintptr_t tid; #ifdef ADAPTIVE_MUTEXES volatile struct thread *owner; #endif @@ -473,8 +475,9 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, u #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) int doing_lockprof; #endif - - if (SCHEDULER_STOPPED()) + td = curthread; + tid = (uintptr_t)td; + if (SCHEDULER_STOPPED_TD(td)) return; #if defined(ADAPTIVE_MUTEXES) @@ -486,7 +489,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, u if (__predict_false(v == MTX_UNOWNED)) v = MTX_READ_VALUE(m); - if (__predict_false(lv_mtx_owner(v) == (struct thread *)tid)) { + if (__predict_false(lv_mtx_owner(v) == td)) { KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0 || (opts & MTX_RECURSE) != 0, ("_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n", Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Tue Sep 26 23:42:44 2017 (r324040) +++ head/sys/sys/mutex.h Wed Sep 27 00:57:05 2017 (r324041) @@ -99,12 +99,12 @@ int _mtx_trylock_flags_(volatile uintptr_t *c, int opt int line); void mutex_init(void); #if LOCK_DEBUG > 0 -void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, - int opts, const char *file, int line); +void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, int opts, + const char *file, int line); void __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file, int line); #else -void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid); +void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v); void __mtx_unlock_sleep(volatile uintptr_t *c); #endif @@ -147,13 +147,13 @@ void thread_lock_flags_(struct thread *, int, const ch #define mtx_trylock_flags_(m, o, f, l) \ _mtx_trylock_flags_(&(m)->mtx_lock, o, f, l) #if LOCK_DEBUG > 0 -#define _mtx_lock_sleep(m, v, t, o, f, l) \ - __mtx_lock_sleep(&(m)->mtx_lock, v, t, o, f, l) +#define _mtx_lock_sleep(m, v, o, f, l) \ + __mtx_lock_sleep(&(m)->mtx_lock, v, o, f, l) #define _mtx_unlock_sleep(m, o, f, l) \ __mtx_unlock_sleep(&(m)->mtx_lock, o, f, l) #else -#define _mtx_lock_sleep(m, v, t, o, f, l) \ - __mtx_lock_sleep(&(m)->mtx_lock, v, t) +#define _mtx_lock_sleep(m, v, o, f, l) \ + __mtx_lock_sleep(&(m)->mtx_lock, v) #define _mtx_unlock_sleep(m, o, f, l) \ __mtx_unlock_sleep(&(m)->mtx_lock) #endif @@ -208,7 +208,7 @@ void thread_lock_flags_(struct thread *, int, const ch \ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__acquire) ||\ !_mtx_obtain_lock_fetch((mp), &_v, _tid))) \ - _mtx_lock_sleep((mp), _v, _tid, (opts), (file), (line));\ + _mtx_lock_sleep((mp), _v, (opts), (file), (line)); \ } while (0) /* From owner-svn-src-head@freebsd.org Wed Sep 27 01:03:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61BE7E27771; Wed, 27 Sep 2017 01:03:02 +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 288FB826B9; Wed, 27 Sep 2017 01:03:02 +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 v8R1317j050445; Wed, 27 Sep 2017 01:03:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R130UY050440; Wed, 27 Sep 2017 01:03:00 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709270103.v8R130UY050440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 27 Sep 2017 01:03:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324042 - in head: . share/man/man5 targets/pseudo/userland usr.sbin usr.sbin/procctl X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head: . share/man/man5 targets/pseudo/userland usr.sbin usr.sbin/procctl X-SVN-Commit-Revision: 324042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 01:03:02 -0000 Author: mjg Date: Wed Sep 27 01:03:00 2017 New Revision: 324042 URL: https://svnweb.freebsd.org/changeset/base/324042 Log: Whack procctl(8) It was supposed to provide a recovery mechanism against bugs in procfs's long deprecated tracing capabilities. Remove the tool as a prerequisite to axing the kernel side. The tracing facility to use is ptrace(2). MFC after: 2 weeks Deleted: head/usr.sbin/procctl/ Modified: head/ObsoleteFiles.inc head/share/man/man5/procfs.5 head/targets/pseudo/userland/Makefile.depend head/usr.sbin/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Sep 27 00:57:05 2017 (r324041) +++ head/ObsoleteFiles.inc Wed Sep 27 01:03:00 2017 (r324042) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20170927: procctl +OLD_FILES+=usr/share/man/man8/procctl.8.gz +OLD_FILES+=usr/sbin/procctl # 20170926: remove unneeded man aliases and locales directory OLD_FILES+=usr/share/man/en.ISO8859-1/man1 OLD_FILES+=usr/share/man/en.ISO8859-1/man2 Modified: head/share/man/man5/procfs.5 ============================================================================== --- head/share/man/man5/procfs.5 Wed Sep 27 00:57:05 2017 (r324041) +++ head/share/man/man5/procfs.5 Wed Sep 27 01:03:00 2017 (r324042) @@ -196,7 +196,6 @@ file system on .Xr mount 2 , .Xr sigaction 2 , .Xr unmount 2 , -.Xr procctl 8 , .Xr pseudofs 9 .Sh AUTHORS .An -nosplit Modified: head/targets/pseudo/userland/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/Makefile.depend Wed Sep 27 00:57:05 2017 (r324041) +++ head/targets/pseudo/userland/Makefile.depend Wed Sep 27 01:03:00 2017 (r324042) @@ -708,7 +708,6 @@ DIRDEPS+= \ usr.sbin/pppctl \ usr.sbin/praliases \ usr.sbin/praudit \ - usr.sbin/procctl \ usr.sbin/prometheus_sysctl_exporter \ usr.sbin/pstat \ usr.sbin/pw \ Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Wed Sep 27 00:57:05 2017 (r324041) +++ head/usr.sbin/Makefile Wed Sep 27 01:03:00 2017 (r324042) @@ -61,7 +61,6 @@ SUBDIR= adduser \ pciconf \ periodic \ powerd \ - procctl \ prometheus_sysctl_exporter \ pstat \ pw \ From owner-svn-src-head@freebsd.org Wed Sep 27 01:12:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA7BDE27951; Wed, 27 Sep 2017 01:12:48 +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 A21BE82AAB; Wed, 27 Sep 2017 01:12:48 +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 v8R1ClKt054390; Wed, 27 Sep 2017 01:12:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R1Cl1j054387; Wed, 27 Sep 2017 01:12:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709270112.v8R1Cl1j054387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 27 Sep 2017 01:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324043 - in head: . share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head: . share/man/man9 X-SVN-Commit-Revision: 324043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 01:12:49 -0000 Author: mjg Date: Wed Sep 27 01:12:47 2017 New Revision: 324043 URL: https://svnweb.freebsd.org/changeset/base/324043 Log: Remove manpage entries about crshared(9) The function itself was removed years ago in r272546 Submitted by: Paulm MFC after: 2 weeks Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/ucred.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Sep 27 01:03:00 2017 (r324042) +++ head/ObsoleteFiles.inc Wed Sep 27 01:12:47 2017 (r324043) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20170927: crshared +OLD_FILES+=usr/share/man/man9/crshared.9.gz # 20170927: procctl OLD_FILES+=usr/share/man/man8/procctl.8.gz OLD_FILES+=usr/sbin/procctl Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Sep 27 01:03:00 2017 (r324042) +++ head/share/man/man9/Makefile Wed Sep 27 01:12:47 2017 (r324043) @@ -1929,7 +1929,6 @@ MLINKS+=ucred.9 cred_update_thread.9 \ ucred.9 crget.9 \ ucred.9 crhold.9 \ ucred.9 crsetgroups.9 \ - ucred.9 crshared.9 \ ucred.9 cru2x.9 MLINKS+=uidinfo.9 uifind.9 \ uidinfo.9 uifree.9 \ Modified: head/share/man/man9/ucred.9 ============================================================================== --- head/share/man/man9/ucred.9 Wed Sep 27 01:03:00 2017 (r324042) +++ head/share/man/man9/ucred.9 Wed Sep 27 01:12:47 2017 (r324043) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2009 +.Dd September 27, 2017 .Dt UCRED 9 .Os .Sh NAME @@ -34,7 +34,6 @@ .Nm crget , .Nm crhold , .Nm crfree , -.Nm crshared , .Nm crcopy , .Nm crdup , .Nm cru2x , @@ -49,8 +48,6 @@ .Fn crhold "struct ucred *cr" .Ft void .Fn crfree "struct ucred *cr" -.Ft int -.Fn crshared "struct ucred *cr" .Ft void .Fn crcopy "struct ucred *dest" "struct ucred *src" .Ft "struct ucred *" @@ -86,12 +83,6 @@ function decreases the reference count on the credenti If the count drops to 0, the storage for the structure is freed. .Pp The -.Fn crshared -function returns true if the credential is shared. -A credential is considered to be shared if its reference -count is greater than one. -.Pp -The .Fn crcopy function copies the contents of the source (template) credential into the destination template. @@ -170,10 +161,6 @@ and all return a pointer to a .Vt ucred structure. -.Pp -.Fn crshared -returns 0 if the credential has a reference count greater than 1; -otherwise, 1 is returned. .Sh USAGE NOTES As of .Fx 5.0 , From owner-svn-src-head@freebsd.org Wed Sep 27 01:27:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91DD3E27CB9; Wed, 27 Sep 2017 01:27:44 +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 4FAEC82F7D; Wed, 27 Sep 2017 01:27:44 +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 v8R1Rh92058665; Wed, 27 Sep 2017 01:27:43 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R1Rh2P058664; Wed, 27 Sep 2017 01:27:43 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709270127.v8R1Rh2P058664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 27 Sep 2017 01:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324044 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 01:27:44 -0000 Author: mjg Date: Wed Sep 27 01:27:43 2017 New Revision: 324044 URL: https://svnweb.freebsd.org/changeset/base/324044 Log: Annotate sysctlmemlock with __exclusive_cache_line. MFC after: 1 week Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Sep 27 01:12:47 2017 (r324043) +++ head/sys/kern/kern_sysctl.c Wed Sep 27 01:27:43 2017 (r324044) @@ -88,7 +88,7 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysctltmp", "sysctl * sysctl requests larger than a single page via an exclusive lock. */ static struct rmlock sysctllock; -static struct sx sysctlmemlock; +static struct sx __exclusive_cache_line sysctlmemlock; #define SYSCTL_WLOCK() rm_wlock(&sysctllock) #define SYSCTL_WUNLOCK() rm_wunlock(&sysctllock) From owner-svn-src-head@freebsd.org Wed Sep 27 01:31:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DCC9E27F10; Wed, 27 Sep 2017 01:31:53 +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 355CD83343; Wed, 27 Sep 2017 01:31:53 +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 v8R1Vq7l059546; Wed, 27 Sep 2017 01:31:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R1Vq8E059545; Wed, 27 Sep 2017 01:31:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709270131.v8R1Vq8E059545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 27 Sep 2017 01:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324045 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 01:31:53 -0000 Author: mjg Date: Wed Sep 27 01:31:52 2017 New Revision: 324045 URL: https://svnweb.freebsd.org/changeset/base/324045 Log: sysctl: remove target buffer read/write checks prior to calling the handler Said checks were inherently racy anyway as jokers could unmap target areas before the handler got around to accessing them. This saves time by avoiding locking the address space. MFC after: 1 week Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Sep 27 01:27:43 2017 (r324044) +++ head/sys/kern/kern_sysctl.c Wed Sep 27 01:31:52 2017 (r324045) @@ -2061,16 +2061,9 @@ userland_sysctl(struct thread *td, int *name, u_int na } } req.validlen = req.oldlen; + req.oldptr = old; - if (old) { - if (!useracc(old, req.oldlen, VM_PROT_WRITE)) - return (EFAULT); - req.oldptr= old; - } - if (new != NULL) { - if (!useracc(new, newlen, VM_PROT_READ)) - return (EFAULT); req.newlen = newlen; req.newptr = new; } From owner-svn-src-head@freebsd.org Wed Sep 27 04:42:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 589D9E2AAA6; Wed, 27 Sep 2017 04:42:42 +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 32CF835FB; Wed, 27 Sep 2017 04:42:42 +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 v8R4gfgW042196; Wed, 27 Sep 2017 04:42:41 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R4gfi3042194; Wed, 27 Sep 2017 04:42:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709270442.v8R4gfi3042194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 27 Sep 2017 04:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324048 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 324048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 04:42:42 -0000 Author: sephe Date: Wed Sep 27 04:42:40 2017 New Revision: 324048 URL: https://svnweb.freebsd.org/changeset/base/324048 Log: hyperv/hn: Set tcp header offset for CSUM/LSO offloading. No observable effect; better safe than sorry. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12417 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 01:47:54 2017 (r324047) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 04:42:40 2017 (r324048) @@ -727,6 +727,7 @@ hn_tso_fixup(struct mbuf *m_head) ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; else ehlen = ETHER_HDR_LEN; + m_head->m_pkthdr.l2hlen = ehlen; #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { @@ -736,6 +737,7 @@ hn_tso_fixup(struct mbuf *m_head) PULLUP_HDR(m_head, ehlen + sizeof(*ip)); ip = mtodo(m_head, ehlen); iphlen = ip->ip_hl << 2; + m_head->m_pkthdr.l3hlen = iphlen; PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); th = mtodo(m_head, ehlen + iphlen); @@ -759,6 +761,7 @@ hn_tso_fixup(struct mbuf *m_head) m_freem(m_head); return (NULL); } + m_head->m_pkthdr.l3hlen = sizeof(*ip6); PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); th = mtodo(m_head, ehlen + sizeof(*ip6)); @@ -768,41 +771,34 @@ hn_tso_fixup(struct mbuf *m_head) } #endif return (m_head); - } /* * NOTE: If this function failed, the m_head would be freed. */ static __inline struct mbuf * -hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +hn_set_hlen(struct mbuf *m_head) { const struct ether_vlan_header *evl; - const struct tcphdr *th; int ehlen; - *tcpsyn = 0; - PULLUP_HDR(m_head, sizeof(*evl)); evl = mtod(m_head, const struct ether_vlan_header *); if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; else ehlen = ETHER_HDR_LEN; + m_head->m_pkthdr.l2hlen = ehlen; #ifdef INET - if (m_head->m_pkthdr.csum_flags & CSUM_IP_TCP) { + if (m_head->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP_UDP)) { const struct ip *ip; int iphlen; PULLUP_HDR(m_head, ehlen + sizeof(*ip)); ip = mtodo(m_head, ehlen); iphlen = ip->ip_hl << 2; - - PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); - th = mtodo(m_head, ehlen + iphlen); - if (th->th_flags & TH_SYN) - *tcpsyn = 1; + m_head->m_pkthdr.l3hlen = iphlen; } #endif #if defined(INET6) && defined(INET) @@ -814,18 +810,36 @@ hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); ip6 = mtodo(m_head, ehlen); - if (ip6->ip6_nxt != IPPROTO_TCP) - return (m_head); - - PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); - th = mtodo(m_head, ehlen + sizeof(*ip6)); - if (th->th_flags & TH_SYN) - *tcpsyn = 1; + if (ip6->ip6_nxt != IPPROTO_TCP) { + m_freem(m_head); + return (NULL); + } + m_head->m_pkthdr.l3hlen = sizeof(*ip6); } #endif return (m_head); } +/* + * NOTE: If this function failed, the m_head would be freed. + */ +static __inline struct mbuf * +hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +{ + const struct tcphdr *th; + int ehlen, iphlen; + + *tcpsyn = 0; + ehlen = m_head->m_pkthdr.l2hlen; + iphlen = m_head->m_pkthdr.l3hlen; + + PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); + th = mtodo(m_head, ehlen + iphlen); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + return (m_head); +} + #undef PULLUP_HDR #endif /* INET6 || INET */ @@ -3010,7 +3024,8 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, st NDIS_LSO2_INFO_SIZE, NDIS_PKTINFO_TYPE_LSO); #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { - *pi_data = NDIS_LSO2_INFO_MAKEIPV4(0, + *pi_data = NDIS_LSO2_INFO_MAKEIPV4( + m_head->m_pkthdr.l2hlen + m_head->m_pkthdr.l3hlen, m_head->m_pkthdr.tso_segsz); } #endif @@ -3019,7 +3034,8 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, st #endif #ifdef INET6 { - *pi_data = NDIS_LSO2_INFO_MAKEIPV6(0, + *pi_data = NDIS_LSO2_INFO_MAKEIPV6( + m_head->m_pkthdr.l2hlen + m_head->m_pkthdr.l3hlen, m_head->m_pkthdr.tso_segsz); } #endif @@ -3036,11 +3052,15 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, st *pi_data |= NDIS_TXCSUM_INFO_IPCS; } - if (m_head->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) - *pi_data |= NDIS_TXCSUM_INFO_TCPCS; - else if (m_head->m_pkthdr.csum_flags & - (CSUM_IP_UDP | CSUM_IP6_UDP)) - *pi_data |= NDIS_TXCSUM_INFO_UDPCS; + if (m_head->m_pkthdr.csum_flags & + (CSUM_IP_TCP | CSUM_IP6_TCP)) { + *pi_data |= NDIS_TXCSUM_INFO_MKTCPCS( + m_head->m_pkthdr.l2hlen + m_head->m_pkthdr.l3hlen); + } else if (m_head->m_pkthdr.csum_flags & + (CSUM_IP_UDP | CSUM_IP6_UDP)) { + *pi_data |= NDIS_TXCSUM_INFO_MKUDPCS( + m_head->m_pkthdr.l2hlen + m_head->m_pkthdr.l3hlen); + } } pkt_hlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; @@ -5566,6 +5586,13 @@ hn_start_locked(struct hn_tx_ring *txr, int len) if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } + } else if (m_head->m_pkthdr.csum_flags & + (CSUM_IP_UDP | CSUM_IP_TCP | CSUM_IP6_UDP | CSUM_IP6_TCP)) { + m_head = hn_set_hlen(m_head); + if (__predict_false(m_head == NULL)) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + continue; + } } #endif @@ -5846,11 +5873,18 @@ hn_transmit(struct ifnet *ifp, struct mbuf *m) #if defined(INET6) || defined(INET) /* - * Perform TSO packet header fixup now, since the TSO - * packet header should be cache-hot. + * Perform TSO packet header fixup or get l2/l3 header length now, + * since packet headers should be cache-hot. */ if (m->m_pkthdr.csum_flags & CSUM_TSO) { m = hn_tso_fixup(m); + if (__predict_false(m == NULL)) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + return EIO; + } + } else if (m->m_pkthdr.csum_flags & + (CSUM_IP_UDP | CSUM_IP_TCP | CSUM_IP6_UDP | CSUM_IP6_TCP)) { + m = hn_set_hlen(m); if (__predict_false(m == NULL)) { if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return EIO; Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Wed Sep 27 01:47:54 2017 (r324047) +++ head/sys/dev/hyperv/netvsc/ndis.h Wed Sep 27 04:42:40 2017 (r324048) @@ -402,4 +402,13 @@ struct ndis_offload { #define NDIS_TXCSUM_INFO_IPCS 0x00000010 #define NDIS_TXCSUM_INFO_THOFF 0x03ff0000 +#define NDIS_TXCSUM_INFO_MKL4CS(thoff, flag) \ + ((((uint32_t)(thoff)) << 16) | (flag)) + +#define NDIS_TXCSUM_INFO_MKTCPCS(thoff) \ + NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_TCPCS) + +#define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \ + NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS) + #endif /* !_NET_NDIS_H_ */ From owner-svn-src-head@freebsd.org Wed Sep 27 05:44:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 639B2E2B81C; Wed, 27 Sep 2017 05:44:51 +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 405C0640D7; Wed, 27 Sep 2017 05:44:51 +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 v8R5iox9067312; Wed, 27 Sep 2017 05:44:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R5io50067311; Wed, 27 Sep 2017 05:44:50 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709270544.v8R5io50067311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 27 Sep 2017 05:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324049 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 324049 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 05:44:51 -0000 Author: sephe Date: Wed Sep 27 05:44:50 2017 New Revision: 324049 URL: https://svnweb.freebsd.org/changeset/base/324049 Log: hyperv/hn: Fix UDP checksum offload issue in Azure. UDP checksum offload does not work in Azure if following conditions are met: - sizeof(IP hdr + UDP hdr + payload) > 1420. - IP_DF is not set in IP hdr Use software checksum for UDP datagrams falling into this category. Add two tunables to disable UDP/IPv4 and UDP/IPv6 checksum offload, in case something unexpected happened. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12429 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 04:42:40 2017 (r324048) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 05:44:50 2017 (r324049) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -460,6 +461,35 @@ SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostip, CTLFLAG_RDT "Trust ip packet verification on host side, " "when csum info is missing (global setting)"); +/* + * Offload UDP/IPv4 checksum. + */ +static int hn_enable_udp4cs = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, enable_udp4cs, CTLFLAG_RDTUN, + &hn_enable_udp4cs, 0, "Offload UDP/IPv4 checksum"); + +/* + * Offload UDP/IPv6 checksum. + */ +static int hn_enable_udp6cs = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, enable_udp6cs, CTLFLAG_RDTUN, + &hn_enable_udp6cs, 0, "Offload UDP/IPv6 checksum"); + +/* Stats. */ +static counter_u64_t hn_udpcs_fixup; +SYSCTL_COUNTER_U64(_hw_hn, OID_AUTO, udpcs_fixup, CTLFLAG_RW, + &hn_udpcs_fixup, "# of UDP checksum fixup"); + +/* + * See hn_set_hlen(). + * + * This value is for Azure. For Hyper-V, set this above + * 65536 to disable UDP datagram checksum fixup. + */ +static int hn_udpcs_fixup_mtu = 1420; +SYSCTL_INT(_hw_hn, OID_AUTO, udpcs_fixup_mtu, CTLFLAG_RWTUN, + &hn_udpcs_fixup_mtu, 0, "UDP checksum fixup MTU threshold"); + /* Limit TSO burst size */ static int hn_tso_maxlen = IP_MAXPACKET; SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, @@ -799,6 +829,27 @@ hn_set_hlen(struct mbuf *m_head) ip = mtodo(m_head, ehlen); iphlen = ip->ip_hl << 2; m_head->m_pkthdr.l3hlen = iphlen; + + /* + * UDP checksum offload does not work in Azure, if the + * following conditions meet: + * - sizeof(IP hdr + UDP hdr + payload) > 1420. + * - IP_DF is not set in the IP hdr. + * + * Fallback to software checksum for these UDP datagrams. + */ + if ((m_head->m_pkthdr.csum_flags & CSUM_IP_UDP) && + m_head->m_pkthdr.len > hn_udpcs_fixup_mtu + ehlen && + (ntohs(ip->ip_off) & IP_DF) == 0) { + uint16_t off = ehlen + iphlen; + + counter_u64_add(hn_udpcs_fixup, 1); + PULLUP_HDR(m_head, off + sizeof(struct udphdr)); + *(uint16_t *)(m_head->m_data + off + + m_head->m_pkthdr.csum_data) = in_cksum_skip( + m_head, m_head->m_pkthdr.len, off); + m_head->m_pkthdr.csum_flags &= ~CSUM_IP_UDP; + } } #endif #if defined(INET6) && defined(INET) @@ -5479,11 +5530,11 @@ hn_fixup_tx_data(struct hn_softc *sc) csum_assist |= CSUM_IP; if (sc->hn_caps & HN_CAP_TCP4CS) csum_assist |= CSUM_IP_TCP; - if (sc->hn_caps & HN_CAP_UDP4CS) + if ((sc->hn_caps & HN_CAP_UDP4CS) && hn_enable_udp4cs) csum_assist |= CSUM_IP_UDP; if (sc->hn_caps & HN_CAP_TCP6CS) csum_assist |= CSUM_IP6_TCP; - if (sc->hn_caps & HN_CAP_UDP6CS) + if ((sc->hn_caps & HN_CAP_UDP6CS) && hn_enable_udp6cs) csum_assist |= CSUM_IP6_UDP; for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_csum_assist = csum_assist; @@ -7336,6 +7387,8 @@ hn_sysinit(void *arg __unused) { int i; + hn_udpcs_fixup = counter_u64_alloc(M_WAITOK); + #ifdef HN_IFSTART_SUPPORT /* * Don't use ifnet.if_start if transparent VF mode is requested; @@ -7415,5 +7468,7 @@ hn_sysuninit(void *arg __unused) if (hn_vfmap != NULL) free(hn_vfmap, M_DEVBUF); rm_destroy(&hn_vfmap_lock); + + counter_u64_free(hn_udpcs_fixup); } SYSUNINIT(hn_sysuninit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysuninit, NULL); From owner-svn-src-head@freebsd.org Wed Sep 27 05:52:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4C3FE2BA83; Wed, 27 Sep 2017 05:52:38 +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 B26566459C; Wed, 27 Sep 2017 05:52:38 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8R5qbMk071174; Wed, 27 Sep 2017 05:52:37 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R5qbLU071173; Wed, 27 Sep 2017 05:52:37 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709270552.v8R5qbLU071173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 27 Sep 2017 05:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324050 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 324050 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 05:52:39 -0000 Author: sephe Date: Wed Sep 27 05:52:37 2017 New Revision: 324050 URL: https://svnweb.freebsd.org/changeset/base/324050 Log: tcp: Don't "negotiate" MSS. _NO_ OSes actually "negotiate" MSS. RFC 879: "... This Maximum Segment Size (MSS) announcement (often mistakenly called a negotiation) ..." This negotiation behaviour was introduced 11 years ago by r159955 without any explaination about why FreeBSD had to "negotiate" MSS: In syncache_respond() do not reply with a MSS that is larger than what the peer announced to us but make it at least tcp_minmss in size. Sponsored by: TCP/IP Optimization Fundraise 2005 The tcp_minmss behaviour is still kept. Syncookie fix was prodded by tuexen, who also helped to test this patch w/ packetdrill. Reviewed by: tuexen, karels, bz (previous version) MFC after: 2 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12430 Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Wed Sep 27 05:44:50 2017 (r324049) +++ head/sys/netinet/tcp_syncache.c Wed Sep 27 05:52:37 2017 (r324050) @@ -1634,9 +1634,7 @@ syncache_respond(struct syncache *sc, struct syncache_ tlen = hlen + sizeof(struct tcphdr); /* Determine MSS we advertize to other end of connection. */ - mssopt = tcp_mssopt(&sc->sc_inc); - if (sc->sc_peer_mss) - mssopt = max( min(sc->sc_peer_mss, mssopt), V_tcp_minmss); + mssopt = max(tcp_mssopt(&sc->sc_inc), V_tcp_minmss); /* XXX: Assume that the entire packet will fit in a header mbuf. */ KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN, @@ -1985,7 +1983,7 @@ syncookie_mac(struct in_conninfo *inc, tcp_seq irs, ui static tcp_seq syncookie_generate(struct syncache_head *sch, struct syncache *sc) { - u_int i, mss, secbit, wscale; + u_int i, secbit, wscale; uint32_t iss, hash; uint8_t *secbits; union syncookie cookie; @@ -1995,8 +1993,8 @@ syncookie_generate(struct syncache_head *sch, struct s cookie.cookie = 0; /* Map our computed MSS into the 3-bit index. */ - mss = min(tcp_mssopt(&sc->sc_inc), max(sc->sc_peer_mss, V_tcp_minmss)); - for (i = nitems(tcp_sc_msstab) - 1; tcp_sc_msstab[i] > mss && i > 0; + for (i = nitems(tcp_sc_msstab) - 1; + tcp_sc_msstab[i] > sc->sc_peer_mss && i > 0; i--) ; cookie.flags.mss_idx = i; From owner-svn-src-head@freebsd.org Wed Sep 27 05:59:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7A65E2BBDD; Wed, 27 Sep 2017 05:59:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A94DC6492B; Wed, 27 Sep 2017 05:59:55 +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 v8R5xsuS071712; Wed, 27 Sep 2017 05:59:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R5xs2N071711; Wed, 27 Sep 2017 05:59:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709270559.v8R5xs2N071711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 27 Sep 2017 05:59:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324051 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 324051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 05:59:56 -0000 Author: sephe Date: Wed Sep 27 05:59:54 2017 New Revision: 324051 URL: https://svnweb.freebsd.org/changeset/base/324051 Log: ixl: Fix mbuf hash type settings. IPV6_EXs in RSS never mean fragment. They mean: "- Home address from the home address option in the IPv6 destination options header. If the extension header is not present, use the Source IPv6 Address. - IPv6 address that is contained in the Routing-Header-Type-2 from the associated extension header. If the extension header is not present, use the Destination IPv6 Address." UDP_IPV4_EX is an invalid RSS hash type, which will be removed. Quoted from: https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex Reviewed by: erj Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12450 Modified: head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixl/ixl_txrx.c ============================================================================== --- head/sys/dev/ixl/ixl_txrx.c Wed Sep 27 05:52:37 2017 (r324050) +++ head/sys/dev/ixl/ixl_txrx.c Wed Sep 27 05:59:54 2017 (r324051) @@ -1446,10 +1446,8 @@ static inline int ixl_ptype_to_hash(u8 ptype) { struct i40e_rx_ptype_decoded decoded; - u8 ex = 0; decoded = decode_rx_desc_ptype(ptype); - ex = decoded.outer_frag; if (!decoded.known) return M_HASHTYPE_OPAQUE_HASH; @@ -1460,34 +1458,22 @@ ixl_ptype_to_hash(u8 ptype) /* Note: anything that gets to this point is IP */ if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6) { switch (decoded.inner_prot) { - case I40E_RX_PTYPE_INNER_PROT_TCP: - if (ex) - return M_HASHTYPE_RSS_TCP_IPV6_EX; - else - return M_HASHTYPE_RSS_TCP_IPV6; - case I40E_RX_PTYPE_INNER_PROT_UDP: - if (ex) - return M_HASHTYPE_RSS_UDP_IPV6_EX; - else - return M_HASHTYPE_RSS_UDP_IPV6; - default: - if (ex) - return M_HASHTYPE_RSS_IPV6_EX; - else - return M_HASHTYPE_RSS_IPV6; + case I40E_RX_PTYPE_INNER_PROT_TCP: + return M_HASHTYPE_RSS_TCP_IPV6; + case I40E_RX_PTYPE_INNER_PROT_UDP: + return M_HASHTYPE_RSS_UDP_IPV6; + default: + return M_HASHTYPE_RSS_IPV6; } } if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV4) { switch (decoded.inner_prot) { - case I40E_RX_PTYPE_INNER_PROT_TCP: - return M_HASHTYPE_RSS_TCP_IPV4; - case I40E_RX_PTYPE_INNER_PROT_UDP: - if (ex) - return M_HASHTYPE_RSS_UDP_IPV4_EX; - else - return M_HASHTYPE_RSS_UDP_IPV4; - default: - return M_HASHTYPE_RSS_IPV4; + case I40E_RX_PTYPE_INNER_PROT_TCP: + return M_HASHTYPE_RSS_TCP_IPV4; + case I40E_RX_PTYPE_INNER_PROT_UDP: + return M_HASHTYPE_RSS_UDP_IPV4; + default: + return M_HASHTYPE_RSS_IPV4; } } /* We should never get here!! */ From owner-svn-src-head@freebsd.org Wed Sep 27 06:31:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E085AE2C455; Wed, 27 Sep 2017 06:31:36 +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 9E9C1659F4; Wed, 27 Sep 2017 06:31: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 v8R6VZkS086805; Wed, 27 Sep 2017 06:31:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R6VZ9q086804; Wed, 27 Sep 2017 06:31:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709270631.v8R6VZ9q086804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 27 Sep 2017 06:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324052 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 324052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 06:31:37 -0000 Author: sephe Date: Wed Sep 27 06:31:35 2017 New Revision: 324052 URL: https://svnweb.freebsd.org/changeset/base/324052 Log: mbuf: Remove UDP_IPV4_EX, which was never defined. Add comment to explain the IPV6_EX suffix. The confusion about these RSS hash type probably stems from the facts that they were never widely implemented by hardwares. Reviewed by: rwatson Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D12453 Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Wed Sep 27 05:59:54 2017 (r324051) +++ head/sys/sys/mbuf.h Wed Sep 27 06:31:35 2017 (r324052) @@ -335,6 +335,16 @@ struct mbuf { * for ordering and distribution without explicit affinity. Additionally, * M_HASHTYPE_OPAQUE_HASH indicates that the flow identifier has hash * properties. + * + * The meaning of the IPV6_EX suffix: + * "o Home address from the home address option in the IPv6 destination + * options header. If the extension header is not present, use the Source + * IPv6 Address. + * o IPv6 address that is contained in the Routing-Header-Type-2 from the + * associated extension header. If the extension header is not present, + * use the Destination IPv6 Address." + * Quoted from: + * https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex */ #define M_HASHTYPE_HASHPROP 0x80 /* has hash properties */ #define M_HASHTYPE_HASH(t) (M_HASHTYPE_HASHPROP | (t)) @@ -348,10 +358,7 @@ struct mbuf { * ext hdrs */ #define M_HASHTYPE_RSS_TCP_IPV6_EX M_HASHTYPE_HASH(6) /* TCPv6 4-tuple + * ext hdrs */ -/* Non-standard RSS hash types */ #define M_HASHTYPE_RSS_UDP_IPV4 M_HASHTYPE_HASH(7) /* IPv4 UDP 4-tuple*/ -#define M_HASHTYPE_RSS_UDP_IPV4_EX M_HASHTYPE_HASH(8) /* IPv4 UDP 4-tuple + - * ext hdrs */ #define M_HASHTYPE_RSS_UDP_IPV6 M_HASHTYPE_HASH(9) /* IPv6 UDP 4-tuple*/ #define M_HASHTYPE_RSS_UDP_IPV6_EX M_HASHTYPE_HASH(10)/* IPv6 UDP 4-tuple + * ext hdrs */ From owner-svn-src-head@freebsd.org Wed Sep 27 06:33:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABEBFE2C6E8; Wed, 27 Sep 2017 06:33:56 +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 7623D65DD4; Wed, 27 Sep 2017 06:33:56 +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 v8R6Xtab088568; Wed, 27 Sep 2017 06:33:55 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R6Xt3F088567; Wed, 27 Sep 2017 06:33:55 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709270633.v8R6Xt3F088567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 27 Sep 2017 06:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324053 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 324053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 06:33:56 -0000 Author: sephe Date: Wed Sep 27 06:33:55 2017 New Revision: 324053 URL: https://svnweb.freebsd.org/changeset/base/324053 Log: kernel: Bump __FreeBSD_version for the removal of M_HASHTYPE_RSS_UDP_IPV4_EX Sponsored by: Microsoft Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Sep 27 06:31:35 2017 (r324052) +++ head/sys/sys/param.h Wed Sep 27 06:33:55 2017 (r324053) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200046 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200047 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Wed Sep 27 09:39:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A937EE2F9D6; Wed, 27 Sep 2017 09:39:17 +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 6A0526B523; Wed, 27 Sep 2017 09:39:17 +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 v8R9dGSx063229; Wed, 27 Sep 2017 09:39:16 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R9dGhR063228; Wed, 27 Sep 2017 09:39:16 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709270939.v8R9dGhR063228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 27 Sep 2017 09:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324054 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 09:39:17 -0000 Author: manu Date: Wed Sep 27 09:39:16 2017 New Revision: 324054 URL: https://svnweb.freebsd.org/changeset/base/324054 Log: vfs_export: Simplify vfs_export_lookup If the filesystem is not exported directly return NULL. If no address is given and filesystem is exported using some default one return it directly, if it doesn't have a default one directly return NULL. Reviewed by: kib, bapt MFC after: 1 week Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D12505 Modified: head/sys/kern/vfs_export.c Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Wed Sep 27 06:33:55 2017 (r324053) +++ head/sys/kern/vfs_export.c Wed Sep 27 09:39:16 2017 (r324054) @@ -448,44 +448,46 @@ static struct netcred * vfs_export_lookup(struct mount *mp, struct sockaddr *nam) { struct netexport *nep; - struct netcred *np; + struct netcred *np = NULL; struct radix_node_head *rnh; struct sockaddr *saddr; nep = mp->mnt_export; if (nep == NULL) return (NULL); - np = NULL; - if (mp->mnt_flag & MNT_EXPORTED) { - /* - * Lookup in the export list first. - */ - if (nam != NULL) { - saddr = nam; - rnh = NULL; - switch (saddr->sa_family) { - case AF_INET: - rnh = nep->ne4; - break; - case AF_INET6: - rnh = nep->ne6; - break; - } - if (rnh != NULL) { - RADIX_NODE_HEAD_RLOCK(rnh); - np = (struct netcred *) - (*rnh->rnh_matchaddr)(saddr, &rnh->rh); - RADIX_NODE_HEAD_RUNLOCK(rnh); - if (np && np->netc_rnodes->rn_flags & RNF_ROOT) - np = NULL; - } - } - /* - * If no address match, use the default if it exists. - */ - if (np == NULL && mp->mnt_flag & MNT_DEFEXPORTED) - np = &nep->ne_defexported; + if ((mp->mnt_flag & MNT_EXPORTED) == 0) + return (NULL); + + /* + * If no address is provided, use the default if it exists. + */ + if (nam == NULL) { + if ((mp->mnt_flag & MNT_DEFEXPORTED) != 0) + return (&nep->ne_defexported); + return (NULL); } + + /* + * Lookup in the export list + */ + saddr = nam; + rnh = NULL; + switch (saddr->sa_family) { + case AF_INET: + rnh = nep->ne4; + break; + case AF_INET6: + rnh = nep->ne6; + break; + } + if (rnh != NULL) { + RADIX_NODE_HEAD_RLOCK(rnh); + np = (struct netcred *) (*rnh->rnh_matchaddr)(saddr, &rnh->rh); + RADIX_NODE_HEAD_RUNLOCK(rnh); + if (np != NULL && (np->netc_rnodes->rn_flags & RNF_ROOT) != 0) + return (NULL); + } + return (np); } From owner-svn-src-head@freebsd.org Wed Sep 27 13:05:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26264E03492; Wed, 27 Sep 2017 13:05:25 +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 E7F7C71B74; Wed, 27 Sep 2017 13:05:24 +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 v8RD5O9E049628; Wed, 27 Sep 2017 13:05:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RD5NDm049626; Wed, 27 Sep 2017 13:05:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709271305.v8RD5NDm049626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 27 Sep 2017 13:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324056 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 324056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 13:05:25 -0000 Author: tuexen Date: Wed Sep 27 13:05:23 2017 New Revision: 324056 URL: https://svnweb.freebsd.org/changeset/base/324056 Log: Remove unused function. MFC after: 1 week Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_asconf.h Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Wed Sep 27 11:31:11 2017 (r324055) +++ head/sys/netinet/sctp_asconf.c Wed Sep 27 13:05:23 2017 (r324056) @@ -2305,39 +2305,6 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, return (0); } -void -sctp_set_primary_ip_address(struct sctp_ifa *ifa) -{ - struct sctp_inpcb *inp; - - /* go through all our PCB's */ - LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) { - struct sctp_tcb *stcb; - - /* process for all associations for this endpoint */ - LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { - /* queue an ASCONF:SET_PRIM_ADDR to be sent */ - if (!sctp_asconf_queue_add(stcb, ifa, - SCTP_SET_PRIM_ADDR)) { - /* set primary queuing succeeded */ - SCTPDBG(SCTP_DEBUG_ASCONF1, "set_primary_ip_address: queued on stcb=%p, ", - (void *)stcb); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &ifa->address.sa); - if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || - (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { -#ifdef SCTP_TIMER_BASED_ASCONF - sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, - stcb->sctp_ep, stcb, - stcb->asoc.primary_destination); -#else - sctp_send_asconf(stcb, NULL, SCTP_ADDR_NOT_LOCKED); -#endif - } - } - } /* for each stcb */ - } /* for each inp */ -} - int sctp_is_addr_pending(struct sctp_tcb *stcb, struct sctp_ifa *sctp_ifa) { Modified: head/sys/netinet/sctp_asconf.h ============================================================================== --- head/sys/netinet/sctp_asconf.h Wed Sep 27 11:31:11 2017 (r324055) +++ head/sys/netinet/sctp_asconf.h Wed Sep 27 13:05:23 2017 (r324056) @@ -73,9 +73,6 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *, struct sockaddr *); extern void - sctp_set_primary_ip_address(struct sctp_ifa *ifa); - -extern void sctp_check_address_list(struct sctp_tcb *, struct mbuf *, int, int, struct sockaddr *, uint16_t, uint16_t, uint16_t, uint16_t); From owner-svn-src-head@freebsd.org Wed Sep 27 13:44:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B44BE0484A for ; Wed, 27 Sep 2017 13:44:54 +0000 (UTC) (envelope-from oliver.pinter@balabit.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9A7473A70 for ; Wed, 27 Sep 2017 13:44:53 +0000 (UTC) (envelope-from oliver.pinter@balabit.com) Received: by mail-wm0-x22c.google.com with SMTP id m127so20474669wmm.1 for ; Wed, 27 Sep 2017 06:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=balabit-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Rfw9iSnDNJk2KqCAc4RzKexBzDcEue63uThnzOL4IcA=; b=gFy5qxtJfiqZa6A6Wq/NnEFJXhWZqqr9Q43UiWFfiGEUvDTuqO3X5yMWJPjRy6thlV +4C6rZ4Ah4BdGWmeJHnek67nbBgOJ1UTFR80P1nEi1iaJwcMfjOgkOznxOSyqAvxSFav Gb/EbfK7u5HIKtcYkc8XzYlPGOw0o7YEtXK687KqtQQEDDxT4SGJamwjhNXH/QY0+dw5 3KA79ghZzt8sz9bLMy9sqqqYFlemXQPj12CluXkLJx130knHVkpcq1YDudb7WXwKzEzs Ep9lD0OJ0qMz/BV2F/wLhUuJ8rGqJTnpmSBGlHg/aUBSOoWJlDtZD6RRfgMhTrsSWGD0 BC3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Rfw9iSnDNJk2KqCAc4RzKexBzDcEue63uThnzOL4IcA=; b=AJriZU1Dh0tm/YUh1SRvVysrifmY7W+jf8OszfmGoqqNfqmZ/fiVmgNv5lqEbPFqUs wtrOAv2lr2TNG8fcy3Irx1JNwm2Dfup+bR15aTVm60LUEhKF2KQJ84LLLcxrXTfRVWQj VZV/Q/3TiIvHgfh7Hl0DSBO7Px9fguVpCFSgk5BozSc3mgy0EMOt+I5yuGvpg/eV2uMk p9GyFhy1Bs4jo3t9Uz4SwdzNobqVJWQ4pfD1X/rACc+957z2JuuSKDuS7wPt7jr9wzG3 2qKvTgLJ6Kqw/g5Vk+6poh0wWcgzusRNw3SdrzpnlGOVbSvojnOwhXIolIH2Q/L84HTU jaGQ== X-Gm-Message-State: AHPjjUhJrjPR634HU1tJ6zh/ggYSOqyfBsx6uS/UD1dwRSWZttJiQcX8 SMopOAS5+8cgFU0m6HbBkFxvJV0DaJm63SKsORnN1w== X-Google-Smtp-Source: AOwi7QA18rIsolEFZuKWjHe+n69hQq6S4gnrcb65nnM6oeQ/0AxNxRCiLBuEt/nEzvrSna4elQdVF59SAHjFED1oEFU= X-Received: by 10.80.170.217 with SMTP id r25mr2008759edc.220.1506519891954; Wed, 27 Sep 2017 06:44:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.182.110 with HTTP; Wed, 27 Sep 2017 06:44:51 -0700 (PDT) In-Reply-To: <201709262323.v8QNNw34009531@repo.freebsd.org> References: <201709262323.v8QNNw34009531@repo.freebsd.org> From: =?UTF-8?B?UGludMOpciwgT2xpdsOpcg==?= Date: Wed, 27 Sep 2017 15:44:51 +0200 Message-ID: Subject: Re: svn commit: r324038 - in head/sys: dev/bnxt dev/drm dev/drm2/i915 dev/drm2/radeon dev/e1000 net To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 13:44:54 -0000 On Wed, Sep 27, 2017 at 1:23 AM, Conrad Meyer wrote: > Author: cem > Date: Tue Sep 26 23:23:58 2017 > New Revision: 324038 > URL: https://svnweb.freebsd.org/changeset/base/324038 > > Log: > Add PNP metadata to more drivers > > GPUs: radeonkms, i915kms > NICs: if_em, if_igb, if_bnxt > > This metadata isn't used yet, but it will be handy to have later to > implement automatic module loading. > > Reviewed by: imp, mmacy > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D12488 > > Modified: > head/sys/dev/bnxt/if_bnxt.c > head/sys/dev/drm/drmP.h > head/sys/dev/drm2/i915/i915_drv.c > head/sys/dev/drm2/radeon/radeon_drv.c > head/sys/dev/e1000/if_em.c > head/sys/net/iflib.h > > Modified: head/sys/dev/bnxt/if_bnxt.c > ============================================================ > ================== > --- head/sys/dev/bnxt/if_bnxt.c Tue Sep 26 23:12:32 2017 (r324037) > +++ head/sys/dev/bnxt/if_bnxt.c Tue Sep 26 23:23:58 2017 (r324038) > @@ -243,6 +243,8 @@ MODULE_DEPEND(bnxt, pci, 1, 1, 1); > MODULE_DEPEND(bnxt, ether, 1, 1, 1); > MODULE_DEPEND(bnxt, iflib, 1, 1, 1); > > +IFLIB_PNP_INFO(pci, bnxt, bnxt_vendor_info_array); > + > static device_method_t bnxt_iflib_methods[] = { > DEVMETHOD(ifdi_tx_queues_alloc, bnxt_tx_queues_alloc), > DEVMETHOD(ifdi_rx_queues_alloc, bnxt_rx_queues_alloc), > > Modified: head/sys/dev/drm/drmP.h > ============================================================ > ================== > --- head/sys/dev/drm/drmP.h Tue Sep 26 23:12:32 2017 (r324037) > +++ head/sys/dev/drm/drmP.h Tue Sep 26 23:23:58 2017 (r324038) > @@ -321,7 +321,7 @@ typedef struct drm_pci_id_list > { > int vendor; > int device; > - long driver_private; > + intptr_t driver_private; > char *name; > } drm_pci_id_list_t; > > > Modified: head/sys/dev/drm2/i915/i915_drv.c > ============================================================ > ================== > --- head/sys/dev/drm2/i915/i915_drv.c Tue Sep 26 23:12:32 2017 > (r324037) > +++ head/sys/dev/drm2/i915/i915_drv.c Tue Sep 26 23:23:58 2017 > (r324038) > @@ -1236,6 +1236,8 @@ MODULE_DEPEND(i915kms, agp, 1, 1, 1); > MODULE_DEPEND(i915kms, iicbus, 1, 1, 1); > MODULE_DEPEND(i915kms, iic, 1, 1, 1); > MODULE_DEPEND(i915kms, iicbb, 1, 1, 1); > +MODULE_PNP_INFO("U32:vendor;U32:device;P;D:human", vgapci, i915, > pciidlist, > + sizeof(pciidlist[0]), nitems(pciidlist)); > > /* We give fast paths for the really cool registers */ > #define NEEDS_FORCE_WAKE(dev_priv, reg) \ > > Modified: head/sys/dev/drm2/radeon/radeon_drv.c > ============================================================ > ================== > --- head/sys/dev/drm2/radeon/radeon_drv.c Tue Sep 26 23:12:32 2017 > (r324037) > +++ head/sys/dev/drm2/radeon/radeon_drv.c Tue Sep 26 23:23:58 2017 > (r324038) > @@ -401,3 +401,5 @@ MODULE_DEPEND(radeonkms, iicbus, 1, 1, 1); > MODULE_DEPEND(radeonkms, iic, 1, 1, 1); > MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1); > MODULE_DEPEND(radeonkms, firmware, 1, 1, 1); > +MODULE_PNP_INFO("U32:vendor;U32:device;P;D:human", vgapci, radeonkms, > + pciidlist, sizeof(pciidlist[0]), nitems(pciidlist)); > > Modified: head/sys/dev/e1000/if_em.c > ============================================================ > ================== > --- head/sys/dev/e1000/if_em.c Tue Sep 26 23:12:32 2017 (r324037) > +++ head/sys/dev/e1000/if_em.c Tue Sep 26 23:23:58 2017 (r324038) > @@ -339,6 +339,8 @@ MODULE_DEPEND(em, pci, 1, 1, 1); > MODULE_DEPEND(em, ether, 1, 1, 1); > MODULE_DEPEND(em, iflib, 1, 1, 1); > > +IFLIB_PNP_INFO(pci, em, em_vendor_info_array); > + > static driver_t igb_driver = { > "igb", igb_methods, sizeof(struct adapter), > }; > @@ -350,6 +352,7 @@ MODULE_DEPEND(igb, pci, 1, 1, 1); > MODULE_DEPEND(igb, ether, 1, 1, 1); > MODULE_DEPEND(igb, iflib, 1, 1, 1); > > +IFLIB_PNP_INFO(pci, igb, igb_vendor_info_array); > > static device_method_t em_if_methods[] = { > DEVMETHOD(ifdi_attach_pre, em_if_attach_pre), > > Modified: head/sys/net/iflib.h > ============================================================ > ================== > --- head/sys/net/iflib.h Tue Sep 26 23:12:32 2017 (r324037) > +++ head/sys/net/iflib.h Tue Sep 26 23:23:58 2017 (r324038) > @@ -173,6 +173,11 @@ typedef struct pci_vendor_info { > #define PVID_OEM(vendor, devid, svid, sdevid, revid, name) {vendor, > devid, svid, sdevid, revid, 0, name} > #define PVID_END {0, 0, 0, 0, 0, 0, NULL} > > +#define IFLIB_PNP_DESCR "U32:vendor;U32:device;U32:subvendor;U32:subdevice;" > \ > + "U32:revision;U32:class;D:human" > This will be MODULE_PNP_INFO. > +#define IFLIB_PNP_INFO(b, u, t) \ > + MODULE_PNP_INFO(IFLIB_PNP_DESCR, b, u, t, sizeof(t[0]), nitems(t)) > And this IFLIB_PNP_DESCR. > + > typedef struct if_txrx { > int (*ift_txd_encap) (void *, if_pkt_info_t); > void (*ift_txd_flush) (void *, uint16_t, qidx_t pidx); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Wed Sep 27 14:59:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3F77E06333; Wed, 27 Sep 2017 14:59:19 +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 B247C76150; Wed, 27 Sep 2017 14:59:19 +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 v8RExI7p097087; Wed, 27 Sep 2017 14:59:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RExIiZ097085; Wed, 27 Sep 2017 14:59:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709271459.v8RExIiZ097085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 27 Sep 2017 14:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324059 - in head/sys/dev/drm2: i915 radeon X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/dev/drm2: i915 radeon X-SVN-Commit-Revision: 324059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 14:59:20 -0000 Author: cem Date: Wed Sep 27 14:59:18 2017 New Revision: 324059 URL: https://svnweb.freebsd.org/changeset/base/324059 Log: Remove PNP metadata from drm2 drivers until kldxref problem is resolved Reported by: np Sponsored by: Dell EMC Isilon Modified: head/sys/dev/drm2/i915/i915_drv.c head/sys/dev/drm2/radeon/radeon_drv.c Modified: head/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- head/sys/dev/drm2/i915/i915_drv.c Wed Sep 27 14:19:47 2017 (r324058) +++ head/sys/dev/drm2/i915/i915_drv.c Wed Sep 27 14:59:18 2017 (r324059) @@ -1236,8 +1236,6 @@ MODULE_DEPEND(i915kms, agp, 1, 1, 1); MODULE_DEPEND(i915kms, iicbus, 1, 1, 1); MODULE_DEPEND(i915kms, iic, 1, 1, 1); MODULE_DEPEND(i915kms, iicbb, 1, 1, 1); -MODULE_PNP_INFO("U32:vendor;U32:device;P;D:human", vgapci, i915, pciidlist, - sizeof(pciidlist[0]), nitems(pciidlist)); /* We give fast paths for the really cool registers */ #define NEEDS_FORCE_WAKE(dev_priv, reg) \ Modified: head/sys/dev/drm2/radeon/radeon_drv.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_drv.c Wed Sep 27 14:19:47 2017 (r324058) +++ head/sys/dev/drm2/radeon/radeon_drv.c Wed Sep 27 14:59:18 2017 (r324059) @@ -401,5 +401,3 @@ MODULE_DEPEND(radeonkms, iicbus, 1, 1, 1); MODULE_DEPEND(radeonkms, iic, 1, 1, 1); MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1); MODULE_DEPEND(radeonkms, firmware, 1, 1, 1); -MODULE_PNP_INFO("U32:vendor;U32:device;P;D:human", vgapci, radeonkms, - pciidlist, sizeof(pciidlist[0]), nitems(pciidlist)); From owner-svn-src-head@freebsd.org Wed Sep 27 16:12:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24D25E083F9; Wed, 27 Sep 2017 16:12:15 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED23B7D580; Wed, 27 Sep 2017 16:12:14 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8RGCE4X032631; Wed, 27 Sep 2017 16:12:14 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RGCDxk032627; Wed, 27 Sep 2017 16:12:13 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201709271612.v8RGCDxk032627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Wed, 27 Sep 2017 16:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324064 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 324064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 16:12:15 -0000 Author: fsu Date: Wed Sep 27 16:12:13 2017 New Revision: 324064 URL: https://svnweb.freebsd.org/changeset/base/324064 Log: Add check to avoid raw inode iblocks fields overflow in case of huge_file feature. Use the Linux logic for now. Reviewed by: pfg (mentor) Approved by: pfg (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12131 Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_extern.h head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/ext2fs/ext2_inode_cnv.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Wed Sep 27 15:29:17 2017 (r324063) +++ head/sys/fs/ext2fs/ext2_alloc.c Wed Sep 27 16:12:13 2017 (r324064) @@ -56,7 +56,6 @@ static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int); static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int); static u_long ext2_dirpref(struct inode *); -static void ext2_fserr(struct m_ext2fs *, uid_t, char *); static u_long ext2_hashalloc(struct inode *, int, long, int, daddr_t (*)(struct inode *, int, daddr_t, int)); @@ -1303,7 +1302,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t * The form of the error message is: * fs: error message */ -static void +void ext2_fserr(struct m_ext2fs *fs, uid_t uid, char *cp) { Modified: head/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- head/sys/fs/ext2fs/ext2_extern.h Wed Sep 27 15:29:17 2017 (r324063) +++ head/sys/fs/ext2fs/ext2_extern.h Wed Sep 27 16:12:13 2017 (r324064) @@ -62,9 +62,10 @@ int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, daddr_t, daddr_t *, int *, int *); void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); void ext2_dirbad(struct inode *ip, doff_t offset, char *how); +void ext2_fserr(struct m_ext2fs *, uid_t, char *); void ext2_ei2i(struct ext2fs_dinode *, struct inode *); int ext2_getlbns(struct vnode *, daddr_t, struct indir *, int *); -void ext2_i2ei(struct inode *, struct ext2fs_dinode *); +int ext2_i2ei(struct inode *, struct ext2fs_dinode *); void ext2_itimes(struct vnode *vp); int ext2_reallocblks(struct vop_reallocblks_args *); int ext2_reclaim(struct vop_reclaim_args *); Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Wed Sep 27 15:29:17 2017 (r324063) +++ head/sys/fs/ext2fs/ext2_inode.c Wed Sep 27 16:12:13 2017 (r324064) @@ -90,8 +90,12 @@ ext2_update(struct vnode *vp, int waitfor) brelse(bp); return (error); } - ext2_i2ei(ip, (struct ext2fs_dinode *)((char *)bp->b_data + + error = ext2_i2ei(ip, (struct ext2fs_dinode *)((char *)bp->b_data + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number))); + if (error) { + brelse(bp); + return (error); + } if (waitfor && !DOINGASYNC(vp)) return (bwrite(bp)); else { Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Wed Sep 27 15:29:17 2017 (r324063) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Wed Sep 27 16:12:13 2017 (r324064) @@ -136,11 +136,13 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) /* * inode to raw ext2 inode */ -void +int ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) { + struct m_ext2fs *fs; int i; + fs = ip->i_e2fs; ei->e2di_mode = ip->i_mode; ei->e2di_nlink = ip->i_nlink; /* @@ -167,8 +169,19 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP : 0; ei->e2di_flags |= (ip->i_flag & IN_E3INDEX) ? EXT3_INDEX : 0; ei->e2di_flags |= (ip->i_flag & IN_E4EXTENTS) ? EXT4_EXTENTS : 0; - ei->e2di_nblock = ip->i_blocks & 0xffffffff; - ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; + if (ip->i_blocks > ~0U && + !EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_HUGE_FILE)) { + ext2_fserr(fs, ip->i_uid, "i_blocks value is out of range"); + return (EIO); + } + if (ip->i_blocks <= 0xffffffffffffULL) { + ei->e2di_nblock = ip->i_blocks & 0xffffffff; + ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; + } else { + ei->e2di_flags |= EXT4_HUGE_FILE; + ei->e2di_nblock = dbtofsb(fs, ip->i_blocks); + ei->e2di_nblock_high = dbtofsb(fs, ip->i_blocks) >> 32 & 0xffff; + } ei->e2di_facl = ip->i_facl & 0xffffffff; ei->e2di_facl_high = ip->i_facl >> 32 & 0xffff; ei->e2di_gen = ip->i_gen; @@ -181,4 +194,6 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_blocks[i] = ip->i_db[i]; for (i = 0; i < EXT2_NIADDR; i++) ei->e2di_blocks[EXT2_NDIR_BLOCKS + i] = ip->i_ib[i]; + + return (0); } From owner-svn-src-head@freebsd.org Wed Sep 27 17:46:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8627AE09DAA; Wed, 27 Sep 2017 17:46:12 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A9177FF6A; Wed, 27 Sep 2017 17:46:12 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8RHkBsD070455; Wed, 27 Sep 2017 17:46:11 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RHkBYI070454; Wed, 27 Sep 2017 17:46:11 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201709271746.v8RHkBYI070454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 27 Sep 2017 17:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324065 - head/sys/dev/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: head/sys/dev/qlxgbe X-SVN-Commit-Revision: 324065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 17:46:12 -0000 Author: davidcs Date: Wed Sep 27 17:46:11 2017 New Revision: 324065 URL: https://svnweb.freebsd.org/changeset/base/324065 Log: Tx Ring Shadow Consumer Index Register needs to be cleared prior to passing it's physical address to the FW during Tx Create Context. MFC after:3 days Modified: head/sys/dev/qlxgbe/ql_hw.c Modified: head/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.c Wed Sep 27 16:12:13 2017 (r324064) +++ head/sys/dev/qlxgbe/ql_hw.c Wed Sep 27 17:46:11 2017 (r324065) @@ -3248,6 +3248,7 @@ qla_init_xmt_cntxt_i(qla_host_t *ha, uint32_t txr_idx) hw_tx_cntxt->txr_free = NUM_TX_DESCRIPTORS; hw_tx_cntxt->txr_next = hw_tx_cntxt->txr_comp = 0; + *(hw_tx_cntxt->tx_cons) = 0; if (qla_mbx_cmd(ha, (uint32_t *)tcntxt, (sizeof (q80_rq_tx_cntxt_t) >> 2), From owner-svn-src-head@freebsd.org Wed Sep 27 17:46:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F378FE09E42; Wed, 27 Sep 2017 17:46:40 +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 CF3BC800AE; Wed, 27 Sep 2017 17:46:40 +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 v8RHkdLa070520; Wed, 27 Sep 2017 17:46:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RHkdfU070510; Wed, 27 Sep 2017 17:46:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709271746.v8RHkdfU070510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 27 Sep 2017 17:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324066 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/dev cddl/dev/dtmalloc cddl/dev/fbt cddl/dev/profile cddl/dev/sdt cddl/dev/systrace fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/dev cddl/dev/dtmalloc cddl/dev/fbt cddl/dev/profile cddl/dev/sdt cddl/dev/systrace fs/nfsclient X-SVN-Commit-Revision: 324066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 17:46:41 -0000 Author: markj Date: Wed Sep 27 17:46:38 2017 New Revision: 324066 URL: https://svnweb.freebsd.org/changeset/base/324066 Log: Use C99 initializers for DTrace provider methods. This makes the definitions easier to read and more cscope-friendly. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/cddl/dev/dtmalloc/dtmalloc.c head/sys/cddl/dev/fbt/fbt.c head/sys/cddl/dev/profile/profile.c head/sys/cddl/dev/prototype.c head/sys/cddl/dev/sdt/sdt.c head/sys/cddl/dev/systrace/systrace.c head/sys/fs/nfsclient/nfs_clkdtrace.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Sep 27 17:46:38 2017 (r324066) @@ -339,17 +339,17 @@ static void dtrace_nullop(void) {} -static dtrace_pops_t dtrace_provider_ops = { - (void (*)(void *, dtrace_probedesc_t *))dtrace_nullop, - (void (*)(void *, modctl_t *))dtrace_nullop, - (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, - (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, - (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, - (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, - NULL, - NULL, - NULL, - (void (*)(void *, dtrace_id_t, void *))dtrace_nullop +static dtrace_pops_t dtrace_provider_ops = { + .dtps_provide = (void (*)(void *, dtrace_probedesc_t *))dtrace_nullop, + .dtps_provide_module = (void (*)(void *, modctl_t *))dtrace_nullop, + .dtps_enable = (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, + .dtps_disable = (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, + .dtps_suspend = (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, + .dtps_resume = (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, + .dtps_getargdesc = NULL, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = (void (*)(void *, dtrace_id_t, void *))dtrace_nullop, }; static dtrace_id_t dtrace_probeid_begin; /* special BEGIN probe */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Wed Sep 27 17:46:38 2017 (r324066) @@ -1455,29 +1455,29 @@ static const dtrace_pattr_t pid_attr = { }; static dtrace_pops_t pid_pops = { - fasttrap_pid_provide, - NULL, - fasttrap_pid_enable, - fasttrap_pid_disable, - NULL, - NULL, - fasttrap_pid_getargdesc, - fasttrap_pid_getarg, - NULL, - fasttrap_pid_destroy + .dtps_provide = fasttrap_pid_provide, + .dtps_provide_module = NULL, + .dtps_enable = fasttrap_pid_enable, + .dtps_disable = fasttrap_pid_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = fasttrap_pid_getargdesc, + .dtps_getargval = fasttrap_pid_getarg, + .dtps_usermode = NULL, + .dtps_destroy = fasttrap_pid_destroy }; static dtrace_pops_t usdt_pops = { - fasttrap_pid_provide, - NULL, - fasttrap_pid_enable, - fasttrap_pid_disable, - NULL, - NULL, - fasttrap_pid_getargdesc, - fasttrap_usdt_getarg, - NULL, - fasttrap_pid_destroy + .dtps_provide = fasttrap_pid_provide, + .dtps_provide_module = NULL, + .dtps_enable = fasttrap_pid_enable, + .dtps_disable = fasttrap_pid_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = fasttrap_pid_getargdesc, + .dtps_getargval = fasttrap_usdt_getarg, + .dtps_usermode = NULL, + .dtps_destroy = fasttrap_pid_destroy }; static fasttrap_proc_t * @@ -2251,9 +2251,9 @@ fasttrap_meta_remove(void *arg, dtrace_helper_provdesc } static dtrace_mops_t fasttrap_mops = { - fasttrap_meta_create_probe, - fasttrap_meta_provide, - fasttrap_meta_remove + .dtms_create_probe = fasttrap_meta_create_probe, + .dtms_provide_pid = fasttrap_meta_provide, + .dtms_remove_pid = fasttrap_meta_remove }; /*ARGSUSED*/ Modified: head/sys/cddl/dev/dtmalloc/dtmalloc.c ============================================================================== --- head/sys/cddl/dev/dtmalloc/dtmalloc.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/dev/dtmalloc/dtmalloc.c Wed Sep 27 17:46:38 2017 (r324066) @@ -60,16 +60,16 @@ static dtrace_pattr_t dtmalloc_attr = { }; static dtrace_pops_t dtmalloc_pops = { - dtmalloc_provide, - NULL, - dtmalloc_enable, - dtmalloc_disable, - NULL, - NULL, - dtmalloc_getargdesc, - NULL, - NULL, - dtmalloc_destroy + .dtps_provide = dtmalloc_provide, + .dtps_provide_module = NULL, + .dtps_enable = dtmalloc_enable, + .dtps_disable = dtmalloc_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = dtmalloc_getargdesc, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = dtmalloc_destroy }; static struct cdev *dtmalloc_cdev; Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/dev/fbt/fbt.c Wed Sep 27 17:46:38 2017 (r324066) @@ -95,16 +95,16 @@ static dtrace_pattr_t fbt_attr = { }; static dtrace_pops_t fbt_pops = { - NULL, - fbt_provide_module, - fbt_enable, - fbt_disable, - fbt_suspend, - fbt_resume, - fbt_getargdesc, - NULL, - NULL, - fbt_destroy + .dtps_provide = NULL, + .dtps_provide_module = fbt_provide_module, + .dtps_enable = fbt_enable, + .dtps_disable = fbt_disable, + .dtps_suspend = fbt_suspend, + .dtps_resume = fbt_resume, + .dtps_getargdesc = fbt_getargdesc, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = fbt_destroy }; static struct cdev *fbt_cdev; Modified: head/sys/cddl/dev/profile/profile.c ============================================================================== --- head/sys/cddl/dev/profile/profile.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/dev/profile/profile.c Wed Sep 27 17:46:38 2017 (r324066) @@ -221,16 +221,16 @@ static dtrace_pattr_t profile_attr = { }; static dtrace_pops_t profile_pops = { - profile_provide, - NULL, - profile_enable, - profile_disable, - NULL, - NULL, - NULL, - NULL, - NULL, - profile_destroy + .dtps_provide = profile_provide, + .dtps_provide_module = NULL, + .dtps_enable = profile_enable, + .dtps_disable = profile_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = NULL, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = profile_destroy }; static struct cdev *profile_cdev; Modified: head/sys/cddl/dev/prototype.c ============================================================================== --- head/sys/cddl/dev/prototype.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/dev/prototype.c Wed Sep 27 17:46:38 2017 (r324066) @@ -39,16 +39,16 @@ static dtrace_pattr_t prototype_attr = { }; static dtrace_pops_t prototype_pops = { - prototype_provide, - NULL, - prototype_enable, - prototype_disable, - NULL, - NULL, - prototype_getargdesc, - NULL, - NULL, - prototype_destroy + .dtps_provide = prototype_provide, + .dtps_provide_module = NULL, + .dtps_enable = prototype_enable, + .dtps_disable = prototype_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = prototype_getargdesc, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = prototype_destroy }; static struct cdev *prototype_cdev; Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/dev/sdt/sdt.c Wed Sep 27 17:46:38 2017 (r324066) @@ -85,16 +85,16 @@ static dtrace_pattr_t sdt_attr = { }; static dtrace_pops_t sdt_pops = { - sdt_provide_probes, - NULL, - sdt_enable, - sdt_disable, - NULL, - NULL, - sdt_getargdesc, - NULL, - NULL, - sdt_destroy, + .dtps_provide = sdt_provide_probes, + .dtps_provide_module = NULL, + .dtps_enable = sdt_enable, + .dtps_disable = sdt_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = sdt_getargdesc, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = sdt_destroy, }; static TAILQ_HEAD(, sdt_provider) sdt_prov_list; Modified: head/sys/cddl/dev/systrace/systrace.c ============================================================================== --- head/sys/cddl/dev/systrace/systrace.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/cddl/dev/systrace/systrace.c Wed Sep 27 17:46:38 2017 (r324066) @@ -160,16 +160,16 @@ static dtrace_pattr_t systrace_attr = { }; static dtrace_pops_t systrace_pops = { - systrace_provide, - NULL, - systrace_enable, - systrace_disable, - NULL, - NULL, - systrace_getargdesc, - systrace_getargval, - NULL, - systrace_destroy + .dtps_provide = systrace_provide, + .dtps_provide_module = NULL, + .dtps_enable = systrace_enable, + .dtps_disable = systrace_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = systrace_getargdesc, + .dtps_getargval = systrace_getargval, + .dtps_usermode = NULL, + .dtps_destroy = systrace_destroy }; static dtrace_provider_id_t systrace_id; Modified: head/sys/fs/nfsclient/nfs_clkdtrace.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clkdtrace.c Wed Sep 27 17:46:11 2017 (r324065) +++ head/sys/fs/nfsclient/nfs_clkdtrace.c Wed Sep 27 17:46:38 2017 (r324066) @@ -162,16 +162,16 @@ static char *dtnfsclient_miss_str = "miss"; static char *dtnfsclient_start_str = "start"; static dtrace_pops_t dtnfsclient_pops = { - dtnfsclient_provide, - NULL, - dtnfsclient_enable, - dtnfsclient_disable, - NULL, - NULL, - dtnfsclient_getargdesc, - NULL, - NULL, - dtnfsclient_destroy + .dtps_provide = dtnfsclient_provide, + .dtps_provide_module = NULL, + .dtps_enable = dtnfsclient_enable, + .dtps_disable = dtnfsclient_disable, + .dtps_suspend = NULL, + .dtps_resume = NULL, + .dtps_getargdesc = dtnfsclient_getargdesc, + .dtps_getargval = NULL, + .dtps_usermode = NULL, + .dtps_destroy = dtnfsclient_destroy }; static dtrace_provider_id_t dtnfsclient_id; From owner-svn-src-head@freebsd.org Wed Sep 27 18:46:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A948AE0C3D7 for ; Wed, 27 Sep 2017 18:46:55 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 723EA81E50 for ; Wed, 27 Sep 2017 18:46:55 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-io0-x22e.google.com with SMTP id e189so16635535ioa.4 for ; Wed, 27 Sep 2017 11:46:55 -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=7pZ7L2ncjJtVSi2OLkyP18ZkKBFCLvWw6rZ/Vlqo8Cs=; b=ZGYD0NEkxLEIwFGZSEUa+msEmAnApVa5VTQ5jMOnRPcLoPucWY0l5wIA6sPttgSyLv A72/02bkQ0TxKmitFLp2AlU2SeajDsKznexwM5/WmFn/5/YgcHKG75Ny+mZw5dZtTGL3 N5jqN8MSnASO5HyYSxQ4ESobCi28QwAbHa5l6ddcKBK1D5Wz55+I4NKVRqYOyeIqDWD4 mlsLTjaVz+qD1dW/f9kQVP/h/mpnJVsbrTYKL+GWdCOEvHOP7ZbU0UaX42EEgoRb18ia +8Rj4NxnsMLK2aVbhBAWgvhZ1n2HwUfvFpWDSD93W+tL10Y6YE6XN1XzWzEt2EoJjlvI wBKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7pZ7L2ncjJtVSi2OLkyP18ZkKBFCLvWw6rZ/Vlqo8Cs=; b=khLiiw/dTC3Mz0kDnuZx1P1sC7w8AtBSlQvaAkJ19mc09teHpa4nQIySbC49g8zdk2 gnX9F6Vp2Mi3uojsL40OYzj+BvoeUVlPdDmAIo+r8MIFa487ZgutVwgT96tJ8mAEt2Mr 9wA9prUaiVUy65JLOjyRsrbRxKjcVZe2Cj4l/EMMMVIYE8LSnPnUqXQcJQVkJ0y61U5Y qVL4chEZPu9suqyQSZLGxW8NhAc5PjWD0pZNRaytb0XFJSnIfgIUINqe112qU2CIogCM V5ebn4Gl38M84LiG+bCrwc8sLTNAbu6PC5KveyuQfANzwiC0TaYHUaOSFhWBZTSQlzas 2liA== X-Gm-Message-State: AHPjjUg0UAMPbPJwqkCxjx8x6fiN2UdRQtEawj55XN+9bALtlJnJqZnD 0S1B9+QyHQdcxycUTqrZ/hVNVXJspi3gc4L59ZcnBA== X-Google-Smtp-Source: AOwi7QAl0XSHFQYxOr1kosi7fTNB+7duQxugg/OAC9u+5ovhDa8taTs+KNaojdeYwRvSonJHkqBoKpcfh5UtGB8fKu0= X-Received: by 10.107.195.195 with SMTP id t186mr3695399iof.212.1506538014868; Wed, 27 Sep 2017 11:46:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.46.79 with HTTP; Wed, 27 Sep 2017 11:46:24 -0700 (PDT) In-Reply-To: <201709271746.v8RHkBYI070454@repo.freebsd.org> References: <201709271746.v8RHkBYI070454@repo.freebsd.org> From: Ed Schouten Date: Wed, 27 Sep 2017 20:46:24 +0200 Message-ID: Subject: Re: svn commit: r324065 - head/sys/dev/qlxgbe To: David C Somayajulu 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.23 Precedence: list List-Id: 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, 27 Sep 2017 18:46:55 -0000 2017-09-27 19:46 GMT+02:00 David C Somayajulu : > + *(hw_tx_cntxt->tx_cons) = 0; In this case the parentheses are superfluous, right? -> has a higher precedence than *. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands From owner-svn-src-head@freebsd.org Wed Sep 27 19:14:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CBACE0CD6F; Wed, 27 Sep 2017 19:14:01 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5507182E36; Wed, 27 Sep 2017 19:14:01 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8RJE0vm008896; Wed, 27 Sep 2017 19:14:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RJE0nn008894; Wed, 27 Sep 2017 19:14:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709271914.v8RJE0nn008894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 27 Sep 2017 19:14:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324067 - in head/sys/dev/drm2: i915 radeon X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/dev/drm2: i915 radeon X-SVN-Commit-Revision: 324067 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 19:14:01 -0000 Author: cem Date: Wed Sep 27 19:14:00 2017 New Revision: 324067 URL: https://svnweb.freebsd.org/changeset/base/324067 Log: Unrevert r324059 With a colon and bogus name ("#") added to appease the simplistic parser used in kldxref. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/drm2/i915/i915_drv.c head/sys/dev/drm2/radeon/radeon_drv.c Modified: head/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- head/sys/dev/drm2/i915/i915_drv.c Wed Sep 27 17:46:38 2017 (r324066) +++ head/sys/dev/drm2/i915/i915_drv.c Wed Sep 27 19:14:00 2017 (r324067) @@ -1236,6 +1236,8 @@ MODULE_DEPEND(i915kms, agp, 1, 1, 1); MODULE_DEPEND(i915kms, iicbus, 1, 1, 1); MODULE_DEPEND(i915kms, iic, 1, 1, 1); MODULE_DEPEND(i915kms, iicbb, 1, 1, 1); +MODULE_PNP_INFO("U32:vendor;U32:device;P:#;D:human", vgapci, i915, pciidlist, + sizeof(pciidlist[0]), nitems(pciidlist)); /* We give fast paths for the really cool registers */ #define NEEDS_FORCE_WAKE(dev_priv, reg) \ Modified: head/sys/dev/drm2/radeon/radeon_drv.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_drv.c Wed Sep 27 17:46:38 2017 (r324066) +++ head/sys/dev/drm2/radeon/radeon_drv.c Wed Sep 27 19:14:00 2017 (r324067) @@ -401,3 +401,5 @@ MODULE_DEPEND(radeonkms, iicbus, 1, 1, 1); MODULE_DEPEND(radeonkms, iic, 1, 1, 1); MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1); MODULE_DEPEND(radeonkms, firmware, 1, 1, 1); +MODULE_PNP_INFO("U32:vendor;U32:device;P:#;D:human", vgapci, radeonkms, + pciidlist, sizeof(pciidlist[0]), nitems(pciidlist)); From owner-svn-src-head@freebsd.org Wed Sep 27 19:21:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC8CAE0D2E0; Wed, 27 Sep 2017 19:21:53 +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 6E3F2833C4; Wed, 27 Sep 2017 19:21:53 +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 v8RJLquD012170; Wed, 27 Sep 2017 19:21:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RJLqFt012169; Wed, 27 Sep 2017 19:21:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709271921.v8RJLqFt012169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 27 Sep 2017 19:21:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324068 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 324068 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 19:21:53 -0000 Author: imp Date: Wed Sep 27 19:21:52 2017 New Revision: 324068 URL: https://svnweb.freebsd.org/changeset/base/324068 Log: Improve description of the PNP string a bit. Modified: head/sys/sys/module.h Modified: head/sys/sys/module.h ============================================================================== --- head/sys/sys/module.h Wed Sep 27 19:14:00 2017 (r324067) +++ head/sys/sys/module.h Wed Sep 27 19:21:52 2017 (r324068) @@ -183,7 +183,7 @@ struct mod_pnp_match_info &_module_pnp_##b##_##unique, #b); /** * descr is a string that describes each entry in the table. The general - * form is (TYPE:pnp_name[/pnp_name];)* + * form is the grammar (TYPE:pnp_name[/pnp_name];)* * where TYPE is one of the following: * U8 uint8_t element * V8 like U8 and 0xff means match any @@ -196,12 +196,14 @@ struct mod_pnp_match_info * V32 like U32 and 0xffffffff means match any * W32 Two 16-bit values with first pnp_name in LSW and second in MSW. * Z pointer to a string to match exactly - * D like Z, but is the string passed to device_set_descr() + * D pointer to a string to human readable description for device * P A pointer that should be ignored * E EISA PNP Identifier (in binary, but bus publishes string) * K Key for whole table. pnp_name=value. must be last, if present. * * The pnp_name "#" is reserved for other fields that should be ignored. + * Otherwise pnp_name must match the name from the parent device's pnpinfo + * output. The second pnp_name is used for the W32 type. */ extern struct sx modules_sx; From owner-svn-src-head@freebsd.org Wed Sep 27 19:22:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DA17E0D362; Wed, 27 Sep 2017 19:22:15 +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 95AF8834A2; Wed, 27 Sep 2017 19:22:13 +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 v8RJMB5O012324; Wed, 27 Sep 2017 19:22:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RJMBSt012323; Wed, 27 Sep 2017 19:22:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709271922.v8RJMBSt012323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 27 Sep 2017 19:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324069 - head/sys/dev/pccard X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pccard X-SVN-Commit-Revision: 324069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 19:22:15 -0000 Author: imp Date: Wed Sep 27 19:22:10 2017 New Revision: 324069 URL: https://svnweb.freebsd.org/changeset/base/324069 Log: Since the human readable name is actually ignored, and not matching a 'human' pnp string, change it to #, the name reserved for fields that are ignored. Modified: head/sys/dev/pccard/pccardvar.h Modified: head/sys/dev/pccard/pccardvar.h ============================================================================== --- head/sys/dev/pccard/pccardvar.h Wed Sep 27 19:21:52 2017 (r324068) +++ head/sys/dev/pccard/pccardvar.h Wed Sep 27 19:22:10 2017 (r324069) @@ -91,7 +91,7 @@ struct pccard_product { * are informative, according to the standard, but I have a dim memory of using these * strings to match things, though I can't find the example right now. */ -#define PCCARD_PNP_DESCR "D:human;V32:manufacturer;V32:product;Z:cisvendor;Z:cisproduct;" +#define PCCARD_PNP_DESCR "D:#;V32:manufacturer;V32:product;Z:cisvendor;Z:cisproduct;" #define PCCARD_PNP_INFO(t) \ MODULE_PNP_INFO(PCCARD_PNP_DESCR, pccard, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0])); \ From owner-svn-src-head@freebsd.org Wed Sep 27 19:35:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F364BE0D80C for ; Wed, 27 Sep 2017 19:35:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5F5183DB5 for ; Wed, 27 Sep 2017 19:35:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22c.google.com with SMTP id g32so16644924ioj.2 for ; Wed, 27 Sep 2017 12:35:53 -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=dQa0eQe6WPP6+drCMq8JOmP1nEyy+QEW1EP7NEPioPM=; b=xwpKfasn7BlVFxvdi/1wCid74yZTNGItG8GucWyhC3nzHXkeBsC/CgbZrL8+y+Jj/u hqRUsm06AHKCLFeY1wSIgNsn1bvP4mrGh+I6LQRQm6gVj23P89Z4ly0SZKg0lE1M4NYp 92IP0i7JoJj+IGag3B3af6msWG6/VNuQwIhqvNbhtxIZsiVa15Bf1MiHnjdod1wnMIO1 naVSavVVRm5NGDigpRApCcFGuZJK7egXDtjP+yneZmqEbU2MI7YQHXSQz0dmFXoOuDxx 5is9b1A4C2aKqnrZG6RKpSpCOENmhU7hrZTuXq3Gq9cS6oDZf8K3EryH60UZyva+kwuW 1lVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=dQa0eQe6WPP6+drCMq8JOmP1nEyy+QEW1EP7NEPioPM=; b=GRRhvsBGTyWFpPhejepeKB8GkGYta1+PbMKwl7SLhkKO8DnGW3ylqVMD0dRRrpdm6V V8pXhr3EnCCK/8KQFfTvcyct7sAa4jFE+kSS/XQq/OrsFktDRilHFGsTxdYfJk/oc5xl fktp1TuD+g6u+KlCE7lLhox1iH+GanP5+/E7PbVg6pztQvUs8KUFJ/8rluAND+KTgncf l4Ozs+2rGVWLw+fUgPPHCjLbPXjxQmyN7kWeDA3iwq0g9QJXzieyLa1dtMXUC2iNjFmQ WX8VnXueOzNt9fNvVaRqvkMnGyrYSp9mMyxurPKhN+u991wNMORkofNIYaOF6pp26AYT pNyQ== X-Gm-Message-State: AMCzsaW8M4h9JWGS2Nyd4a5b4pp0T8w8e1ltKKA3RvAsyHEPIaVCA4Cy ZEoQ533lpnDJwmyQYbglKWC8jXzAqmayzy8C+/EoTQ== X-Google-Smtp-Source: AOwi7QD1e9cLdJkExtFd6xApjXyuRWfkWeMUjam/IRiy59coD5MhB4RVMGc/ZF4lwg1A6F3lycW52jwD6mkDlceh4rg= X-Received: by 10.107.135.147 with SMTP id r19mr3932140ioi.26.1506540953021; Wed, 27 Sep 2017 12:35:53 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.2.194 with HTTP; Wed, 27 Sep 2017 12:35:46 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:f996:822c:89a6:8ee4] In-Reply-To: <201709271914.v8RJE0nn008894@repo.freebsd.org> References: <201709271914.v8RJE0nn008894@repo.freebsd.org> From: Warner Losh Date: Wed, 27 Sep 2017 13:35:46 -0600 X-Google-Sender-Auth: -BrO-Zy1HmohqB1cSSLugwbfOjQ Message-ID: Subject: Re: svn commit: r324067 - in head/sys/dev/drm2: i915 radeon To: Conrad Meyer Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 19:35:54 -0000 On Wed, Sep 27, 2017 at 1:14 PM, Conrad Meyer wrote: > Author: cem > Date: Wed Sep 27 19:14:00 2017 > New Revision: 324067 > URL: https://svnweb.freebsd.org/changeset/base/324067 > > Log: > Unrevert r324059 > > With a colon and bogus name ("#") added to appease the simplistic parser > used in kldxref. > '#' isn't a bogus name. It's the name reserved for 'ignore this'. Warner > Sponsored by: Dell EMC Isilon > > Modified: > head/sys/dev/drm2/i915/i915_drv.c > head/sys/dev/drm2/radeon/radeon_drv.c > > Modified: head/sys/dev/drm2/i915/i915_drv.c > ============================================================ > ================== > --- head/sys/dev/drm2/i915/i915_drv.c Wed Sep 27 17:46:38 2017 > (r324066) > +++ head/sys/dev/drm2/i915/i915_drv.c Wed Sep 27 19:14:00 2017 > (r324067) > @@ -1236,6 +1236,8 @@ MODULE_DEPEND(i915kms, agp, 1, 1, 1); > MODULE_DEPEND(i915kms, iicbus, 1, 1, 1); > MODULE_DEPEND(i915kms, iic, 1, 1, 1); > MODULE_DEPEND(i915kms, iicbb, 1, 1, 1); > +MODULE_PNP_INFO("U32:vendor;U32:device;P:#;D:human", vgapci, i915, > pciidlist, > + sizeof(pciidlist[0]), nitems(pciidlist)); > > /* We give fast paths for the really cool registers */ > #define NEEDS_FORCE_WAKE(dev_priv, reg) \ > > Modified: head/sys/dev/drm2/radeon/radeon_drv.c > ============================================================ > ================== > --- head/sys/dev/drm2/radeon/radeon_drv.c Wed Sep 27 17:46:38 2017 > (r324066) > +++ head/sys/dev/drm2/radeon/radeon_drv.c Wed Sep 27 19:14:00 2017 > (r324067) > @@ -401,3 +401,5 @@ MODULE_DEPEND(radeonkms, iicbus, 1, 1, 1); > MODULE_DEPEND(radeonkms, iic, 1, 1, 1); > MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1); > MODULE_DEPEND(radeonkms, firmware, 1, 1, 1); > +MODULE_PNP_INFO("U32:vendor;U32:device;P:#;D:human", vgapci, radeonkms, > + pciidlist, sizeof(pciidlist[0]), nitems(pciidlist)); > > From owner-svn-src-head@freebsd.org Wed Sep 27 19:44:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 576D4E0DB21; Wed, 27 Sep 2017 19:44:25 +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 8663984328; Wed, 27 Sep 2017 19:44:24 +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 v8RJiNSX022015; Wed, 27 Sep 2017 19:44:23 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RJiNjg022010; Wed, 27 Sep 2017 19:44:23 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201709271944.v8RJiNjg022010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Wed, 27 Sep 2017 19:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324070 - in head/sys: dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/cores/chipc/pwrctl dev/bhnd/cores/pci dev/bhnd/cores/pmu dev/bhnd/nvram dev/bhnd/siba mips/broadcom X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: in head/sys: dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/cores/chipc/pwrctl dev/bhnd/cores/pci dev/bhnd/cores/pmu dev/bhnd/nvram dev/bhnd/siba mips/broadcom X-SVN-Commit-Revision: 324070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 19:44:25 -0000 Author: landonf Date: Wed Sep 27 19:44:23 2017 New Revision: 324070 URL: https://svnweb.freebsd.org/changeset/base/324070 Log: bhnd: Implement bhnd(4) platform device registration. Add bhnd(4) API for explicitly registering BHND platform devices (ChipCommon, PMU, NVRAM, etc) with the bus, rather than walking the newbus hierarchy to discover platform devices. These devices are now also refcounted; attempting to deregister an actively used platform device will return EBUSY. This resolves a lock ordering incompatibility with bwn(4)'s firmware loading threads; previously it was necessary to acquire Giant to protect newbus access when locating and querying the NVRAM device. Approved by: adrian (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12392 Added: head/sys/dev/bhnd/bhnd_private.h (contents, props changed) Modified: head/sys/dev/bhnd/bhnd.c head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhnd_types.h head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndbvar.h head/sys/dev/bhnd/bhndvar.h head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c head/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c head/sys/dev/bhnd/nvram/bhnd_sprom.c head/sys/dev/bhnd/siba/siba_bhndb.c head/sys/mips/broadcom/bcm_machdep.c head/sys/mips/broadcom/bcm_machdep.h head/sys/mips/broadcom/bcm_nvram_cfe.c head/sys/mips/broadcom/bhnd_nexus.c Modified: head/sys/dev/bhnd/bhnd.c ============================================================================== --- head/sys/dev/bhnd/bhnd.c Wed Sep 27 19:22:10 2017 (r324069) +++ head/sys/dev/bhnd/bhnd.c Wed Sep 27 19:44:23 2017 (r324070) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2015-2016 Landon Fuller + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Landon Fuller + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -69,12 +73,10 @@ __FBSDID("$FreeBSD$"); #include "bhnd.h" #include "bhndvar.h" +#include "bhnd_private.h" + MALLOC_DEFINE(M_BHND, "bhnd", "bhnd bus data structures"); -/* Bus pass at which all bus-required children must be available, and - * attachment may be finalized. */ -#define BHND_FINISH_ATTACH_PASS BUS_PASS_DEFAULT - /** * bhnd_generic_probe_nomatch() reporting configuration. */ @@ -92,23 +94,8 @@ static const struct bhnd_nomatch { { BHND_MFGID_INVALID, BHND_COREID_INVALID, false } }; - static int bhnd_delete_children(struct bhnd_softc *sc); -static int bhnd_finish_attach(struct bhnd_softc *sc); - -static device_t bhnd_find_chipc(struct bhnd_softc *sc); -static struct chipc_caps *bhnd_find_chipc_caps(struct bhnd_softc *sc); -static device_t bhnd_find_platform_dev(struct bhnd_softc *sc, - const char *classname); -static device_t bhnd_find_pmu(struct bhnd_softc *sc); -static device_t bhnd_find_nvram(struct bhnd_softc *sc); - -static int compare_ascending_probe_order(const void *lhs, - const void *rhs); -static int compare_descending_probe_order(const void *lhs, - const void *rhs); - /** * Default bhnd(4) bus driver implementation of DEVICE_ATTACH(). * @@ -119,8 +106,6 @@ int bhnd_generic_attach(device_t dev) { struct bhnd_softc *sc; - device_t *devs; - int ndevs; int error; if (device_is_attached(dev)) @@ -129,29 +114,13 @@ bhnd_generic_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - if ((error = device_get_children(dev, &devs, &ndevs))) - return (error); - /* Probe and attach all children */ - qsort(devs, ndevs, sizeof(*devs), compare_ascending_probe_order); - for (int i = 0; i < ndevs; i++) { - device_t child = devs[i]; - device_probe_and_attach(child); + if ((error = bhnd_bus_probe_children(dev))) { + bhnd_delete_children(sc); + return (error); } - /* Try to finalize attachment */ - if (bus_current_pass >= BHND_FINISH_ATTACH_PASS) { - if ((error = bhnd_finish_attach(sc))) - goto cleanup; - } - -cleanup: - free(devs, M_TEMP); - - if (error) - bhnd_delete_children(sc); - - return (error); + return (0); } /** @@ -164,11 +133,13 @@ bhnd_delete_children(struct bhnd_softc *sc) int ndevs; int error; - if ((error = device_get_children(sc->dev, &devs, &ndevs))) + /* Fetch children in detach order */ + error = bhnd_bus_get_children(sc->dev, &devs, &ndevs, + BHND_DEVICE_ORDER_DETACH); + if (error) return (error); - /* Detach in the reverse of attach order */ - qsort(devs, ndevs, sizeof(*devs), compare_descending_probe_order); + /* Perform detach */ for (int i = 0; i < ndevs; i++) { device_t child = devs[i]; @@ -178,7 +149,7 @@ bhnd_delete_children(struct bhnd_softc *sc) } cleanup: - free(devs, M_TEMP); + bhnd_bus_free_children(devs); return (error); } @@ -193,12 +164,17 @@ int bhnd_generic_detach(device_t dev) { struct bhnd_softc *sc; + int error; if (!device_is_attached(dev)) return (EBUSY); sc = device_get_softc(dev); - return (bhnd_delete_children(sc)); + + if ((error = bhnd_delete_children(sc))) + return (error); + + return (0); } /** @@ -218,11 +194,13 @@ bhnd_generic_shutdown(device_t dev) if (!device_is_attached(dev)) return (EBUSY); - if ((error = device_get_children(dev, &devs, &ndevs))) + /* Fetch children in detach order */ + error = bhnd_bus_get_children(dev, &devs, &ndevs, + BHND_DEVICE_ORDER_DETACH); + if (error) return (error); - /* Shutdown in the reverse of attach order */ - qsort(devs, ndevs, sizeof(*devs), compare_descending_probe_order); + /* Perform shutdown */ for (int i = 0; i < ndevs; i++) { device_t child = devs[i]; @@ -232,7 +210,7 @@ bhnd_generic_shutdown(device_t dev) } cleanup: - free(devs, M_TEMP); + bhnd_bus_free_children(devs); return (error); } @@ -253,10 +231,13 @@ bhnd_generic_resume(device_t dev) if (!device_is_attached(dev)) return (EBUSY); - if ((error = device_get_children(dev, &devs, &ndevs))) + /* Fetch children in attach order */ + error = bhnd_bus_get_children(dev, &devs, &ndevs, + BHND_DEVICE_ORDER_ATTACH); + if (error) return (error); - qsort(devs, ndevs, sizeof(*devs), compare_ascending_probe_order); + /* Perform resume */ for (int i = 0; i < ndevs; i++) { device_t child = devs[i]; @@ -266,7 +247,7 @@ bhnd_generic_resume(device_t dev) } cleanup: - free(devs, M_TEMP); + bhnd_bus_free_children(devs); return (error); } @@ -289,11 +270,13 @@ bhnd_generic_suspend(device_t dev) if (!device_is_attached(dev)) return (EBUSY); - if ((error = device_get_children(dev, &devs, &ndevs))) + /* Fetch children in detach order */ + error = bhnd_bus_get_children(dev, &devs, &ndevs, + BHND_DEVICE_ORDER_DETACH); + if (error) return (error); - /* Suspend in the reverse of attach order */ - qsort(devs, ndevs, sizeof(*devs), compare_descending_probe_order); + /* Perform suspend */ for (int i = 0; i < ndevs; i++) { device_t child = devs[i]; error = BUS_SUSPEND_CHILD(device_get_parent(child), child); @@ -310,260 +293,11 @@ bhnd_generic_suspend(device_t dev) } cleanup: - free(devs, M_TEMP); + bhnd_bus_free_children(devs); return (error); } -static void -bhnd_new_pass(device_t dev) -{ - struct bhnd_softc *sc; - int error; - - sc = device_get_softc(dev); - - /* Attach any permissible children */ - bus_generic_new_pass(dev); - - /* Finalize attachment */ - if (!sc->attach_done && bus_current_pass >= BHND_FINISH_ATTACH_PASS) { - if ((error = bhnd_finish_attach(sc))) { - panic("bhnd_finish_attach() failed: %d", error); - } - } -} - -/* - * Finish any pending bus attachment operations. - * - * When attached as a SoC bus (as opposed to a bridged WiFi device), our - * platform devices may not be attached until later bus passes, necessitating - * delayed initialization on our part. - */ -static int -bhnd_finish_attach(struct bhnd_softc *sc) -{ - struct chipc_caps *ccaps; - - GIANT_REQUIRED; /* for newbus */ - - KASSERT(bus_current_pass >= BHND_FINISH_ATTACH_PASS, - ("bhnd_finish_attach() called in pass %d", bus_current_pass)); - - KASSERT(!sc->attach_done, ("duplicate call to bhnd_finish_attach()")); - - /* Locate chipc device */ - if ((sc->chipc_dev = bhnd_find_chipc(sc)) == NULL) { - device_printf(sc->dev, "error: ChipCommon device not found\n"); - return (ENXIO); - } - - ccaps = BHND_CHIPC_GET_CAPS(sc->chipc_dev); - - /* Look for NVRAM device */ - if (ccaps->nvram_src != BHND_NVRAM_SRC_UNKNOWN) { - if ((sc->nvram_dev = bhnd_find_nvram(sc)) == NULL) { - device_printf(sc->dev, - "warning: NVRAM %s device not found\n", - bhnd_nvram_src_name(ccaps->nvram_src)); - } - } - - /* Look for a PMU */ - if (ccaps->pmu || ccaps->pwr_ctrl) { - if ((sc->pmu_dev = bhnd_find_pmu(sc)) == NULL) { - device_printf(sc->dev, - "attach failed: supported PMU not found\n"); - return (ENXIO); - } - } - - /* Mark attach as completed */ - sc->attach_done = true; - - return (0); -} - -/* Locate the ChipCommon core. */ -static device_t -bhnd_find_chipc(struct bhnd_softc *sc) -{ - device_t chipc; - - /* Make sure we're holding Giant for newbus */ - GIANT_REQUIRED; - - /* chipc_dev is initialized during attachment */ - if (sc->attach_done) { - if ((chipc = sc->chipc_dev) == NULL) - return (NULL); - - goto found; - } - - /* Locate chipc core with a core unit of 0 */ - chipc = bhnd_find_child(sc->dev, BHND_DEVCLASS_CC, 0); - if (chipc == NULL) - return (NULL); - -found: - if (device_get_state(chipc) < DS_ATTACHING) { - device_printf(sc->dev, "chipc found, but did not attach\n"); - return (NULL); - } - - return (chipc); -} - -/* Locate the ChipCommon core and return the device capabilities */ -static struct chipc_caps * -bhnd_find_chipc_caps(struct bhnd_softc *sc) -{ - device_t chipc; - - if ((chipc = bhnd_find_chipc(sc)) == NULL) { - device_printf(sc->dev, - "chipc unavailable; cannot fetch capabilities\n"); - return (NULL); - } - - return (BHND_CHIPC_GET_CAPS(chipc)); -} - /** - * Find an attached platform device on @p dev, searching first for cores - * matching @p classname, and if not found, searching the children of the first - * bhnd_chipc device on the bus. - * - * @param sc Driver state. - * @param chipc Attached ChipCommon device. - * @param classname Device class to search for. - * - * @retval device_t A matching device. - * @retval NULL If no matching device is found. - */ -static device_t -bhnd_find_platform_dev(struct bhnd_softc *sc, const char *classname) -{ - device_t chipc, child; - - /* Make sure we're holding Giant for newbus */ - GIANT_REQUIRED; - - /* Look for a directly-attached child */ - child = device_find_child(sc->dev, classname, -1); - if (child != NULL) - goto found; - - /* Look for the first matching ChipCommon child */ - if ((chipc = bhnd_find_chipc(sc)) == NULL) { - device_printf(sc->dev, - "chipc unavailable; cannot locate %s\n", classname); - return (NULL); - } - - child = device_find_child(chipc, classname, -1); - if (child != NULL) - goto found; - - /* Look for a parent-attached device (e.g. nexus0 -> bhnd_nvram) */ - child = device_find_child(device_get_parent(sc->dev), classname, -1); - if (child == NULL) - return (NULL); - -found: - if (device_get_state(child) < DS_ATTACHING) - return (NULL); - - return (child); -} - -/* Locate the PMU device, if any */ -static device_t -bhnd_find_pmu(struct bhnd_softc *sc) -{ - /* Make sure we're holding Giant for newbus */ - GIANT_REQUIRED; - - /* pmu_dev is initialized during attachment */ - if (sc->attach_done) { - if (sc->pmu_dev == NULL) - return (NULL); - - if (device_get_state(sc->pmu_dev) < DS_ATTACHING) - return (NULL); - - return (sc->pmu_dev); - } - - - return (bhnd_find_platform_dev(sc, "bhnd_pmu")); -} - -/* Locate the NVRAM device, if any */ -static device_t -bhnd_find_nvram(struct bhnd_softc *sc) -{ - struct chipc_caps *ccaps; - - /* Make sure we're holding Giant for newbus */ - GIANT_REQUIRED; - - - /* nvram_dev is initialized during attachment */ - if (sc->attach_done) { - if (sc->nvram_dev == NULL) - return (NULL); - - if (device_get_state(sc->nvram_dev) < DS_ATTACHING) - return (NULL); - - return (sc->nvram_dev); - } - - if ((ccaps = bhnd_find_chipc_caps(sc)) == NULL) - return (NULL); - - if (ccaps->nvram_src == BHND_NVRAM_SRC_UNKNOWN) - return (NULL); - - return (bhnd_find_platform_dev(sc, "bhnd_nvram")); -} - -/* - * Ascending comparison of bhnd device's probe order. - */ -static int -compare_ascending_probe_order(const void *lhs, const void *rhs) -{ - device_t ldev, rdev; - int lorder, rorder; - - ldev = (*(const device_t *) lhs); - rdev = (*(const device_t *) rhs); - - lorder = BHND_BUS_GET_PROBE_ORDER(device_get_parent(ldev), ldev); - rorder = BHND_BUS_GET_PROBE_ORDER(device_get_parent(rdev), rdev); - - if (lorder < rorder) { - return (-1); - } else if (lorder > rorder) { - return (1); - } else { - return (0); - } -} - -/* - * Descending comparison of bhnd device's probe order. - */ -static int -compare_descending_probe_order(const void *lhs, const void *rhs) -{ - return (compare_ascending_probe_order(rhs, lhs)); -} - -/** * Default bhnd(4) bus driver implementation of BHND_BUS_GET_PROBE_ORDER(). * * This implementation determines probe ordering based on the device's class @@ -613,7 +347,7 @@ bhnd_generic_get_probe_order(device_t dev, device_t ch case BHND_DEVCLASS_EROM: case BHND_DEVCLASS_OTHER: case BHND_DEVCLASS_INVALID: - if (bhnd_find_hostb_device(dev) == child) + if (bhnd_bus_find_hostb_device(dev) == child) return (BHND_PROBE_ROOT + BHND_PROBE_ORDER_EARLY); return (BHND_PROBE_DEFAULT); @@ -630,7 +364,6 @@ bhnd_generic_alloc_pmu(device_t dev, device_t child) { struct bhnd_softc *sc; struct bhnd_resource *br; - struct chipc_caps *ccaps; struct bhnd_core_pmu_info *pm; struct resource_list *rl; struct resource_list_entry *rle; @@ -646,18 +379,6 @@ bhnd_generic_alloc_pmu(device_t dev, device_t child) pm = bhnd_get_pmu_info(child); pmu_regs = BHND_CLK_CTL_ST; - if ((ccaps = bhnd_find_chipc_caps(sc)) == NULL) { - device_printf(sc->dev, "alloc_pmu failed: chipc " - "capabilities unavailable\n"); - return (ENXIO); - } - - if ((pmu_dev = bhnd_find_pmu(sc)) == NULL) { - device_printf(sc->dev, - "pmu unavailable; cannot allocate request state\n"); - return (ENXIO); - } - /* already allocated? */ if (pm != NULL) { panic("duplicate PMU allocation for %s", @@ -719,23 +440,34 @@ bhnd_generic_alloc_pmu(device_t dev, device_t child) else pmu_regs -= r_addr - rman_get_start(rle->res); + /* Retain PMU reference on behalf of our caller */ + pmu_dev = bhnd_retain_provider(child, BHND_SERVICE_PMU); + if (pmu_dev == NULL) { + device_printf(sc->dev, + "pmu unavailable; cannot allocate request state\n"); + return (ENXIO); + } + /* Allocate and initialize PMU info */ br = malloc(sizeof(struct bhnd_resource), M_BHND, M_NOWAIT); - if (br == NULL) + if (br == NULL) { + bhnd_release_provider(child, pmu_dev, BHND_SERVICE_PMU); return (ENOMEM); + } br->res = rle->res; br->direct = ((rman_get_flags(rle->res) & RF_ACTIVE) != 0); pm = malloc(sizeof(*pm), M_BHND, M_NOWAIT); if (pm == NULL) { + bhnd_release_provider(child, pmu_dev, BHND_SERVICE_PMU); free(br, M_BHND); return (ENOMEM); } pm->pm_dev = child; - pm->pm_pmu = pmu_dev; pm->pm_res = br; pm->pm_regs = pmu_regs; + pm->pm_pmu = pmu_dev; bhnd_set_pmu_info(child, pm); return (0); @@ -749,29 +481,24 @@ bhnd_generic_release_pmu(device_t dev, device_t child) { struct bhnd_softc *sc; struct bhnd_core_pmu_info *pm; - device_t pmu; int error; GIANT_REQUIRED; /* for newbus */ sc = device_get_softc(dev); - if ((pmu = bhnd_find_pmu(sc)) == NULL) { - device_printf(sc->dev, - "pmu unavailable; cannot release request state\n"); - return (ENXIO); - } - /* dispatch release request */ pm = bhnd_get_pmu_info(child); if (pm == NULL) panic("pmu over-release for %s", device_get_nameunit(child)); - if ((error = BHND_PMU_CORE_RELEASE(pmu, pm))) + if ((error = BHND_PMU_CORE_RELEASE(pm->pm_pmu, pm))) return (error); /* free PMU info */ bhnd_set_pmu_info(child, NULL); + + bhnd_release_provider(pm->pm_dev, pm->pm_pmu, BHND_SERVICE_PMU); free(pm->pm_res, M_BHND); free(pm, M_BHND); @@ -875,9 +602,9 @@ bhnd_generic_is_region_valid(device_t dev, device_t ch /** * Default bhnd(4) bus driver implementation of BHND_BUS_GET_NVRAM_VAR(). * - * This implementation searches @p dev for a usable NVRAM child device. + * This implementation searches @p dev for a registered NVRAM child device. * - * If no usable child device is found on @p dev, the request is delegated to + * If no NVRAM device is registered with @p dev, the request is delegated to * the BHND_BUS_GET_NVRAM_VAR() method on the parent of @p dev. */ int @@ -886,12 +613,17 @@ bhnd_generic_get_nvram_var(device_t dev, device_t chil { struct bhnd_softc *sc; device_t nvram, parent; + int error; sc = device_get_softc(dev); /* If a NVRAM device is available, consult it first */ - if ((nvram = bhnd_find_nvram(sc)) != NULL) - return BHND_NVRAM_GETVAR(nvram, name, buf, size, type); + nvram = bhnd_retain_provider(child, BHND_SERVICE_NVRAM); + if (nvram != NULL) { + error = BHND_NVRAM_GETVAR(nvram, name, buf, size, type); + bhnd_release_provider(child, nvram, BHND_SERVICE_NVRAM); + return (error); + } /* Otherwise, try to delegate to parent */ if ((parent = device_get_parent(dev)) == NULL) @@ -1046,15 +778,6 @@ bhnd_generic_child_deleted(device_t dev, device_t chil panic("%s leaked device pmu state\n", device_get_nameunit(child)); } - - /* Clean up platform device references */ - if (sc->chipc_dev == child) { - sc->chipc_dev = NULL; - } else if (sc->nvram_dev == child) { - sc->nvram_dev = NULL; - } else if (sc->pmu_dev == child) { - sc->pmu_dev = NULL; - } } /** @@ -1176,7 +899,6 @@ static device_method_t bhnd_methods[] = { DEVMETHOD(device_resume, bhnd_generic_resume), /* Bus interface */ - DEVMETHOD(bus_new_pass, bhnd_new_pass), DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted), DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch), DEVMETHOD(bus_print_child, bhnd_generic_print_child), Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Wed Sep 27 19:22:10 2017 (r324069) +++ head/sys/dev/bhnd/bhnd.h Wed Sep 27 19:44:23 2017 (r324070) @@ -1,7 +1,11 @@ /*- - * Copyright (c) 2015 Landon Fuller + * Copyright (c) 2015-2016 Landon Fuller + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Landon Fuller + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -32,8 +36,10 @@ #ifndef _BHND_BHND_H_ #define _BHND_BHND_H_ -#include +#include #include +#include +#include #include @@ -289,6 +295,35 @@ struct bhnd_device { #define BHND_DEVICE_IS_END(_d) \ (BHND_MATCH_IS_ANY(&(_d)->core) && (_d)->desc == NULL) +/** + * bhnd device sort order. + */ +typedef enum { + BHND_DEVICE_ORDER_ATTACH, /**< sort by bhnd(4) device attach order; + child devices should be probed/attached + in this order */ + BHND_DEVICE_ORDER_DETACH, /**< sort by bhnd(4) device detach order; + child devices should be detached, suspended, + and shutdown in this order */ +} bhnd_device_order; + +/** + * A registry of bhnd service providers. + */ +struct bhnd_service_registry { + STAILQ_HEAD(,bhnd_service_entry) entries; /**< registered services */ + struct mtx lock; /**< state lock */ +}; + +/** + * bhnd service provider flags. + */ +enum { + BHND_SPF_INHERITED = (1<<0), /**< service provider reference was inherited from + a parent bus, and should be deregistered when the + last active reference is released */ +}; + const char *bhnd_vendor_name(uint16_t vendor); const char *bhnd_port_type_name(bhnd_port_type port_type); const char *bhnd_nvram_src_name(bhnd_nvram_src nvram_src); @@ -304,12 +339,23 @@ bhnd_devclass_t bhnd_core_class(const struct bhnd_c int bhnd_format_chip_id(char *buffer, size_t size, uint16_t chip_id); -device_t bhnd_match_child(device_t dev, +device_t bhnd_bus_match_child(device_t bus, const struct bhnd_core_match *desc); -device_t bhnd_find_child(device_t dev, +device_t bhnd_bus_find_child(device_t bus, bhnd_devclass_t class, int unit); +int bhnd_bus_get_children(device_t bus, + device_t **devlistp, int *devcountp, + bhnd_device_order order); + +void bhnd_bus_free_children(device_t *devlist); + +int bhnd_bus_probe_children(device_t bus); + +int bhnd_sort_devices(device_t *devlist, + size_t devcount, bhnd_device_order order); + device_t bhnd_find_bridge_root(device_t dev, devclass_t bus_class); @@ -410,6 +456,51 @@ int bhnd_nvram_getvar_array(device_t dev, const char *name, void *buf, size_t count, bhnd_nvram_type type); +int bhnd_service_registry_init( + struct bhnd_service_registry *bsr); +int bhnd_service_registry_fini( + struct bhnd_service_registry *bsr); +int bhnd_service_registry_add( + struct bhnd_service_registry *bsr, + device_t provider, + bhnd_service_t service, + uint32_t flags); +int bhnd_service_registry_remove( + struct bhnd_service_registry *bsr, + device_t provider, + bhnd_service_t service); +device_t bhnd_service_registry_retain( + struct bhnd_service_registry *bsr, + bhnd_service_t service); +bool bhnd_service_registry_release( + struct bhnd_service_registry *bsr, + device_t provider, + bhnd_service_t service); + +int bhnd_bus_generic_register_provider( + device_t dev, device_t child, + device_t provider, bhnd_service_t service); +int bhnd_bus_generic_deregister_provider( + device_t dev, device_t child, + device_t provider, bhnd_service_t service); +device_t bhnd_bus_generic_retain_provider(device_t dev, + device_t child, bhnd_service_t service); +void bhnd_bus_generic_release_provider(device_t dev, + device_t child, device_t provider, + bhnd_service_t service); + +int bhnd_bus_generic_sr_register_provider( + device_t dev, device_t child, + device_t provider, bhnd_service_t service); +int bhnd_bus_generic_sr_deregister_provider( + device_t dev, device_t child, + device_t provider, bhnd_service_t service); +device_t bhnd_bus_generic_sr_retain_provider(device_t dev, + device_t child, bhnd_service_t service); +void bhnd_bus_generic_sr_release_provider(device_t dev, + device_t child, device_t provider, + bhnd_service_t service); + bool bhnd_bus_generic_is_hw_disabled(device_t dev, device_t child); bool bhnd_bus_generic_is_region_valid(device_t dev, @@ -458,8 +549,82 @@ bhnd_driver_get_erom_class(driver_t *driver) * @param dev A bhnd bus device. */ static inline device_t -bhnd_find_hostb_device(device_t dev) { +bhnd_bus_find_hostb_device(device_t dev) { return (BHND_BUS_FIND_HOSTB_DEVICE(dev)); +} + +/** + * Register a provider for a given @p service. + * + * @param dev The device to register as a service provider + * with its parent bus. + * @param service The service for which @p dev will be registered. + * + * @retval 0 success + * @retval EEXIST if an entry for @p service already exists. + * @retval non-zero if registering @p dev otherwise fails, a regular + * unix error code will be returned. + */ +static inline int +bhnd_register_provider(device_t dev, bhnd_service_t service) +{ + return (BHND_BUS_REGISTER_PROVIDER(device_get_parent(dev), dev, dev, + service)); +} + + /** + * Attempt to remove a service provider registration for @p dev. + * + * @param dev The device to be deregistered as a service provider. + * @param service The service for which @p dev will be deregistered, or + * BHND_SERVICE_INVALID to remove all service registrations + * for @p dev. + * + * @retval 0 success + * @retval EBUSY if active references to @p dev exist; @see + * bhnd_retain_provider() and bhnd_release_provider(). + */ +static inline int +bhnd_deregister_provider(device_t dev, bhnd_service_t service) +{ + return (BHND_BUS_DEREGISTER_PROVIDER(device_get_parent(dev), dev, dev, + service)); +} + +/** + * Retain and return a reference to the registered @p service provider, if any. + * + * @param dev The requesting device. + * @param service The service for which a provider should be returned. + * + * On success, the caller assumes ownership the returned provider, and + * is responsible for releasing this reference via + * BHND_BUS_RELEASE_PROVIDER(). + * + * @retval device_t success + * @retval NULL if no provider is registered for @p service. + */ +static inline device_t +bhnd_retain_provider(device_t dev, bhnd_service_t service) +{ + return (BHND_BUS_RETAIN_PROVIDER(device_get_parent(dev), dev, + service)); +} + +/** + * Release a reference to a provider device previously returned by + * bhnd_retain_provider(). + * + * @param dev The requesting device. + * @param provider The provider to be released. + * @param service The service for which @p provider was previously retained. + */ +static inline void +bhnd_release_provider(device_t dev, device_t provider, + bhnd_service_t service) +{ + return (BHND_BUS_RELEASE_PROVIDER(device_get_parent(dev), dev, + provider, service)); } /** Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Wed Sep 27 19:22:10 2017 (r324069) +++ head/sys/dev/bhnd/bhnd_bus_if.m Wed Sep 27 19:44:23 2017 (r324070) @@ -1,7 +1,11 @@ #- # Copyright (c) 2015-2016 Landon Fuller +# Copyright (c) 2017 The FreeBSD Foundation # All rights reserved. # +# Portions of this software were developed by Landon Fuller +# under sponsorship from the FreeBSD Foundation. +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: @@ -221,6 +225,12 @@ CODE { return (NULL); } + static struct bhnd_service_registry * + bhnd_bus_null_get_service_registry(device_t dev) + { + panic("bhnd_bus_get_service_registry unimplemented"); + } + static bool bhnd_bus_null_is_hw_disabled(device_t dev, device_t child) { @@ -272,6 +282,100 @@ CODE { STATICMETHOD bhnd_erom_class_t * get_erom_class { driver_t *driver; } DEFAULT bhnd_bus_null_get_erom_class; + +/** + * Register a shared bus @p provider for a given @p service. + * + * @param dev The parent of @p child. + * @param child The requesting child device. + * @param provider The service provider to register. + * @param service The service for which @p provider will be registered. + * + * @retval 0 success + * @retval EEXIST if an entry for @p service already exists. + * @retval non-zero if registering @p provider otherwise fails, a regular + * unix error code will be returned. + */ +METHOD int register_provider { + device_t dev; + device_t child; + device_t provider; + bhnd_service_t service; +} DEFAULT bhnd_bus_generic_register_provider; + + /** + * Attempt to remove the @p service provider registration for @p provider. + * + * @param dev The parent of @p child. + * @param child The requesting child device. + * @param provider The service provider to be deregistered. + * @param service The service for which @p provider will be deregistered, + * or BHND_SERVICE_INVALID to remove all service + * registrations for @p provider. + * + * @retval 0 success + * @retval EBUSY if active references to @p provider exist; @see + * BHND_BUS_RETAIN_PROVIDER() and + * BHND_BUS_RELEASE_PROVIDER(). + */ +METHOD int deregister_provider { + device_t dev; + device_t child; + device_t provider; + bhnd_service_t service; +} DEFAULT bhnd_bus_generic_deregister_provider; + +/** + * Retain and return a reference to the registered @p service provider, if any. + * + * @param dev The parent of @p child. + * @param child The requesting child device. + * @param service The service for which a provider should be returned. + * + * On success, the caller assumes ownership the returned provider, and + * is responsible for releasing this reference via + * BHND_BUS_RELEASE_PROVIDER(). + * + * @retval device_t success + * @retval NULL if no provider is registered for @p service. + */ +METHOD device_t retain_provider { + device_t dev; + device_t child; + bhnd_service_t service; +} DEFAULT bhnd_bus_generic_retain_provider; + + /** + * Release a reference to a service provider previously returned by + * BHND_BUS_RETAIN_PROVIDER(). + * + * @param dev The parent of @p child. + * @param child The requesting child device. + * @param provider The provider to be released. + * @param service The service for which @p provider was previously + * retained. + */ +METHOD void release_provider { + device_t dev; + device_t child; + device_t provider; + bhnd_service_t service; +} DEFAULT bhnd_bus_generic_release_provider; + +/** + * Return a struct bhnd_service_registry. + * + * Used by drivers which use bhnd_bus_generic_sr_register_provider() etc. + * to implement service provider registration. It should return a service + * registry that may be used to resolve provider requests from @p child. + * + * @param dev The parent of @p child. + * @param child The requesting child device. + */ +METHOD struct bhnd_service_registry * get_service_registry { + device_t dev; + device_t child; +} DEFAULT bhnd_bus_null_get_service_registry; /** * Return the active host bridge core for the bhnd bus, if any. Added: head/sys/dev/bhnd/bhnd_private.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/bhnd_private.h Wed Sep 27 19:44:23 2017 (r324070) @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2017 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Landon Fuller under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Sep 27 19:48:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 472E5E0DC8A; Wed, 27 Sep 2017 19:48:36 +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 0A677845D5; Wed, 27 Sep 2017 19:48:35 +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 v8RJmZpW022371; Wed, 27 Sep 2017 19:48:35 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RJmYpD022365; Wed, 27 Sep 2017 19:48:34 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201709271948.v8RJmYpD022365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Wed, 27 Sep 2017 19:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324071 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/siba mips/broadcom modules/bhnd/bhndb_pci X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/siba mips/broadcom modules/bhnd/bhndb_pci X-SVN-Commit-Revision: 324071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 19:48:36 -0000 Author: landonf Date: Wed Sep 27 19:48:34 2017 New Revision: 324071 URL: https://svnweb.freebsd.org/changeset/base/324071 Log: bhnd: Add support for supplying bus I/O callbacks when initializing an EROM parser. This allows us to use the EROM parser API in cases where the standard bus space I/O APIs are unsuitable. In particular, this will allow us to parse the device enumeration table directly from bhndb(4) drivers, prior to full attach and configuration of the bridge. Approved by: adrian (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12510 Added: head/sys/dev/bhnd/bhnd_eromvar.h (contents, props changed) Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_erom.c head/sys/dev/bhnd/bhnd_erom.c head/sys/dev/bhnd/bhnd_erom.h head/sys/dev/bhnd/bhnd_erom_if.m head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_pci.c head/sys/dev/bhnd/bhndb/bhndb_pcivar.h head/sys/dev/bhnd/bhndb/bhndb_private.h head/sys/dev/bhnd/bhndb/bhndb_subr.c head/sys/dev/bhnd/bhndb/bhndbvar.h head/sys/dev/bhnd/bhndreg.h head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_erom.c head/sys/mips/broadcom/bcm_machdep.c head/sys/mips/broadcom/bcm_machdep.h head/sys/modules/bhnd/bhndb_pci/Makefile Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Wed Sep 27 19:44:23 2017 (r324070) +++ head/sys/dev/bhnd/bcma/bcma.c Wed Sep 27 19:48:34 2017 (r324071) @@ -686,6 +686,7 @@ bcma_add_children(device_t bus) { bhnd_erom_t *erom; struct bcma_erom *bcma_erom; + struct bhnd_erom_io *eio; const struct bhnd_chipid *cid; struct bcma_corecfg *corecfg; struct bcma_devinfo *dinfo; @@ -696,9 +697,12 @@ bcma_add_children(device_t bus) corecfg = NULL; /* Allocate our EROM parser */ - erom = bhnd_erom_alloc(&bcma_erom_parser, cid, bus, BCMA_EROM_RID); - if (erom == NULL) + eio = bhnd_erom_iores_new(bus, BCMA_EROM_RID); + erom = bhnd_erom_alloc(&bcma_erom_parser, cid, eio); + if (erom == NULL) { + bhnd_erom_io_fini(eio); return (ENODEV); + } /* Add all cores. */ bcma_erom = (struct bcma_erom *)erom; Modified: head/sys/dev/bhnd/bcma/bcma_erom.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_erom.c Wed Sep 27 19:44:23 2017 (r324070) +++ head/sys/dev/bhnd/bcma/bcma_erom.c Wed Sep 27 19:48:34 2017 (r324071) @@ -1,7 +1,11 @@ /*- - * Copyright (c) 2015 Landon Fuller + * Copyright (c) 2015-2017 Landon Fuller + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Landon Fuller + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -58,13 +62,8 @@ __FBSDID("$FreeBSD$"); * marker. */ -struct bcma_erom_io; - static const char *bcma_erom_entry_type_name (uint8_t entry); -static uint32_t bcma_eio_read4(struct bcma_erom_io *io, - bus_size_t offset); - static int bcma_erom_read32(struct bcma_erom *erom, uint32_t *entry); static int bcma_erom_skip32(struct bcma_erom *erom); @@ -105,37 +104,18 @@ static void bcma_erom_to_core_info(const struct bcma struct bhnd_core_info *info); /** - * BCMA EROM generic I/O context - */ -struct bcma_erom_io { - struct bhnd_resource *res; /**< memory resource, or NULL if initialized - with bus space tag and handle */ - int rid; /**< memory resource id, or -1 */ - - bus_space_tag_t bst; /**< bus space tag, if any */ - bus_space_handle_t bsh; /**< bus space handle, if any */ - - bus_size_t start; /**< base read offset */ -}; - -/** * BCMA EROM per-instance state. */ struct bcma_erom { - struct bhnd_erom obj; - device_t dev; /**< parent device, or NULL if none. */ - struct bcma_erom_io io; /**< I/O context */ - bus_size_t offset; /**< current read offset */ + struct bhnd_erom obj; + device_t dev; /**< parent device, or NULL if none. */ + struct bhnd_erom_io *eio; /**< bus I/O callbacks */ + bhnd_size_t offset; /**< current read offset */ }; -#define EROM_LOG(erom, fmt, ...) do { \ - if (erom->dev != NULL) { \ - device_printf(erom->dev, "erom[0x%llx]: " fmt, \ - (unsigned long long) (erom->offset), ##__VA_ARGS__);\ - } else { \ - printf("erom[0x%llx]: " fmt, \ - (unsigned long long) (erom->offset), ##__VA_ARGS__);\ - } \ +#define EROM_LOG(erom, fmt, ...) do { \ + printf("%s erom[0x%llx]: " fmt, __FUNCTION__, \ + (unsigned long long)(erom->offset), ##__VA_ARGS__); \ } while(0) /** Return the type name for an EROM entry */ @@ -154,106 +134,52 @@ bcma_erom_entry_type_name (uint8_t entry) } } - -/** - * Read a 32-bit value from an EROM I/O context. - * - * @param io EROM I/O context. - * @param offset Read offset. - */ -static uint32_t -bcma_eio_read4(struct bcma_erom_io *io, bus_size_t offset) -{ - bus_size_t read_off; - - read_off = io->start + offset; - if (io->res != NULL) - return (bhnd_bus_read_4(io->res, read_off)); - else - return (bus_space_read_4(io->bst, io->bsh, read_off)); -} - -/* Initialize bcma_erom resource I/O context */ -static void -bcma_eio_init(struct bcma_erom_io *io, struct bhnd_resource *res, int rid, - bus_size_t offset) -{ - io->res = res; - io->rid = rid; - io->start = offset; -} - -/* Initialize bcma_erom bus space I/O context */ -static void -bcma_eio_init_static(struct bcma_erom_io *io, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_size_t offset) -{ - io->res = NULL; - io->rid = -1; - io->bst = bst; - io->bsh = bsh; - io->start = offset; -} - /* BCMA implementation of BHND_EROM_INIT() */ static int bcma_erom_init(bhnd_erom_t *erom, const struct bhnd_chipid *cid, - device_t parent, int rid) + struct bhnd_erom_io *eio) { struct bcma_erom *sc; - struct bhnd_resource *res; + bhnd_addr_t table_addr; + int error; sc = (struct bcma_erom *)erom; - sc->dev = parent; + sc->eio = eio; sc->offset = 0; - res = bhnd_alloc_resource(parent, SYS_RES_MEMORY, &rid, cid->enum_addr, - cid->enum_addr + BCMA_EROM_TABLE_SIZE - 1, BCMA_EROM_TABLE_SIZE, - RF_ACTIVE|RF_SHAREABLE); + /* Determine erom table address */ + if (BHND_ADDR_MAX - BCMA_EROM_TABLE_START < cid->enum_addr) + return (ENXIO); /* would overflow */ - if (res == NULL) - return (ENOMEM); + table_addr = cid->enum_addr + BCMA_EROM_TABLE_START; - bcma_eio_init(&sc->io, res, rid, BCMA_EROM_TABLE_START); + /* Try to map the erom table */ + error = bhnd_erom_io_map(sc->eio, table_addr, BCMA_EROM_TABLE_SIZE); + if (error) + return (error); return (0); } -/* BCMA implementation of BHND_EROM_INIT_STATIC() */ +/* BCMA implementation of BHND_EROM_PROBE() */ static int -bcma_erom_init_static(bhnd_erom_t *erom, const struct bhnd_chipid *cid, - bus_space_tag_t bst, bus_space_handle_t bsh) +bcma_erom_probe(bhnd_erom_class_t *cls, struct bhnd_erom_io *eio, + const struct bhnd_chipid *hint, struct bhnd_chipid *cid) { - struct bcma_erom *sc; + uint32_t idreg, eromptr; - sc = (struct bcma_erom *)erom; - sc->dev = NULL; - sc->offset = 0; - - bcma_eio_init_static(&sc->io, bst, bsh, BCMA_EROM_TABLE_START); - - return (0); -} - -/* Common implementation of BHND_EROM_PROBE/BHND_EROM_PROBE_STATIC */ -static int -bcma_erom_probe_common(struct bcma_erom_io *io, const struct bhnd_chipid *hint, - struct bhnd_chipid *cid) -{ - uint32_t idreg, eromptr; - /* Hints aren't supported; all BCMA devices have a ChipCommon * core */ if (hint != NULL) return (EINVAL); - /* Confirm CHIPC_EROMPTR availability */ - idreg = bcma_eio_read4(io, CHIPC_ID); + /* Confirm CHIPC_EROMPTR availability */ + idreg = bhnd_erom_io_read(eio, CHIPC_ID, 4); if (!BHND_CHIPTYPE_HAS_EROM(CHIPC_GET_BITS(idreg, CHIPC_ID_BUS))) return (ENXIO); /* Fetch EROM address */ - eromptr = bcma_eio_read4(io, CHIPC_EROMPTR); + eromptr = bhnd_erom_io_read(eio, CHIPC_EROMPTR, 4); /* Parse chip identifier */ *cid = bhnd_parse_chipid(idreg, eromptr); @@ -272,42 +198,12 @@ bcma_erom_probe_common(struct bcma_erom_io *io, const } } -static int -bcma_erom_probe(bhnd_erom_class_t *cls, struct bhnd_resource *res, - bus_size_t offset, const struct bhnd_chipid *hint, struct bhnd_chipid *cid) -{ - struct bcma_erom_io io; - - bcma_eio_init(&io, res, rman_get_rid(res->res), - offset + BCMA_EROM_TABLE_START); - - return (bcma_erom_probe_common(&io, hint, cid)); -} - -static int -bcma_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_addr_t paddr, const struct bhnd_chipid *hint, - struct bhnd_chipid *cid) -{ - struct bcma_erom_io io; - - bcma_eio_init_static(&io, bst, bsh, BCMA_EROM_TABLE_START); - return (bcma_erom_probe_common(&io, hint, cid)); -} - - static void bcma_erom_fini(bhnd_erom_t *erom) { struct bcma_erom *sc = (struct bcma_erom *)erom; - if (sc->io.res != NULL) { - bhnd_release_resource(sc->dev, SYS_RES_MEMORY, sc->io.rid, - sc->io.res); - - sc->io.res = NULL; - sc->io.rid = -1; - } + bhnd_erom_io_fini(sc->eio); } static int @@ -591,8 +487,8 @@ bcma_erom_peek32(struct bcma_erom *erom, uint32_t *ent EROM_LOG(erom, "BCMA EROM table missing terminating EOF\n"); return (EINVAL); } - - *entry = bcma_eio_read4(&erom->io, erom->offset); + + *entry = bhnd_erom_io_read(erom->eio, erom->offset, 4); return (0); } @@ -1520,9 +1416,7 @@ bcma_erom_dump(bhnd_erom_t *erom) static kobj_method_t bcma_erom_methods[] = { KOBJMETHOD(bhnd_erom_probe, bcma_erom_probe), - KOBJMETHOD(bhnd_erom_probe_static, bcma_erom_probe_static), KOBJMETHOD(bhnd_erom_init, bcma_erom_init), - KOBJMETHOD(bhnd_erom_init_static, bcma_erom_init_static), KOBJMETHOD(bhnd_erom_fini, bcma_erom_fini), KOBJMETHOD(bhnd_erom_get_core_table, bcma_erom_get_core_table), KOBJMETHOD(bhnd_erom_free_core_table, bcma_erom_free_core_table), Modified: head/sys/dev/bhnd/bhnd_erom.c ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.c Wed Sep 27 19:44:23 2017 (r324070) +++ head/sys/dev/bhnd/bhnd_erom.c Wed Sep 27 19:48:34 2017 (r324071) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2016 Landon Fuller + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Landon Fuller + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -31,20 +35,124 @@ __FBSDID("$FreeBSD$"); #include +#include #include + +#include +#include +#include #include #include +#include +static int bhnd_erom_iores_map(struct bhnd_erom_io *eio, bhnd_addr_t addr, + bhnd_size_t size); +static uint32_t bhnd_erom_iores_read(struct bhnd_erom_io *eio, + bhnd_size_t offset, u_int width); +static void bhnd_erom_iores_fini(struct bhnd_erom_io *eio); + +static int bhnd_erom_iobus_map(struct bhnd_erom_io *eio, bhnd_addr_t addr, + bhnd_size_t size); +static uint32_t bhnd_erom_iobus_read(struct bhnd_erom_io *eio, + bhnd_size_t offset, u_int width); + /** + * An implementation of bhnd_erom_io that manages mappings via + * bhnd_alloc_resource() and bhnd_release_resource(). + */ +struct bhnd_erom_iores { + struct bhnd_erom_io eio; + device_t owner; /**< device from which we'll allocate resources */ + int owner_rid; /**< rid to use when allocating new mappings */ + struct bhnd_resource *mapped; /**< current mapping, or NULL */ + int mapped_rid; /**< resource ID of current mapping, or -1 */ +}; + +/** + * Fetch the device enumeration parser class from all bhnd(4)-compatible drivers + * registered for @p bus_devclass, probe @p eio for supporting parser classes, + * and return the best available supporting enumeration parser class. + * + * @param bus_devclass The bus device class to be queried for + * bhnd(4)-compatible drivers. + * @param eio An erom bus I/O instance, configured with a + * mapping of the first bus core. + * @param hint Identification hint used to identify the device. + * If the chipset supports standard chip + * identification registers within the first core, + * this parameter should be NULL. + * @param[out] cid On success, the probed chip identifier. + * + * @retval non-NULL on success, the best available EROM class. + * @retval NULL if no erom class returned a successful probe result for + * @p eio. + */ +bhnd_erom_class_t * +bhnd_erom_probe_driver_classes(devclass_t bus_devclass, + struct bhnd_erom_io *eio, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) +{ + driver_t **drivers; + int drv_count; + bhnd_erom_class_t *erom_cls; + int error, prio, result; + + erom_cls = NULL; + prio = 0; + + /* Fetch all available drivers */ + error = devclass_get_drivers(bus_devclass, &drivers, &drv_count); + if (error) { + printf("error fetching bhnd(4) drivers for %s: %d\n", + devclass_get_name(bus_devclass), error); + return (NULL); + } + + /* Enumerate the drivers looking for the best available EROM class */ + for (int i = 0; i < drv_count; i++) { + struct bhnd_chipid pcid; + bhnd_erom_class_t *cls; + + /* The default implementation of BHND_BUS_GET_EROM_CLASS() + * returns NULL if unimplemented; this should always be safe + * to call on arbitrary drivers */ + cls = bhnd_driver_get_erom_class(drivers[i]); + if (cls == NULL) + continue; + + kobj_class_compile(cls); + + /* Probe the bus */ + result = bhnd_erom_probe(cls, eio, hint, &pcid); + + /* The parser did not match if an error was returned */ + if (result > 0) + continue; + + /* Check for a new highest priority match */ + if (erom_cls == NULL || result > prio) { + prio = result; + + *cid = pcid; + erom_cls = cls; + } + + /* Terminate immediately on BUS_PROBE_SPECIFIC */ + if (result == BUS_PROBE_SPECIFIC) + break; + } + + return (erom_cls); +} + +/** * Allocate and return a new device enumeration table parser. * * @param cls The parser class for which an instance will be * allocated. - * @param parent The parent device from which EROM resources should - * be allocated. - * @param rid The resource ID to be used when allocating EROM - * resources. + * @param eio The bus I/O callbacks to use when reading the device + * enumeration table. * @param cid The device's chip identifier. * * @retval non-NULL success @@ -53,7 +161,7 @@ __FBSDID("$FreeBSD$"); */ bhnd_erom_t * bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct bhnd_chipid *cid, - device_t parent, int rid) + struct bhnd_erom_io *eio) { bhnd_erom_t *erom; int error; @@ -61,10 +169,9 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct b erom = (bhnd_erom_t *)kobj_create((kobj_class_t)cls, M_BHND, M_WAITOK|M_ZERO); - if ((error = BHND_EROM_INIT(erom, cid, parent, rid))) { - printf("error initializing %s parser at %#jx with " - "rid %d: %d\n", cls->name, (uintmax_t)cid->enum_addr, rid, - error); + if ((error = BHND_EROM_INIT(erom, cid, eio))) { + printf("error initializing %s parser at %#jx: %d\n", cls->name, + (uintmax_t)cid->enum_addr, error); kobj_delete((kobj_t)erom, M_BHND); return (NULL); @@ -74,8 +181,7 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct b } /** - * Perform static initialization of aa device enumeration table parser using - * the provided bus space tag and handle. + * Perform static initialization of a device enumeration table parser. * * This may be used to initialize a caller-allocated erom instance state * during early boot, prior to malloc availability. @@ -87,9 +193,8 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct b * @p erom. If this is less than is required by @p cls, * ENOMEM will be returned. * @param cid The device's chip identifier. - * @param bst Bus space tag. - * @param bsh Bus space handle mapping the device enumeration - * space. + * @param eio The bus I/O callbacks to use when reading the device + * enumeration table. * * @retval 0 success * @retval ENOMEM if @p esize is smaller than required by @p cls. @@ -98,7 +203,7 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct b */ int bhnd_erom_init_static(bhnd_erom_class_t *cls, bhnd_erom_t *erom, size_t esize, - const struct bhnd_chipid *cid, bus_space_tag_t bst, bus_space_handle_t bsh) + const struct bhnd_chipid *cid, struct bhnd_erom_io *eio) { kobj_class_t kcls; @@ -110,7 +215,7 @@ bhnd_erom_init_static(bhnd_erom_class_t *cls, bhnd_ero /* Perform instance initialization */ kobj_init_static((kobj_t)erom, kcls); - return (BHND_EROM_INIT_STATIC(erom, cid, bst, bsh)); + return (BHND_EROM_INIT(erom, cid, eio)); } /** @@ -138,4 +243,244 @@ bhnd_erom_free(bhnd_erom_t *erom) { BHND_EROM_FINI(erom); kobj_delete((kobj_t)erom, M_BHND); +} + + +/** + * Attempt to map @p size bytes at @p addr, replacing any existing + * @p eio mapping. + * + * @param eio I/O instance state. + * @param addr The address to be mapped. + * @param size The number of bytes to be mapped at @p addr. + * + * @retval 0 success + * @retval non-zero if mapping @p addr otherwise fails, a regular + * unix error code should be returned. + */ +int +bhnd_erom_io_map(struct bhnd_erom_io *eio, bhnd_addr_t addr, bhnd_size_t size) +{ + return (eio->map(eio, addr, size)); +} + +/** + * Read a 1, 2, or 4 byte data item from @p eio, at the given @p offset + * relative to @p eio's current mapping. + * + * @param eio erom I/O callbacks + * @param offset read offset. + * @param width item width (1, 2, or 4 bytes). + */ +uint32_t +bhnd_erom_io_read(struct bhnd_erom_io *eio, bhnd_size_t offset, u_int width) +{ + return (eio->read(eio, offset, width)); +} + +/** + * Free all resources held by @p eio. + */ +void +bhnd_erom_io_fini(struct bhnd_erom_io *eio) +{ + if (eio->fini != NULL) + return (eio->fini(eio)); +} + +/** + * Allocate, initialize, and return a new I/O instance that will perform + * mapping by allocating SYS_RES_MEMORY resources from @p dev using @p rid. + * + * @param dev The device to pass to bhnd_alloc_resource() and + * bhnd_release_resource() functions. + * @param rid The resource ID to be used when allocating memory resources. + */ +struct bhnd_erom_io * +bhnd_erom_iores_new(device_t dev, int rid) +{ + struct bhnd_erom_iores *iores; + + iores = malloc(sizeof(*iores), M_BHND, M_WAITOK | M_ZERO); + iores->eio.map = bhnd_erom_iores_map; + iores->eio.read = bhnd_erom_iores_read; + iores->eio.fini = bhnd_erom_iores_fini; + + iores->owner = dev; + iores->owner_rid = rid; + iores->mapped = NULL; + iores->mapped_rid = -1; + + return (&iores->eio); +} + +static int +bhnd_erom_iores_map(struct bhnd_erom_io *eio, bhnd_addr_t addr, + bhnd_size_t size) +{ + struct bhnd_erom_iores *iores; + + iores = (struct bhnd_erom_iores *)eio; + + /* Sanity check the addr/size */ + if (size == 0) + return (EINVAL); + + if (BHND_ADDR_MAX - size < addr) + return (EINVAL); /* would overflow */ + + /* Check for an existing mapping */ + if (iores->mapped) { + /* If already mapped, nothing else to do */ + if (rman_get_start(iores->mapped->res) == addr && + rman_get_size(iores->mapped->res) == size) + { + return (0); + } + + /* Otherwise, we need to drop the existing mapping */ + bhnd_release_resource(iores->owner, SYS_RES_MEMORY, + iores->mapped_rid, iores->mapped); + iores->mapped = NULL; + iores->mapped_rid = -1; + } + + /* Try to allocate the new mapping */ + iores->mapped_rid = iores->owner_rid; + iores->mapped = bhnd_alloc_resource(iores->owner, SYS_RES_MEMORY, + &iores->mapped_rid, addr, addr+size-1, size, + RF_ACTIVE|RF_SHAREABLE); + if (iores->mapped == NULL) { + iores->mapped_rid = -1; + return (ENXIO); + } + + return (0); +} + +static uint32_t +bhnd_erom_iores_read(struct bhnd_erom_io *eio, bhnd_size_t offset, u_int width) +{ + struct bhnd_erom_iores *iores = (struct bhnd_erom_iores *)eio; + + if (iores->mapped == NULL) + panic("read with invalid mapping"); + + switch (width) { + case 1: + return (bhnd_bus_read_1(iores->mapped, offset)); + case 2: + return (bhnd_bus_read_2(iores->mapped, offset)); + case 4: + return (bhnd_bus_read_4(iores->mapped, offset)); + default: + panic("invalid width %u", width); + } +} + +static void +bhnd_erom_iores_fini(struct bhnd_erom_io *eio) +{ + struct bhnd_erom_iores *iores = (struct bhnd_erom_iores *)eio; + + /* Release any mapping */ + if (iores->mapped) { + bhnd_release_resource(iores->owner, SYS_RES_MEMORY, + iores->mapped_rid, iores->mapped); + iores->mapped = NULL; + iores->mapped_rid = -1; + } + + free(eio, M_BHND); +} + +/** + * Initialize an I/O instance that will perform mapping directly from the + * given bus space tag and handle. + * + * @param addr The base address mapped by @p bsh. + * @param size The total size mapped by @p bsh. + * @param bst Bus space tag for @p bsh. + * @param bsh Bus space handle mapping the full bus enumeration space. + * + * @retval 0 success + * @retval non-zero if initializing @p iobus otherwise fails, a regular + * unix error code will be returned. + */ +int +bhnd_erom_iobus_init(struct bhnd_erom_iobus *iobus, bhnd_addr_t addr, + bhnd_size_t size, bus_space_tag_t bst, bus_space_handle_t bsh) +{ + iobus->eio.map = bhnd_erom_iobus_map; + iobus->eio.read = bhnd_erom_iobus_read; + iobus->eio.fini = NULL; + + iobus->addr = addr; + iobus->size = size; + iobus->bst = bst; + iobus->bsh = bsh; + iobus->mapped = false; + + return (0); +} + +static int +bhnd_erom_iobus_map(struct bhnd_erom_io *eio, bhnd_addr_t addr, + bhnd_size_t size) +{ + struct bhnd_erom_iobus *iobus = (struct bhnd_erom_iobus *)eio; + + /* Sanity check the addr/size */ + if (size == 0) + return (EINVAL); + + /* addr+size must not overflow */ + if (BHND_ADDR_MAX - size < addr) + return (EINVAL); + + /* addr/size must fit within our bus tag's mapping */ + if (addr < iobus->addr || size > iobus->size) + return (ENXIO); + + if (iobus->size - (addr - iobus->addr) < size) + return (ENXIO); + + /* The new addr offset and size must be representible as a bus_size_t */ + if ((addr - iobus->addr) > BUS_SPACE_MAXSIZE) + return (ENXIO); + + if (size > BUS_SPACE_MAXSIZE) + return (ENXIO); + + iobus->offset = addr - iobus->addr; + iobus->limit = size; + iobus->mapped = true; + + return (0); +} + +static uint32_t +bhnd_erom_iobus_read(struct bhnd_erom_io *eio, bhnd_size_t offset, u_int width) +{ + struct bhnd_erom_iobus *iobus = (struct bhnd_erom_iobus *)eio; + + if (!iobus->mapped) + panic("no active mapping"); + + if (iobus->limit < width || iobus->limit - width < offset) + panic("invalid offset %#jx", offset); + + switch (width) { + case 1: + return (bus_space_read_1(iobus->bst, iobus->bsh, + iobus->offset + offset)); + case 2: + return (bus_space_read_2(iobus->bst, iobus->bsh, + iobus->offset + offset)); + case 4: + return (bus_space_read_4(iobus->bst, iobus->bsh, + iobus->offset + offset)); + default: + panic("invalid width %u", width); + } } Modified: head/sys/dev/bhnd/bhnd_erom.h ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.h Wed Sep 27 19:44:23 2017 (r324070) +++ head/sys/dev/bhnd/bhnd_erom.h Wed Sep 27 19:48:34 2017 (r324071) @@ -1,7 +1,11 @@ /*- - * Copyright (c) 2015-2016 Landon Fuller + * Copyright (c) 2015-2017 Landon Fuller + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Landon Fuller + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -41,20 +45,39 @@ #include "bhnd_erom_if.h" -bhnd_erom_t *bhnd_erom_alloc(bhnd_erom_class_t *cls, - const struct bhnd_chipid *cid, - device_t parent, int rid); +/* forward declarations */ +struct bhnd_erom_io; +struct bhnd_erom_iobus; -int bhnd_erom_init_static(bhnd_erom_class_t *cls, - bhnd_erom_t *erom, size_t esize, - const struct bhnd_chipid *cid, - bus_space_tag_t bst, - bus_space_handle_t bsh); +bhnd_erom_class_t *bhnd_erom_probe_driver_classes(devclass_t bus_devclass, + struct bhnd_erom_io *eio, + const struct bhnd_chipid *hint, + struct bhnd_chipid *cid); -void bhnd_erom_fini_static(bhnd_erom_t *erom); +bhnd_erom_t *bhnd_erom_alloc(bhnd_erom_class_t *cls, + const struct bhnd_chipid *cid, + struct bhnd_erom_io *eio); -void bhnd_erom_free(bhnd_erom_t *erom); +int bhnd_erom_init_static(bhnd_erom_class_t *cls, + bhnd_erom_t *erom, size_t esize, + const struct bhnd_chipid *cid, + struct bhnd_erom_io *eio); +void bhnd_erom_fini_static(bhnd_erom_t *erom); + +void bhnd_erom_free(bhnd_erom_t *erom); + +struct bhnd_erom_io *bhnd_erom_iores_new(device_t dev, int rid); +int bhnd_erom_iobus_init(struct bhnd_erom_iobus *iobus, + bhnd_addr_t addr, bhnd_size_t size, + bus_space_tag_t bst, bus_space_handle_t bsh); + +int bhnd_erom_io_map(struct bhnd_erom_io *eio, + bhnd_addr_t addr, bhnd_size_t size); +uint32_t bhnd_erom_io_read(struct bhnd_erom_io *eio, + bhnd_size_t offset, u_int width); +void bhnd_erom_io_fini(struct bhnd_erom_io *eio); + /** * Abstract bhnd_erom instance state. Must be first member of all subclass * instances. @@ -92,19 +115,18 @@ SET_DECLARE(bhnd_erom_class_set, bhnd_erom_class_t); #define BHND_EROM_CLASS_DEF(classvar) DATA_SET(bhnd_erom_class_set, classvar) - /** * Probe to see if this device enumeration class supports the bhnd bus - * mapped by the given resource, returning a standard newbus device probe - * result (see BUS_PROBE_*) and the probed chip identification. + * mapped by @p eio, returning a standard newbus device probe result + * (see BUS_PROBE_*) and the probed chip identification. * * @param cls The erom class to probe. - * @param res A resource mapping the first bus core (EXTIF or - * ChipCommon) - * @param offset Offset to the first bus core within @p res. - * @param hint Identification hint used to identify the device. If - * chipset supports standard chip identification registers - * within the first core, this parameter should be NULL. + * @param eio A bus I/O instance, configured with a mapping of the + * first bus core. + * @param hint Identification hint used to identify the device. + * If chipset supports standard chip identification + * registers within the first core, this parameter should + * be NULL. * @param[out] cid On success, the probed chip identifier. * * @retval 0 if this is the only possible device enumeration @@ -117,43 +139,10 @@ SET_DECLARE(bhnd_erom_class_set, bhnd_erom_class_t); * code should be returned. */ static inline int -bhnd_erom_probe(bhnd_erom_class_t *cls, struct bhnd_resource *res, - bus_size_t offset, const struct bhnd_chipid *hint, struct bhnd_chipid *cid) +bhnd_erom_probe(bhnd_erom_class_t *cls, struct bhnd_erom_io *eio, + const struct bhnd_chipid *hint, struct bhnd_chipid *cid) { - return (BHND_EROM_PROBE(cls, res, offset, hint, cid)); -} - -/** - * Probe to see if this device enumeration class supports the bhnd bus - * mapped at the given bus space tag and handle, returning a standard - * newbus device probe result (see BUS_PROBE_*) and the probed - * chip identification. - * - * @param cls The erom class to probe. - * @param bst Bus space tag. - * @param bsh Bus space handle mapping the EXTIF or ChipCommon core. - * @param paddr The physical address of the core mapped by @p bst and - * @p bsh. - * @param hint Identification hint used to identify the device. If - * chipset supports standard chip identification registers - * within the first core, this parameter should be NULL. - * @param[out] cid On success, the probed chip identifier. - * - * @retval 0 if this is the only possible device enumeration - * parser for the probed bus. - * @retval negative if the probe succeeds, a negative value should be - * returned; the parser returning the lowest value will - * be selected to handle device enumeration. - * @retval ENXIO If the bhnd bus type is not handled by this parser. - * @retval positive if an error occurs during probing, a regular unix error - * code should be returned. - */ -static inline int -bhnd_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_addr_t paddr, const struct bhnd_chipid *hint, - struct bhnd_chipid *cid) -{ - return (BHND_EROM_PROBE_STATIC(cls, bst, bsh, paddr, hint, cid)); + return (BHND_EROM_PROBE(cls, eio, hint, cid)); } /** Modified: head/sys/dev/bhnd/bhnd_erom_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_erom_if.m Wed Sep 27 19:44:23 2017 (r324070) +++ head/sys/dev/bhnd/bhnd_erom_if.m Wed Sep 27 19:48:34 2017 (r324071) @@ -1,7 +1,11 @@ #- -# Copyright (c) 2016 Landon Fuller +# Copyright (c) 2016-2017 Landon Fuller +# Copyright (c) 2017 The FreeBSD Foundation # All rights reserved. # +# Portions of this software were developed by Landon Fuller +# under sponsorship from the FreeBSD Foundation. +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: @@ -43,51 +47,25 @@ INTERFACE bhnd_erom; # tables used by bhnd(4) buses. # -/** - * Probe to see if this device enumeration class supports the bhnd bus - * mapped by the given resource, returning a standard newbus device probe - * result (see BUS_PROBE_*) and the probed chip identification. - * - * @param cls The erom class to probe. - * @param res A resource mapping the first bus core. - * @param offset Offset to the first bus core within @p res. - * @param hint Hint used to identify the device. If chipset supports - * standard chip identification registers within the first - * core, this parameter should be NULL. - * @param[out] cid On success, the probed chip identifier. - * - * @retval 0 if this is the only possible device enumeration - * parser for the probed bus. - * @retval negative if the probe succeeds, a negative value should be - * returned; the parser returning the highest negative - * value will be selected to handle device enumeration. - * @retval ENXIO If the bhnd bus type is not handled by this parser. - * @retval positive if an error occurs during probing, a regular unix error - * code should be returned. - */ -STATICMETHOD int probe { - bhnd_erom_class_t *cls; - struct bhnd_resource *res; - bus_size_t offset; - const struct bhnd_chipid *hint; - struct bhnd_chipid *cid; +HEADER { + /* forward declarations */ + struct bhnd_erom_io; }; /** - * Probe to see if this device enumeration class supports the bhnd bus - * mapped at the given bus space tag and handle, returning a standard - * newbus device probe result (see BUS_PROBE_*) and the probed - * chip identification. + * Probe to see if this device enumeration class supports the bhnd bus at + * @p addr, returning a standard newbus device probe result (see BUS_PROBE_*) + * and the probed chip identification. * - * @param cls The erom class to probe. - * @param bst Bus space tag. - * @param bsh Bus space handle mapping the first bus core. - * @param paddr The physical address of the core mapped by @p bst and - * @p bsh. - * @param hint Hint used to identify the device. If chipset supports - * standard chip identification registers within the first - * core, this parameter should be NULL. - * @param[out] cid On success, the probed chip identifier. + * @param cls The erom class to probe. + * @param eio A bus I/O instance, configured with a mapping of + * the first bus core. + * @param base_addr Address of the first bus core. + * @param hint Hint used to identify the device. If chipset + * supports standard chip identification registers + * within the first core, this parameter should be + * NULL. + * @param[out] cid On success, the probed chip identifier. * * @retval 0 if this is the only possible device enumeration * parser for the probed bus. @@ -98,11 +76,9 @@ STATICMETHOD int probe { * @retval positive if an error occurs during probing, a regular unix error * code should be returned. */ -STATICMETHOD int probe_static { +STATICMETHOD int probe { bhnd_erom_class_t *cls; - bus_space_tag_t bst; - bus_space_handle_t bsh; - bus_addr_t paddr; + struct bhnd_erom_io *eio; const struct bhnd_chipid *hint; struct bhnd_chipid *cid; }; @@ -112,11 +88,9 @@ STATICMETHOD int probe_static { * * @param erom The erom parser to initialize. * @param cid The device's chip identifier. - * @param parent The parent device from which EROM resources should - * be allocated. - * @param rid The resource id to be used when allocating the - * enumeration table. - * + * @param eio The bus I/O instance to use when reading the device + * enumeration table. On success, the erom parser assumes + * ownership of this instance. * @retval 0 success * @retval non-zero if an error occurs initializing the EROM parser, * a regular unix error code will be returned. @@ -124,29 +98,7 @@ STATICMETHOD int probe_static { METHOD int init { bhnd_erom_t *erom; const struct bhnd_chipid *cid; - device_t parent; - int rid; -}; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Sep 27 23:15:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18A74E15093; Wed, 27 Sep 2017 23:15:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBE1364FD9; Wed, 27 Sep 2017 23:15:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8RNFYaP008987; Wed, 27 Sep 2017 23:15:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RNFY3D008986; Wed, 27 Sep 2017 23:15:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709272315.v8RNFY3D008986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 27 Sep 2017 23:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324072 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 324072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 23:15:35 -0000 Author: jhb Date: Wed Sep 27 23:15:33 2017 New Revision: 324072 URL: https://svnweb.freebsd.org/changeset/base/324072 Log: Add UMA_ALIGNOF(). This is a wrapper around _Alignof() that sets the alignment for a zone to the alignment required by a given type. This allows the compiler to determine the proper alignment rather than having the programmer try to guess. Discussed on: arch@ MFC after: 1 week Sponsored by: DARPA / AFRL Modified: head/sys/vm/uma.h Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Wed Sep 27 19:48:34 2017 (r324071) +++ head/sys/vm/uma.h Wed Sep 27 23:15:33 2017 (r324072) @@ -296,6 +296,7 @@ uma_zone_t uma_zcache_create(char *name, int size, uma #define UMA_ALIGN_SHORT (sizeof(short) - 1) /* "" short */ #define UMA_ALIGN_CHAR (sizeof(char) - 1) /* "" char */ #define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ +#define UMA_ALIGNOF(type) (_Alignof(type) - 1) /* Alignment fit for 'type' */ /* * Destroys an empty uma zone. If the zone is not empty uma complains loudly. From owner-svn-src-head@freebsd.org Wed Sep 27 23:18:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28FB2E1519B; Wed, 27 Sep 2017 23:18:59 +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 EB04D65166; Wed, 27 Sep 2017 23:18:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8RNIwga009130; Wed, 27 Sep 2017 23:18:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RNIwTs009129; Wed, 27 Sep 2017 23:18:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709272318.v8RNIwTs009129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 27 Sep 2017 23:18:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324073 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324073 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 23:18:59 -0000 Author: jhb Date: Wed Sep 27 23:18:57 2017 New Revision: 324073 URL: https://svnweb.freebsd.org/changeset/base/324073 Log: Use UMA_ALIGNOF() for name cache UMA zones. This fixes kernel crashes due to misaligned accesses to the 64-bit time_t embedded in struct namecache_ts in MIPS n32 kernels. MFC after: 1 week Sponsored by: DARPA / AFRL Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Sep 27 23:15:33 2017 (r324072) +++ head/sys/kern/vfs_cache.c Wed Sep 27 23:18:57 2017 (r324073) @@ -1754,16 +1754,20 @@ nchinit(void *dummy __unused) cache_zone_small = uma_zcreate("S VFS Cache", sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache), + UMA_ZONE_ZINIT); cache_zone_small_ts = uma_zcreate("STS VFS Cache", sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts), + UMA_ZONE_ZINIT); cache_zone_large = uma_zcreate("L VFS Cache", sizeof(struct namecache) + NAME_MAX + 1, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache), + UMA_ZONE_ZINIT); cache_zone_large_ts = uma_zcreate("LTS VFS Cache", sizeof(struct namecache_ts) + NAME_MAX + 1, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts), + UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); ncbuckethash = cache_roundup_2(mp_ncpus * 64) - 1; From owner-svn-src-head@freebsd.org Wed Sep 27 23:23:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 199DBE1551E; Wed, 27 Sep 2017 23:23:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD2806565A; Wed, 27 Sep 2017 23:23:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8RNNgiV013133; Wed, 27 Sep 2017 23:23:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8RNNgD8013132; Wed, 27 Sep 2017 23:23:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709272323.v8RNNgD8013132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 27 Sep 2017 23:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324074 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 324074 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Sep 2017 23:23:43 -0000 Author: rmacklem Date: Wed Sep 27 23:23:41 2017 New Revision: 324074 URL: https://svnweb.freebsd.org/changeset/base/324074 Log: Fix a memory leak that occurred in the pNFS client. When a "pnfs" NFSv4.1 mount was unmounted, it didn't free up the layouts and deviceinfo structures. This leak only affects "pnfs" mounts and only when the mount is umounted. Found while testing the pNFS Flexible File layout client code. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Wed Sep 27 23:18:57 2017 (r324073) +++ head/sys/fs/nfsclient/nfs_clstate.c Wed Sep 27 23:23:41 2017 (r324074) @@ -1627,6 +1627,14 @@ nfscl_cleanclient(struct nfsclclient *clp) { struct nfsclowner *owp, *nowp; struct nfsclopen *op, *nop; + struct nfscllayout *lyp, *nlyp; + struct nfscldevinfo *dip, *ndip; + + TAILQ_FOREACH_SAFE(lyp, &clp->nfsc_layout, nfsly_list, nlyp) + nfscl_freelayout(lyp); + + LIST_FOREACH_SAFE(dip, &clp->nfsc_devinfo, nfsdi_list, ndip) + nfscl_freedevinfo(dip); /* Now, all the OpenOwners, etc. */ LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { From owner-svn-src-head@freebsd.org Thu Sep 28 01:27:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAD02E2194D; Thu, 28 Sep 2017 01:27:01 +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 78CB86921A; Thu, 28 Sep 2017 01:27:01 +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 v8S1R0g5062364; Thu, 28 Sep 2017 01:27:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8S1R02d062363; Thu, 28 Sep 2017 01:27:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709280127.v8S1R02d062363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 28 Sep 2017 01:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324075 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 324075 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 01:27:01 -0000 Author: imp Date: Thu Sep 28 01:27:00 2017 New Revision: 324075 URL: https://svnweb.freebsd.org/changeset/base/324075 Log: Tweak performance of nda completions Use xpt_done_direct in preference to xpt_done when completing a successful I/O. Continue to use xpt_done when there's an error, or for completion of the submission of a CCB. This eliminates a context switch to the cam_doneq thread. Sponsored by: Netflix Suggested by: scottl@ Modified: head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Wed Sep 27 23:23:41 2017 (r324074) +++ head/sys/dev/nvme/nvme_sim.c Thu Sep 28 01:27:00 2017 (r324075) @@ -73,11 +73,13 @@ nvme_sim_nvmeio_done(void *ccb_arg, const struct nvme_ * it means. Make our best guess, though for the status code. */ memcpy(&ccb->nvmeio.cpl, cpl, sizeof(*cpl)); - if (nvme_completion_is_error(cpl)) + if (nvme_completion_is_error(cpl)) { ccb->ccb_h.status = CAM_REQ_CMP_ERR; - else + xpt_done(ccb); + } else { ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); + xpt_done_direct(ccb); + } } static void From owner-svn-src-head@freebsd.org Thu Sep 28 06:08:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 751ECE29DC3; Thu, 28 Sep 2017 06:08:31 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CC617139C; Thu, 28 Sep 2017 06:08:30 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id xRzidpuVDM9gtxRzjdpnUP; Thu, 28 Sep 2017 00:08:23 -0600 X-Authority-Analysis: v=2.2 cv=a+JAzQaF c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=2JCJgTwv5E4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=1wW5gpbd9WpZmVyYtQ4A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id BCE6D58F; Wed, 27 Sep 2017 23:08:21 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v8S68Lku052325; Wed, 27 Sep 2017 23:08:21 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201709280608.v8S68Lku052325@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Sepherosa Ziehau cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324049 - head/sys/dev/hyperv/netvsc In-Reply-To: Message from Sepherosa Ziehau of "Wed, 27 Sep 2017 05:44:50 -0000." <201709270544.v8R5io50067311@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 27 Sep 2017 23:08:21 -0700 X-CMAE-Envelope: MS4wfGqxccCPZe3zN90A3bn4ltHOD1BTBKCq8GF2M523rswQ7Sx+GDfxmxuXh9Mkv24//1+fsAFgc45kNZ+gcvsBe/279hxKgIC5dxKNdUP7/PexAt85BJIs si6myYfplT+CQWH1jmTOV+w9DD+SnjjEmrJUGUg4w6v03Cr2papMYwa7ZnJL+mec/50eaTYkMyfNvmDhcGhb+G0UZnXvlmEJS4dYiWuFAirgco+yUPizzPJ5 jhpMtx/IFyjQMkiHF2GQrTNcsapHnwx1c1mIHwR6bUclO+BJ645ECy6+3pKD+pjH X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 06:08:31 -0000 In message <201709270544.v8R5io50067311@repo.freebsd.org>, Sepherosa Ziehau wri tes: > Author: sephe > Date: Wed Sep 27 05:44:50 2017 > New Revision: 324049 > URL: https://svnweb.freebsd.org/changeset/base/324049 > > Log: > hyperv/hn: Fix UDP checksum offload issue in Azure. > > UDP checksum offload does not work in Azure if following conditions are > met: > - sizeof(IP hdr + UDP hdr + payload) > 1420. > - IP_DF is not set in IP hdr > > Use software checksum for UDP datagrams falling into this category. > > Add two tunables to disable UDP/IPv4 and UDP/IPv6 checksum offload, in > case something unexpected happened. > > MFC after: 1 week > Sponsored by: Microsoft > Differential Revision: https://reviews.freebsd.org/D12429 > > Modified: > head/sys/dev/hyperv/netvsc/if_hn.c > > Modified: head/sys/dev/hyperv/netvsc/if_hn.c > ============================================================================= > = > --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 04:42:40 2017 > (r324048) > +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 05:44:50 2017 > (r324049) > @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include Shouldn't this go after the #include ? Found in tinderbox: i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for details In _.i386.GENERIC-NODEBUG: In file included from /home/cy/current/sys/dev/hyperv/netvsc/if_hn.c:65: In file included from /home/cy/current/sys/sys/counter.h:35: ./machine/counter.h:172:3: error: implicit declaration of function 'critical_ent er' is invalid in C99 [-Werror,-Wimplicit-function-declaration] critical_enter(); ^ WARNING: ctfconvert: enum pmc_event has too many values: 2629 > 1023 ./machine/counter.h:172:3: error: this function declaration is not a prototype [ -Werror,-Wstrict-prototypes] ./machine/counter.h:174:3: error: implicit declaration of function 'critical_exi t' is invalid in C99 [-Werror,-Wimplicit-function-declaration] critical_exit(); > #include > #include > #include -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Sep 28 06:53:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5E28E2AAAE; Thu, 28 Sep 2017 06:53:50 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com [IPv6:2607:f8b0:400d:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F85B72739; Thu, 28 Sep 2017 06:53:50 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-qk0-x22b.google.com with SMTP id u67so501272qkg.6; Wed, 27 Sep 2017 23:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=yB8X9R2+ooKakv1gqRRusVDb5msog6XMaORS10eiMiY=; b=R3PiIdO9n6UGaLYjIx0U3Zs8tQlac6GXAbp7QkmGLxdCkof59YF4n4Oh3uQ4eEjz05 NDGCsIfAUGHCN5lDvuu3vB+FY4LZ83ZlHOg7S30SLJut4hGbR+whL2cSFHavDP2hEuzi qv5wdbaZHYBb+UVc0UMOa6lCgASx0s9DupM0IglHePqNTzokE8Xvjzvq49y3nOyDGrMB 11uUKvPyLaEXqZO4M+pKGohAm/E4yTQpGu3RnDMsWpmbGUrBvRoGpq3dfY6W6GPWumpV 844vsqVzVdKtbg1cph2ztQ9A8NLo9NY7E36jyKG6jX5cNotBduEm5Zbcrq6vvc8JwY1B FaLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=yB8X9R2+ooKakv1gqRRusVDb5msog6XMaORS10eiMiY=; b=ZCMFfZF7dCA2a76/TmI/lV+OEYXk/5yGeTjEyAUXxosNrWB1CJbvlyww7k80zyzqXa ixUxlTreS09eVW5onLR5UYSBLjyqDCNwTKnJ4u4h76eO6VOvfKH5sg0MtAUcIIJE9M+i XIN6BGUCv89BnN6UUBuumxt0Vqn9fG8Wb8ueDzdxxYR1+j3LljlT0Niwmx210GCVWKi7 fVLjw3NFzwCZlk4iEbv7VUOcufMS3hakfLZo8kyZNBi4WDnKWvVYGUEgHpBQb9/XKa0K FludMm1NLyh6pxsAa6OZbhk90ZXgRpvaB2z4gUy1Lu+teDPqLTKVYK4W4nVBOznMeAxk O1Ng== X-Gm-Message-State: AHPjjUjMH5Qdh68NMJFzzkYvudg/C5W7qbUXCx9+QMOaPyGzJlgi+DV0 rna3nvzp6HBHPK9Jb2o0zU9MMIMT+DZLkDnUag== X-Google-Smtp-Source: AOwi7QBOMHGc0Xn+jeIkgLxkDbliJEbXeadTidxg/UVJfZ0CzRyICyHn5jD7OGMWCD0BYKAYTwxDWxkIj/1uL7AC3PA= X-Received: by 10.55.102.13 with SMTP id a13mr5596610qkc.320.1506581629443; Wed, 27 Sep 2017 23:53:49 -0700 (PDT) MIME-Version: 1.0 Sender: sepherosa@gmail.com Received: by 10.140.21.20 with HTTP; Wed, 27 Sep 2017 23:53:48 -0700 (PDT) In-Reply-To: <201709280608.v8S68Lku052325@slippy.cwsent.com> References: <201709270544.v8R5io50067311@repo.freebsd.org> <201709280608.v8S68Lku052325@slippy.cwsent.com> From: Sepherosa Ziehau Date: Thu, 28 Sep 2017 14:53:48 +0800 X-Google-Sender-Auth: tiBNZ4Uup68fz8JgZTE_sSr8wd8 Message-ID: Subject: Re: svn commit: r324049 - head/sys/dev/hyperv/netvsc To: Cy Schubert 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.23 Precedence: list List-Id: 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, 28 Sep 2017 06:53:51 -0000 Thanks, I am doing a test building. I am planning to drop the Hyper-V on i386, which is never officially supported. On Thu, Sep 28, 2017 at 2:08 PM, Cy Schubert wrote: > In message <201709270544.v8R5io50067311@repo.freebsd.org>, Sepherosa Ziehau > wri > tes: >> Author: sephe >> Date: Wed Sep 27 05:44:50 2017 >> New Revision: 324049 >> URL: https://svnweb.freebsd.org/changeset/base/324049 >> >> Log: >> hyperv/hn: Fix UDP checksum offload issue in Azure. >> >> UDP checksum offload does not work in Azure if following conditions are >> met: >> - sizeof(IP hdr + UDP hdr + payload) > 1420. >> - IP_DF is not set in IP hdr >> >> Use software checksum for UDP datagrams falling into this category. >> >> Add two tunables to disable UDP/IPv4 and UDP/IPv6 checksum offload, in >> case something unexpected happened. >> >> MFC after: 1 week >> Sponsored by: Microsoft >> Differential Revision: https://reviews.freebsd.org/D12429 >> >> Modified: >> head/sys/dev/hyperv/netvsc/if_hn.c >> >> Modified: head/sys/dev/hyperv/netvsc/if_hn.c >> ============================================================================= >> = >> --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 04:42:40 2017 >> (r324048) >> +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 05:44:50 2017 >> (r324049) >> @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); >> >> #include >> #include >> +#include > > Shouldn't this go after the #include ? > > Found in tinderbox: > > i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for details > > In _.i386.GENERIC-NODEBUG: > > In file included from /home/cy/current/sys/dev/hyperv/netvsc/if_hn.c:65: > In file included from /home/cy/current/sys/sys/counter.h:35: > ./machine/counter.h:172:3: error: implicit declaration of function > 'critical_ent > er' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > critical_enter(); > ^ > WARNING: ctfconvert: enum pmc_event has too many values: 2629 > 1023 > ./machine/counter.h:172:3: error: this function declaration is not a > prototype [ > -Werror,-Wstrict-prototypes] > ./machine/counter.h:174:3: error: implicit declaration of function > 'critical_exi > t' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > critical_exit(); > > >> #include >> #include >> #include > > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Thu Sep 28 07:02:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4A93E2AD16; Thu, 28 Sep 2017 07:02:57 +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 739A472BF9; Thu, 28 Sep 2017 07:02:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8S72un8002023; Thu, 28 Sep 2017 07:02:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8S72uom002022; Thu, 28 Sep 2017 07:02:56 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201709280702.v8S72uom002022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 28 Sep 2017 07:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324077 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 324077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 07:02:57 -0000 Author: sephe Date: Thu Sep 28 07:02:56 2017 New Revision: 324077 URL: https://svnweb.freebsd.org/changeset/base/324077 Log: hyperv/hn: Unbreak i386 building. Reported by: cy MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Thu Sep 28 05:20:37 2017 (r324076) +++ head/sys/dev/hyperv/netvsc/if_hn.c Thu Sep 28 07:02:56 2017 (r324077) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include "opt_rss.h" #include +#include #include #include #include @@ -77,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@freebsd.org Thu Sep 28 08:38:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD0C9E2CB94; Thu, 28 Sep 2017 08:38:26 +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 AB1887576F; Thu, 28 Sep 2017 08:38:26 +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 v8S8cPMv039411; Thu, 28 Sep 2017 08:38:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8S8cPkB039402; Thu, 28 Sep 2017 08:38:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709280838.v8S8cPkB039402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 28 Sep 2017 08:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324078 - in head/sys: i386/i386 i386/include i386/isa kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: i386/i386 i386/include i386/isa kern X-SVN-Commit-Revision: 324078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 08:38:27 -0000 Author: kib Date: Thu Sep 28 08:38:24 2017 New Revision: 324078 URL: https://svnweb.freebsd.org/changeset/base/324078 Log: Revert r323722. A better fix will be committed shortly, as well as some still useful bits of the reverted revision. The problem with the committed fix is that there are still issues with returning from NMI, when NMI interrupted kernel in a moment where the kernel segments selectors were still not loaded into registers. If this happens, the NMI return would loose the userspace selectors because r323722 does not reload segment registers on return to kernel mode. Fixing the problem is complicated. Since an alternative approach to handle the original bug exists, it makes sence to stop adding more complexity. Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/apic_vector.s head/sys/i386/i386/db_trace.c head/sys/i386/i386/exception.s head/sys/i386/i386/locore.s head/sys/i386/i386/machdep.c head/sys/i386/i386/trap.c head/sys/i386/include/md_var.h head/sys/i386/isa/npx.c head/sys/kern/imgact_aout.c Modified: head/sys/i386/i386/apic_vector.s ============================================================================== --- head/sys/i386/i386/apic_vector.s Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/i386/apic_vector.s Thu Sep 28 08:38:24 2017 (r324078) @@ -189,7 +189,8 @@ IDTVEC(xen_intr_upcall) SUPERALIGN_TEXT invltlb_ret: call as_lapic_eoi - jmp doreti + POP_FRAME + iret SUPERALIGN_TEXT IDTVEC(invltlb) @@ -273,8 +274,10 @@ IDTVEC(cpustop) call as_lapic_eoi call cpustop_handler - jmp doreti + POP_FRAME + iret + /* * Executed by a CPU when it receives an IPI_SUSPEND from another CPU. */ @@ -287,8 +290,10 @@ IDTVEC(cpususpend) call as_lapic_eoi call cpususpend_handler - jmp doreti + POP_FRAME + jmp doreti_iret + /* * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU. * @@ -309,6 +314,7 @@ IDTVEC(rendezvous) call smp_rendezvous_action call as_lapic_eoi - jmp doreti + POP_FRAME + iret #endif /* SMP */ Modified: head/sys/i386/i386/db_trace.c ============================================================================== --- head/sys/i386/i386/db_trace.c Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/i386/db_trace.c Thu Sep 28 08:38:24 2017 (r324078) @@ -326,7 +326,8 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st else if (strncmp(name, "Xatpic_intr", 11) == 0 || strncmp(name, "Xapic_isr", 9) == 0) frame_type = INTERRUPT; - else if (strcmp(name, "Xint0x80_syscall") == 0) + else if (strcmp(name, "Xlcall_syscall") == 0 || + strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/i386/exception.s Thu Sep 28 08:38:24 2017 (r324078) @@ -98,16 +98,15 @@ MCOUNT_LABEL(user) MCOUNT_LABEL(btrap) #define TRAP(a) pushl $(a) ; jmp alltraps -#define TRAP_NOEN(a) pushl $(a) ; jmp alltraps_noen IDTVEC(div) pushl $0; TRAP(T_DIVIDE) IDTVEC(dbg) - pushl $0; TRAP_NOEN(T_TRCTRAP) + pushl $0; TRAP(T_TRCTRAP) IDTVEC(nmi) - pushl $0; TRAP_NOEN(T_NMI) + pushl $0; TRAP(T_NMI) IDTVEC(bpt) - pushl $0; TRAP_NOEN(T_BPTFLT) + pushl $0; TRAP(T_BPTFLT) IDTVEC(dtrace_ret) pushl $0; TRAP(T_DTRACE_RET) IDTVEC(ofl) @@ -131,7 +130,7 @@ IDTVEC(stk) IDTVEC(prot) TRAP(T_PROTFLT) IDTVEC(page) - TRAP_NOEN(T_PAGEFLT) + TRAP(T_PAGEFLT) IDTVEC(mchk) pushl $0; TRAP(T_MCHK) IDTVEC(rsvd) @@ -143,21 +142,6 @@ IDTVEC(align) IDTVEC(xmm) pushl $0; TRAP(T_XMMFLT) - SUPERALIGN_TEXT - .globl alltraps_noen -alltraps_noen: - pushal - pushl $0 - movw %ds,(%esp) - pushl $0 - movw %es,(%esp) - pushl $0 - movw %fs,(%esp) - SET_KERNEL_SREGS - cld - FAKE_MCOUNT(TF_EIP(%esp)) - jmp calltrap - /* * All traps except ones for syscalls jump to alltraps. If * interrupts were enabled when the trap occurred, then interrupts @@ -180,7 +164,6 @@ alltraps: movw %fs,(%esp) alltraps_with_regs_pushed: SET_KERNEL_SREGS - sti cld FAKE_MCOUNT(TF_EIP(%esp)) calltrap: @@ -242,6 +225,40 @@ norm_ill: #endif /* + * Call gate entry for syscalls (lcall 7,0). + * This is used by FreeBSD 1.x a.out executables and "old" NetBSD executables. + * + * The intersegment call has been set up to specify one dummy parameter. + * This leaves a place to put eflags so that the call frame can be + * converted to a trap frame. Note that the eflags is (semi-)bogusly + * pushed into (what will be) tf_err and then copied later into the + * final spot. It has to be done this way because esp can't be just + * temporarily altered for the pushfl - an interrupt might come in + * and clobber the saved cs/eip. + */ + SUPERALIGN_TEXT +IDTVEC(lcall_syscall) + pushfl /* save eflags */ + popl 8(%esp) /* shuffle into tf_eflags */ + pushl $7 /* sizeof "lcall 7,0" */ + pushl $0 /* tf_trapno */ + pushal + pushl $0 + movw %ds,(%esp) + pushl $0 + movw %es,(%esp) + pushl $0 + movw %fs,(%esp) + SET_KERNEL_SREGS + cld + FAKE_MCOUNT(TF_EIP(%esp)) + pushl %esp + call syscall + add $4, %esp + MEXITCOUNT + jmp doreti + +/* * Trap gate entry for syscalls (int 0x80). * This is used by FreeBSD ELF executables, "new" NetBSD executables, and all * Linux executables. @@ -262,7 +279,6 @@ IDTVEC(int0x80_syscall) pushl $0 movw %fs,(%esp) SET_KERNEL_SREGS - sti cld FAKE_MCOUNT(TF_EIP(%esp)) pushl %esp @@ -346,7 +362,7 @@ doreti_next: #ifdef HWPMC_HOOKS je doreti_nmi #else - je doreti_notvm86 + je doreti_exit #endif /* * PSL_VM must be checked first since segment registers only @@ -362,7 +378,7 @@ doreti_next: doreti_notvm86: testb $SEL_RPL_MASK,TF_CS(%esp) /* are we returning to user mode? */ - jz doreti_nosegs /* can't handle ASTs now if not */ + jz doreti_exit /* can't handle ASTs now if not */ doreti_ast: /* @@ -399,12 +415,6 @@ doreti_popl_es: .globl doreti_popl_ds doreti_popl_ds: popl %ds - jmp doreti_iret_popal - -doreti_nosegs: - MEXITCOUNT - addl $12,%esp -doreti_iret_popal: popal addl $8,%esp .globl doreti_iret @@ -447,7 +457,7 @@ doreti_nmi: * needs a user call chain capture. */ testb $SEL_RPL_MASK,TF_CS(%esp) - jz doreti_nosegs + jz doreti_exit movl PCPU(CURTHREAD),%eax /* curthread present? */ orl %eax,%eax jz doreti_exit Modified: head/sys/i386/i386/locore.s ============================================================================== --- head/sys/i386/i386/locore.s Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/i386/locore.s Thu Sep 28 08:38:24 2017 (r324078) @@ -335,44 +335,6 @@ osigcode: pushl %eax /* junk to fake return addr. */ int $0x80 /* enter kernel with args */ 0: jmp 0b - -/* - * The lcall $7,$0 handler cannot use the call gate that does an - * inter-privilege transition. The reason is that the call gate - * does not disable interrupts, and, before the kernel segment registers - * are loaded, we would have a window where the ring 0 code is - * executed with the wrong segments. - * - * Instead, set LDT descriptor 0 as code segment, which reflects - * the lcall $7,$0 back to ring 3 trampoline. The trampoline sets up - * the frame for int $0x80. - */ - ALIGN_TEXT -lcall_tramp: - cmpl $SYS_vfork,%eax - je 1f - pushl %ebp - movl %esp,%ebp - pushl 0x24(%ebp) /* arg 6 */ - pushl 0x20(%ebp) - pushl 0x1c(%ebp) - pushl 0x18(%ebp) - pushl 0x14(%ebp) - pushl 0x10(%ebp) /* arg 1 */ - subl $4,%esp /* gap */ - int $0x80 - leavel - lretl -1: - /* - * vfork handling is special and relies on the libc stub saving - * the return ip in %ecx. Also, we assume that the call was done - * with ucode32 selector in %cs. - */ - int $0x80 - movl $0x33,4(%esp) /* GUCODE32_SEL | SEL_UPL */ - movl %ecx,(%esp) - lretl #endif /* COMPAT_43 */ ALIGN_TEXT @@ -391,9 +353,6 @@ szfreebsd4_sigcode: .globl szosigcode szosigcode: .long esigcode-osigcode - .globl szlcallcode -szlcallcode: - .long esigcode-lcall_tramp #endif .text Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/i386/machdep.c Thu Sep 28 08:38:24 2017 (r324078) @@ -1513,7 +1513,7 @@ extern inthand_t #ifdef XENHVM IDTVEC(xen_intr_upcall), #endif - IDTVEC(int0x80_syscall); + IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall); #ifdef DDB /* @@ -2157,9 +2157,7 @@ i386_kdb_init(void) register_t init386(int first) { -#ifdef COMPAT_43 - struct segment_descriptor *gdp; -#endif + struct gate_descriptor *gdp; int gsel_tss, metadata_missing, x, pa; struct pcpu *pc; struct xstate_hdr *xhdr; @@ -2248,9 +2246,9 @@ init386(int first) /* exceptions */ for (x = 0; x < NIDT; x++) - setidt(x, &IDTVEC(rsvd), SDT_SYS386IGT, SEL_KPL, + setidt(x, &IDTVEC(rsvd), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_DE, &IDTVEC(div), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_DE, &IDTVEC(div), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); setidt(IDT_DB, &IDTVEC(dbg), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); @@ -2258,39 +2256,39 @@ init386(int first) GSEL(GCODE_SEL, SEL_KPL)); setidt(IDT_BP, &IDTVEC(bpt), SDT_SYS386IGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_OF, &IDTVEC(ofl), SDT_SYS386IGT, SEL_UPL, + setidt(IDT_OF, &IDTVEC(ofl), SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_BR, &IDTVEC(bnd), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_BR, &IDTVEC(bnd), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_UD, &IDTVEC(ill), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_UD, &IDTVEC(ill), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_NM, &IDTVEC(dna), SDT_SYS386IGT, SEL_KPL + setidt(IDT_NM, &IDTVEC(dna), SDT_SYS386TGT, SEL_KPL , GSEL(GCODE_SEL, SEL_KPL)); setidt(IDT_DF, 0, SDT_SYSTASKGT, SEL_KPL, GSEL(GPANIC_SEL, SEL_KPL)); - setidt(IDT_FPUGP, &IDTVEC(fpusegm), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_FPUGP, &IDTVEC(fpusegm), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_TS, &IDTVEC(tss), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_TS, &IDTVEC(tss), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_NP, &IDTVEC(missing), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_NP, &IDTVEC(missing), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_SS, &IDTVEC(stk), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_SS, &IDTVEC(stk), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_GP, &IDTVEC(prot), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_GP, &IDTVEC(prot), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); setidt(IDT_PF, &IDTVEC(page), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_MF, &IDTVEC(fpu), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_MF, &IDTVEC(fpu), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_AC, &IDTVEC(align), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_AC, &IDTVEC(align), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_MC, &IDTVEC(mchk), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_MC, &IDTVEC(mchk), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_XF, &IDTVEC(xmm), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_XF, &IDTVEC(xmm), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386IGT, SEL_UPL, + setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); #ifdef KDTRACE_HOOKS - setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386IGT, SEL_UPL, + setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); #endif #ifdef XENHVM @@ -2331,9 +2329,9 @@ init386(int first) clock_init(); finishidentcpu(); /* Final stage of CPU initialization */ - setidt(IDT_UD, &IDTVEC(ill), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_UD, &IDTVEC(ill), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setidt(IDT_GP, &IDTVEC(prot), SDT_SYS386IGT, SEL_KPL, + setidt(IDT_GP, &IDTVEC(prot), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); initializecpu(); /* Initialize CPU registers */ initializecpucache(); @@ -2438,21 +2436,17 @@ init386(int first) gdt[GPROC0_SEL].sd.sd_type = SDT_SYS386TSS; /* clear busy bit */ ltr(gsel_tss); -#ifdef COMPAT_43 - /* - * Make a code descriptor to emulate lcall $7,$0 with int - * $0x80. sd_hibase and sd_lobase are set after the sigtramp - * base in the shared table is known. - */ - gdp = &ldt[LSYS5CALLS_SEL].sd; - gdp->sd_type = SDT_MEMERA; - gdp->sd_dpl = SEL_UPL; - gdp->sd_p = 1; - gdp->sd_def32 = 1; - gdp->sd_gran = 1; - gdp->sd_lolimit = 0xffff; - gdp->sd_hilimit = 0xf; -#endif + /* make a call gate to reenter kernel with */ + gdp = &ldt[LSYS5CALLS_SEL].gd; + + x = (int) &IDTVEC(lcall_syscall); + gdp->gd_looffset = x; + gdp->gd_selector = GSEL(GCODE_SEL,SEL_KPL); + gdp->gd_stkcpy = 1; + gdp->gd_type = SDT_SYS386CGT; + gdp->gd_dpl = SEL_UPL; + gdp->gd_p = 1; + gdp->gd_hioffset = x >> 16; /* transfer to user mode */ Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/i386/trap.c Thu Sep 28 08:38:24 2017 (r324078) @@ -114,6 +114,8 @@ static int trap_pfault(struct trapframe *, int, vm_off static void trap_fatal(struct trapframe *, vm_offset_t); void dblfault_handler(void); +extern inthand_t IDTVEC(lcall_syscall); + #define MAX_TRAP_MSG 32 static char *trap_msg[] = { "", /* 0 unused */ @@ -627,6 +629,23 @@ user_trctrap_out: case T_TRCTRAP: /* trace trap */ kernel_trctrap: + if (frame->tf_eip == (int)IDTVEC(lcall_syscall)) { + /* + * We've just entered system mode via the + * syscall lcall. Continue single stepping + * silently until the syscall handler has + * saved the flags. + */ + return; + } + if (frame->tf_eip == (int)IDTVEC(lcall_syscall) + 1) { + /* + * The syscall handler has now saved the + * flags. Stop single stepping it. + */ + frame->tf_eflags &= ~PSL_T; + return; + } /* * Ignore debug register trace traps due to * accesses in the user's address space, which Modified: head/sys/i386/include/md_var.h ============================================================================== --- head/sys/i386/include/md_var.h Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/include/md_var.h Thu Sep 28 08:38:24 2017 (r324078) @@ -43,7 +43,6 @@ extern int szfreebsd4_sigcode; #endif #ifdef COMPAT_43 extern int szosigcode; -extern int szlcallcode; #endif extern uint32_t *vm_page_dump; Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/i386/isa/npx.c Thu Sep 28 08:38:24 2017 (r324078) @@ -237,7 +237,7 @@ npx_probe(void) } save_idt_npxtrap = idt[IDT_MF]; - setidt(IDT_MF, probetrap, SDT_SYS386IGT, SEL_KPL, + setidt(IDT_MF, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); /* Modified: head/sys/kern/imgact_aout.c ============================================================================== --- head/sys/kern/imgact_aout.c Thu Sep 28 07:02:56 2017 (r324077) +++ head/sys/kern/imgact_aout.c Thu Sep 28 08:38:24 2017 (r324078) @@ -27,8 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_compat.h" - #include #include #include @@ -339,18 +337,3 @@ exec_aout_imgact(struct image_params *imgp) */ static struct execsw aout_execsw = { exec_aout_imgact, "a.out" }; EXEC_SET(aout, aout_execsw); - -#if defined(__i386__) && defined(COMPAT_43) -static void -exec_init_lcall(void *arg __unused) -{ - struct segment_descriptor *gdp; - u_int lcall_addr; - - gdp = &ldt[LSYS5CALLS_SEL].sd; - lcall_addr = aout_sysvec.sv_psstrings - szlcallcode; - gdp->sd_hibase = lcall_addr >> 24; - gdp->sd_lobase = lcall_addr; -} -SYSINIT(aout, SI_SUB_EXEC + 1, SI_ORDER_ANY, exec_init_lcall, NULL); -#endif From owner-svn-src-head@freebsd.org Thu Sep 28 08:46:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87A54E2CE3D; Thu, 28 Sep 2017 08:46:16 +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 5393275D33; Thu, 28 Sep 2017 08:46: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 v8S8kFNg043834; Thu, 28 Sep 2017 08:46:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8S8kFad043832; Thu, 28 Sep 2017 08:46:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709280846.v8S8kFad043832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 28 Sep 2017 08:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324079 - in head/sys/i386: i386 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/i386: i386 include X-SVN-Commit-Revision: 324079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 08:46:16 -0000 Author: kib Date: Thu Sep 28 08:46:15 2017 New Revision: 324079 URL: https://svnweb.freebsd.org/changeset/base/324079 Log: Restore a part of r323722. Do not return from interrupt using the POP_FRAME;iret instruction sequence, always jump to doreti. The user segments selectors saved on the stack might become invalid because userspace manipulated LDT in a parallel thread. trap() is aware of such issue, but it is only prepared to handle it at iret and segment registers load operations in doreti path. Also remove POP_FRAME macro because it is no longer used. Reviewed by: bde, jhb (as part of r323722) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/apic_vector.s head/sys/i386/include/asmacros.h Modified: head/sys/i386/i386/apic_vector.s ============================================================================== --- head/sys/i386/i386/apic_vector.s Thu Sep 28 08:38:24 2017 (r324078) +++ head/sys/i386/i386/apic_vector.s Thu Sep 28 08:46:15 2017 (r324079) @@ -189,8 +189,7 @@ IDTVEC(xen_intr_upcall) SUPERALIGN_TEXT invltlb_ret: call as_lapic_eoi - POP_FRAME - iret + jmp doreti SUPERALIGN_TEXT IDTVEC(invltlb) @@ -274,10 +273,8 @@ IDTVEC(cpustop) call as_lapic_eoi call cpustop_handler + jmp doreti - POP_FRAME - iret - /* * Executed by a CPU when it receives an IPI_SUSPEND from another CPU. */ @@ -290,10 +287,8 @@ IDTVEC(cpususpend) call as_lapic_eoi call cpususpend_handler + jmp doreti - POP_FRAME - jmp doreti_iret - /* * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU. * @@ -314,7 +309,6 @@ IDTVEC(rendezvous) call smp_rendezvous_action call as_lapic_eoi - POP_FRAME - iret + jmp doreti #endif /* SMP */ Modified: head/sys/i386/include/asmacros.h ============================================================================== --- head/sys/i386/include/asmacros.h Thu Sep 28 08:38:24 2017 (r324078) +++ head/sys/i386/include/asmacros.h Thu Sep 28 08:46:15 2017 (r324079) @@ -153,13 +153,6 @@ pushl $0 ; \ movw %fs,(%esp) -#define POP_FRAME \ - popl %fs ; \ - popl %es ; \ - popl %ds ; \ - popal ; \ - addl $4+4,%esp - /* * Access per-CPU data. */ From owner-svn-src-head@freebsd.org Thu Sep 28 09:01:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2590E2D4AF; Thu, 28 Sep 2017 09:01:29 +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 BE4857637E; Thu, 28 Sep 2017 09:01:29 +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 v8S91SqO051541; Thu, 28 Sep 2017 09:01:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8S91SYk051539; Thu, 28 Sep 2017 09:01:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709280901.v8S91SYk051539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 28 Sep 2017 09:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324080 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 324080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 09:01:30 -0000 Author: kib Date: Thu Sep 28 09:01:28 2017 New Revision: 324080 URL: https://svnweb.freebsd.org/changeset/base/324080 Log: A different fix for the issue from r323722. Split the handlers for pop of invalid selectors from the trap frame into usermode and kernel variants. Usermode handler is kept as is, it restores the already loaded parts of the trap frame and jumps to set up a signal delivery to the user process. New kernel part of the handler emulates IRET treatment of the segments which would violate access right. It loads NUL selector in the segment register which load causes the fault, and then continues the return to interrupted kernel code. Since invalid selectors in the segment registers in the kernel mode can only exist while kernel still enters or exits from userspace, we only zero invalid userspace selectors. If userspace tries to use the segment register, it gets a signal, as if the processor segment descriptor cache was reloaded. Reported by: Maxime Villard Suggested and reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/exception.s head/sys/i386/i386/genassym.c Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Thu Sep 28 08:46:15 2017 (r324079) +++ head/sys/i386/i386/exception.s Thu Sep 28 09:01:28 2017 (r324080) @@ -425,8 +425,16 @@ doreti_iret: * doreti_iret_fault and friends. Alternative return code for * the case where we get a fault in the doreti_exit code * above. trap() (i386/i386/trap.c) catches this specific - * case, sends the process a signal and continues in the - * corresponding place in the code below. + * case, and continues in the corresponding place in the code + * below. + * + * If the fault occured during return to usermode, we recreate + * the trap frame and call trap() to send a signal. Otherwise + * the kernel was tricked into fault by attempt to restore invalid + * usermode segment selectors on return from nested fault or + * interrupt, where interrupted kernel entry code not yet loaded + * kernel selectors. In the latter case, emulate iret and zero + * the invalid selector. */ ALIGN_TEXT .globl doreti_iret_fault @@ -437,18 +445,35 @@ doreti_iret_fault: movw %ds,(%esp) .globl doreti_popl_ds_fault doreti_popl_ds_fault: + testb $SEL_RPL_MASK,TF_CS-TF_DS(%esp) + jz doreti_popl_ds_kfault pushl $0 movw %es,(%esp) .globl doreti_popl_es_fault doreti_popl_es_fault: + testb $SEL_RPL_MASK,TF_CS-TF_ES(%esp) + jz doreti_popl_es_kfault pushl $0 movw %fs,(%esp) .globl doreti_popl_fs_fault doreti_popl_fs_fault: + testb $SEL_RPL_MASK,TF_CS-TF_FS(%esp) + jz doreti_popl_fs_kfault sti movl $0,TF_ERR(%esp) /* XXX should be the error code */ movl $T_PROTFLT,TF_TRAPNO(%esp) jmp alltraps_with_regs_pushed + +doreti_popl_ds_kfault: + movl $0,(%esp) + jmp doreti_popl_ds +doreti_popl_es_kfault: + movl $0,(%esp) + jmp doreti_popl_es +doreti_popl_fs_kfault: + movl $0,(%esp) + jmp doreti_popl_fs + #ifdef HWPMC_HOOKS doreti_nmi: /* Modified: head/sys/i386/i386/genassym.c ============================================================================== --- head/sys/i386/i386/genassym.c Thu Sep 28 08:46:15 2017 (r324079) +++ head/sys/i386/i386/genassym.c Thu Sep 28 09:01:28 2017 (r324080) @@ -156,11 +156,15 @@ ASSYM(PCB_IDT, offsetof(struct pcb, pcb_idt)); ASSYM(PCB_LDT, offsetof(struct pcb, pcb_ldt)); ASSYM(PCB_TR, offsetof(struct pcb, pcb_tr)); +ASSYM(TF_FS, offsetof(struct trapframe, tf_fs)); +ASSYM(TF_ES, offsetof(struct trapframe, tf_es)); +ASSYM(TF_DS, offsetof(struct trapframe, tf_ds)); ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno)); ASSYM(TF_ERR, offsetof(struct trapframe, tf_err)); ASSYM(TF_EIP, offsetof(struct trapframe, tf_eip)); ASSYM(TF_CS, offsetof(struct trapframe, tf_cs)); ASSYM(TF_EFLAGS, offsetof(struct trapframe, tf_eflags)); + ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler)); #ifdef COMPAT_43 ASSYM(SIGF_SC, offsetof(struct osigframe, sf_siginfo.si_sc)); From owner-svn-src-head@freebsd.org Thu Sep 28 11:26:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EE45E2FF5D; Thu, 28 Sep 2017 11:26:39 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F25CD7FF41; Thu, 28 Sep 2017 11:26:38 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SBQcfF013747; Thu, 28 Sep 2017 11:26:38 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SBQcAH013745; Thu, 28 Sep 2017 11:26:38 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201709281126.v8SBQcAH013745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Thu, 28 Sep 2017 11:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324081 - head/sys/netgraph X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sys/netgraph X-SVN-Commit-Revision: 324081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 11:26:39 -0000 Author: eugen (ports committer) Date: Thu Sep 28 11:26:37 2017 New Revision: 324081 URL: https://svnweb.freebsd.org/changeset/base/324081 Log: Correction after r323873: #include in addition to PR: 220076 Approved by: mav (mentor) MFC after: 3 days Modified: head/sys/netgraph/ng_iface.c Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Thu Sep 28 09:01:28 2017 (r324080) +++ head/sys/netgraph/ng_iface.c Thu Sep 28 11:26:37 2017 (r324081) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include From owner-svn-src-head@freebsd.org Thu Sep 28 12:43:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BC3EE31896; Thu, 28 Sep 2017 12:43:26 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37F058221B; Thu, 28 Sep 2017 12:43:26 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SChPJj046887; Thu, 28 Sep 2017 12:43:25 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SChP1o046886; Thu, 28 Sep 2017 12:43:25 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201709281243.v8SChP1o046886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Thu, 28 Sep 2017 12:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324082 - head/usr.sbin/config X-SVN-Group: head X-SVN-Commit-Author: n_hibma X-SVN-Commit-Paths: head/usr.sbin/config X-SVN-Commit-Revision: 324082 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 12:43:26 -0000 Author: n_hibma Date: Thu Sep 28 12:43:25 2017 New Revision: 324082 URL: https://svnweb.freebsd.org/changeset/base/324082 Log: Typo in filename in comment. Modified: head/usr.sbin/config/config.h Modified: head/usr.sbin/config/config.h ============================================================================== --- head/usr.sbin/config/config.h Thu Sep 28 11:26:37 2017 (r324081) +++ head/usr.sbin/config/config.h Thu Sep 28 12:43:25 2017 (r324082) @@ -152,7 +152,7 @@ struct includepath { SLIST_HEAD(, includepath) includepath; /* - * Tag present in the kernelconf.tmlp template file. It's mandatory for those + * Tag present in the kernconf.tmpl template file. It's mandatory for those * two strings to be the same. Otherwise you'll get into trouble. */ #define KERNCONFTAG "%%KERNCONFFILE%%" From owner-svn-src-head@freebsd.org Thu Sep 28 15:58:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F38ACE02216; Thu, 28 Sep 2017 15:58:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C116A63C27; Thu, 28 Sep 2017 15:58:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SFwfK5026296; Thu, 28 Sep 2017 15:58:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SFwf4H026295; Thu, 28 Sep 2017 15:58:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709281558.v8SFwf4H026295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 28 Sep 2017 15:58:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324086 - head/usr.sbin/diskinfo X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/diskinfo X-SVN-Commit-Revision: 324086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 15:58:43 -0000 Author: mav Date: Thu Sep 28 15:58:41 2017 New Revision: 324086 URL: https://svnweb.freebsd.org/changeset/base/324086 Log: Alike to ZFS disable cache flush after first ENOTSUP error. MFC after: 1 week Modified: head/usr.sbin/diskinfo/diskinfo.c Modified: head/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- head/usr.sbin/diskinfo/diskinfo.c Thu Sep 28 15:23:38 2017 (r324085) +++ head/usr.sbin/diskinfo/diskinfo.c Thu Sep 28 15:58:41 2017 (r324086) @@ -630,7 +630,7 @@ slogbench(int fd, int isreg, off_t mediasize, u_int se { off_t off; u_int size; - int error, n, N; + int error, n, N, nowritecache = 0; printf("Synchronous random writes:\n"); for (size = sectorsize; size <= MAXTX; size *= 2) { @@ -641,12 +641,18 @@ slogbench(int fd, int isreg, off_t mediasize, u_int se for (n = 0; n < 250; n++) { off = random() % (mediasize / size); parwrite(fd, size, off * size); + if (nowritecache) + continue; if (isreg) error = fsync(fd); else error = ioctl(fd, DIOCGFLUSH); - if (error < 0) - err(EX_IOERR, "Flush error"); + if (error < 0) { + if (errno == ENOTSUP) + nowritecache = 1; + else + err(EX_IOERR, "Flush error"); + } } N += 250; } while (delta_t() < 1.0); From owner-svn-src-head@freebsd.org Thu Sep 28 17:55:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9549E0515C; Thu, 28 Sep 2017 17:55:42 +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 9B58C67BFD; Thu, 28 Sep 2017 17:55:42 +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 v8SHtfRP075737; Thu, 28 Sep 2017 17:55:41 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SHtfL4075736; Thu, 28 Sep 2017 17:55:41 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709281755.v8SHtfL4075736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 28 Sep 2017 17:55:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324087 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 324087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 17:55:43 -0000 Author: alc Date: Thu Sep 28 17:55:41 2017 New Revision: 324087 URL: https://svnweb.freebsd.org/changeset/base/324087 Log: Optimize vm_object_page_remove() by eliminating pointless calls to pmap_remove_all(). If the object to which a page belongs has no references, then that page cannot possibly be mapped. Reviewed by: kib MFC after: 1 week Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu Sep 28 15:58:41 2017 (r324086) +++ head/sys/vm/vm_object.c Thu Sep 28 17:55:41 2017 (r324087) @@ -1990,7 +1990,8 @@ again: goto again; } if (p->wire_count != 0) { - if ((options & OBJPR_NOTMAPPED) == 0) + if ((options & OBJPR_NOTMAPPED) == 0 && + object->ref_count != 0) pmap_remove_all(p); if ((options & OBJPR_CLEANONLY) == 0) { p->valid = 0; @@ -2007,12 +2008,13 @@ again: KASSERT((p->flags & PG_FICTITIOUS) == 0, ("vm_object_page_remove: page %p is fictitious", p)); if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) { - if ((options & OBJPR_NOTMAPPED) == 0) + if ((options & OBJPR_NOTMAPPED) == 0 && + object->ref_count != 0) pmap_remove_write(p); - if (p->dirty) + if (p->dirty != 0) continue; } - if ((options & OBJPR_NOTMAPPED) == 0) + if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0) pmap_remove_all(p); p->flags &= ~PG_ZERO; if (vm_page_free_prep(p, false)) From owner-svn-src-head@freebsd.org Thu Sep 28 19:33:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21B15E07477; Thu, 28 Sep 2017 19:33:38 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFF5C6B36C; Thu, 28 Sep 2017 19:33:37 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SJXblQ017504; Thu, 28 Sep 2017 19:33:37 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SJXbUo017503; Thu, 28 Sep 2017 19:33:37 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201709281933.v8SJXbUo017503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Thu, 28 Sep 2017 19:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324088 - head/sys/dev/smc X-SVN-Group: head X-SVN-Commit-Author: n_hibma X-SVN-Commit-Paths: head/sys/dev/smc X-SVN-Commit-Revision: 324088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 19:33:38 -0000 Author: n_hibma Date: Thu Sep 28 19:33:36 2017 New Revision: 324088 URL: https://svnweb.freebsd.org/changeset/base/324088 Log: Make this compile with DEVICE_POLLING set. smc_poll had the wrong prototype. It returns 0 as it does not check anything but submits a taskqueue. Reviewed by: benno MFC after: 2 weeks Modified: head/sys/dev/smc/if_smc.c Modified: head/sys/dev/smc/if_smc.c ============================================================================== --- head/sys/dev/smc/if_smc.c Thu Sep 28 17:55:41 2017 (r324087) +++ head/sys/dev/smc/if_smc.c Thu Sep 28 19:33:36 2017 (r324088) @@ -782,7 +782,7 @@ smc_task_rx(void *context, int pending) } #ifdef DEVICE_POLLING -static void +static int smc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct smc_softc *sc; @@ -792,12 +792,13 @@ smc_poll(struct ifnet *ifp, enum poll_cmd cmd, int cou SMC_LOCK(sc); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { SMC_UNLOCK(sc); - return; + return (0); } SMC_UNLOCK(sc); if (cmd == POLL_AND_CHECK_STATUS) taskqueue_enqueue(sc->smc_tq, &sc->smc_intr); + return (0); } #endif From owner-svn-src-head@freebsd.org Thu Sep 28 19:57:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 296E6E07ACA; Thu, 28 Sep 2017 19:57:48 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED19C6BE6F; Thu, 28 Sep 2017 19:57:47 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SJvlwS026136; Thu, 28 Sep 2017 19:57:47 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SJvlDX026135; Thu, 28 Sep 2017 19:57:47 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201709281957.v8SJvlDX026135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Thu, 28 Sep 2017 19:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324089 - head/sys/dev/neta X-SVN-Group: head X-SVN-Commit-Author: n_hibma X-SVN-Commit-Paths: head/sys/dev/neta X-SVN-Commit-Revision: 324089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 19:57:48 -0000 Author: n_hibma Date: Thu Sep 28 19:57:46 2017 New Revision: 324089 URL: https://svnweb.freebsd.org/changeset/base/324089 Log: Make this compile if NO_SYSCTL_DESCR is defined. Defining a variable with the description and then only use it in the SYSCTL declaration led to an unused variable warning. In the SYSCTL the passed value is discarded using __DESCR. Modified: head/sys/dev/neta/if_mvneta.c Modified: head/sys/dev/neta/if_mvneta.c ============================================================================== --- head/sys/dev/neta/if_mvneta.c Thu Sep 28 19:33:36 2017 (r324088) +++ head/sys/dev/neta/if_mvneta.c Thu Sep 28 19:57:46 2017 (r324089) @@ -3411,6 +3411,7 @@ sysctl_mvneta_init(struct mvneta_softc *sc) }; #undef MVNETA_SYSCTL_NAME +#ifndef NO_SYSCTL_DESCR #define MVNETA_SYSCTL_DESCR(num) "configuration parameters for queue " # num static const char *sysctl_queue_descrs[] = { MVNETA_SYSCTL_DESCR(0), MVNETA_SYSCTL_DESCR(1), @@ -3419,6 +3420,7 @@ sysctl_mvneta_init(struct mvneta_softc *sc) MVNETA_SYSCTL_DESCR(6), MVNETA_SYSCTL_DESCR(7), }; #undef MVNETA_SYSCTL_DESCR +#endif ctx = device_get_sysctl_ctx(sc->dev); @@ -3442,15 +3444,14 @@ sysctl_mvneta_init(struct mvneta_softc *sc) */ /* dev.mvneta.[unit].mib. */ for (i = 0; i < MVNETA_PORTMIB_NOCOUNTER; i++) { - const char *name = mvneta_mib_list[i].sysctl_name; - const char *desc = mvneta_mib_list[i].desc; struct mvneta_sysctl_mib *mib_arg = &sc->sysctl_mib[i]; mib_arg->sc = sc; mib_arg->index = i; - SYSCTL_ADD_PROC(ctx, mchildren, OID_AUTO, name, + SYSCTL_ADD_PROC(ctx, mchildren, OID_AUTO, + mvneta_mib_list[i].sysctl_name, CTLTYPE_U64|CTLFLAG_RD, (void *)mib_arg, 0, - sysctl_read_mib, "I", desc); + sysctl_read_mib, "I", mvneta_mib_list[i].desc); } SYSCTL_ADD_UQUAD(ctx, mchildren, OID_AUTO, "rx_discard", CTLFLAG_RD, &sc->counter_pdfc, "Port Rx Discard Frame Counter"); From owner-svn-src-head@freebsd.org Thu Sep 28 22:33:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48603E0DE6A; Thu, 28 Sep 2017 22:33:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19E78707A2; Thu, 28 Sep 2017 22:33:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SMX2ru092275; Thu, 28 Sep 2017 22:33:02 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SMX2b3092271; Thu, 28 Sep 2017 22:33:02 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709282233.v8SMX2b3092271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 28 Sep 2017 22:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324090 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 324090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 22:33:03 -0000 Author: rmacklem Date: Thu Sep 28 22:33:01 2017 New Revision: 324090 URL: https://svnweb.freebsd.org/changeset/base/324090 Log: Change nfsv4_getipaddr() and nfsrpc_fillsa() to not use sockaddr_storage. This patch changes nfsv4_getipaddr() and nfsrpc_fillsa() to use a sockaddr_in * and sockaddr_in6 * instead of sockaddr_storage, to avoid allocating the latter on the stack. It also moves the nfsrpc_fillsa() call to after the completion of parsing of the DeviceInfo reply from the server. This patch is in preparation for addition of Flex File Layout support in a future commit. It only affects the "pnfs" NFSv4.1 client mount option and should not have changed its semantics. Modified: head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Sep 28 19:57:46 2017 (r324089) +++ head/sys/fs/nfs/nfs_commonsubs.c Thu Sep 28 22:33:01 2017 (r324090) @@ -3938,14 +3938,13 @@ newnfs_sndunlock(int *flagp) } APPLESTATIC int -nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_storage *sa, - int *isudp) +nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_in *sin, + struct sockaddr_in6 *sin6, sa_family_t *saf, int *isudp) { - struct sockaddr_in *sad; - struct sockaddr_in6 *sad6; struct in_addr saddr; uint32_t portnum, *tl; - int af = 0, i, j, k; + int i, j, k; + sa_family_t af = AF_UNSPEC; char addr[64], protocol[5], *cp; int cantparse = 0, error = 0; uint16_t portv; @@ -4023,20 +4022,20 @@ nfsv4_getipaddr(struct nfsrv_descript *nd, struct sock cantparse = 1; if (cantparse == 0) { if (af == AF_INET) { - sad = (struct sockaddr_in *)sa; - if (inet_pton(af, addr, &sad->sin_addr) == 1) { - sad->sin_len = sizeof(*sad); - sad->sin_family = AF_INET; - sad->sin_port = htons(portv); + if (inet_pton(af, addr, &sin->sin_addr) == 1) { + sin->sin_len = sizeof(*sin); + sin->sin_family = AF_INET; + sin->sin_port = htons(portv); + *saf = af; return (0); } } else { - sad6 = (struct sockaddr_in6 *)sa; - if (inet_pton(af, addr, &sad6->sin6_addr) + if (inet_pton(af, addr, &sin6->sin6_addr) == 1) { - sad6->sin6_len = sizeof(*sad6); - sad6->sin6_family = AF_INET6; - sad6->sin6_port = htons(portv); + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_family = AF_INET6; + sin6->sin6_port = htons(portv); + *saf = af; return (0); } } Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu Sep 28 19:57:46 2017 (r324089) +++ head/sys/fs/nfs/nfs_var.h Thu Sep 28 22:33:01 2017 (r324090) @@ -287,8 +287,8 @@ void nfsrv_cleanusergroup(void); int nfsrv_checkutf8(u_int8_t *, int); int newnfs_sndlock(int *); void newnfs_sndunlock(int *); -int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_storage *, - int *); +int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_in *, + struct sockaddr_in6 *, sa_family_t *, int *); int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *, struct mbuf **, uint16_t); void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **); Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Thu Sep 28 19:57:46 2017 (r324089) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Thu Sep 28 22:33:01 2017 (r324090) @@ -109,8 +109,8 @@ static int nfsrpc_setaclrpc(vnode_t, struct ucred *, N static int nfsrpc_getlayout(struct nfsmount *, vnode_t, struct nfsfh *, int, uint32_t *, nfsv4stateid_t *, uint64_t, struct nfscllayout **, struct ucred *, NFSPROC_T *); -static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_storage *, - struct nfsclds **, NFSPROC_T *); +static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_in *, + struct sockaddr_in6 *, sa_family_t, int, struct nfsclds **, NFSPROC_T *); static void nfscl_initsessionslots(struct nfsclsession *); static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *, nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *, @@ -4885,14 +4885,17 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de uint32_t cnt, *tl; struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; - struct sockaddr_storage ss; - struct nfsclds *dsp = NULL, **dspp; + struct sockaddr_in sin, ssin; + struct sockaddr_in6 sin6, ssin6; + struct nfsclds *dsp = NULL, **dspp, **gotdspp; struct nfscldevinfo *ndi; - int addrcnt, bitcnt, error, i, isudp, j, pos, safilled, stripecnt; + int addrcnt = 0, bitcnt, error, gotvers, i, isudp, j, stripecnt; uint8_t stripeindex; + sa_family_t af, safilled; *ndip = NULL; ndi = NULL; + gotdspp = NULL; nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0, 0); NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED); @@ -4960,7 +4963,7 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de } /* Now, dissect the server address(es). */ - safilled = 0; + safilled = AF_UNSPEC; for (i = 0; i < addrcnt; i++) { NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); cnt = fxdr_unsigned(uint32_t, *tl); @@ -4970,61 +4973,65 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de goto nfsmout; } dspp = nfsfldi_addr(ndi, i); - pos = arc4random() % cnt; /* Choose one. */ - safilled = 0; + safilled = AF_UNSPEC; for (j = 0; j < cnt; j++) { - error = nfsv4_getipaddr(nd, &ss, &isudp); + error = nfsv4_getipaddr(nd, &sin, &sin6, &af, + &isudp); if (error != 0 && error != EPERM) { error = NFSERR_BADXDR; goto nfsmout; } if (error == 0 && isudp == 0) { /* - * The algorithm is: - * - use "pos" entry if it is of the - * same af_family or none of them - * is of the same af_family - * else - * - use the first one of the same - * af_family. + * The priority is: + * - Same address family. + * Save the address and dspp, so that + * the connection can be done after + * parsing is complete. */ - if ((safilled == 0 && ss.ss_family == - nmp->nm_nam->sa_family) || - (j == pos && - (safilled == 0 || ss.ss_family == - nmp->nm_nam->sa_family)) || - (safilled == 1 && ss.ss_family == - nmp->nm_nam->sa_family)) { - error = nfsrpc_fillsa(nmp, &ss, - &dsp, p); - if (error == 0) { - *dspp = dsp; - if (ss.ss_family == - nmp->nm_nam->sa_family) - safilled = 2; - else - safilled = 1; - } + if (safilled == AF_UNSPEC || + (af == nmp->nm_nam->sa_family && + safilled != nmp->nm_nam->sa_family) + ) { + if (af == AF_INET) + ssin = sin; + else + ssin6 = sin6; + safilled = af; + gotdspp = dspp; } } } - if (safilled == 0) - break; } + gotvers = NFS_VER4; /* Always NFSv4 for File Layout. */ + /* And the notify bits. */ NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); - if (safilled != 0) { - bitcnt = fxdr_unsigned(int, *tl); - if (bitcnt > 0) { - NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); - if (notifybitsp != NULL) - *notifybitsp = - fxdr_unsigned(uint32_t, *tl); - } + bitcnt = fxdr_unsigned(int, *tl); + if (bitcnt > 0) { + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (notifybitsp != NULL) + *notifybitsp = + fxdr_unsigned(uint32_t, *tl); + } + if (safilled != AF_UNSPEC) { + KASSERT(ndi != NULL, ("ndi is NULL")); *ndip = ndi; } else error = EPERM; + if (error == 0) { + /* + * Now we can do a TCP connection for the correct + * NFS version and IP address. + */ + error = nfsrpc_fillsa(nmp, &ssin, &ssin6, safilled, + gotvers, &dsp, p); + } + if (error == 0) { + KASSERT(gotdspp != NULL, ("gotdspp is NULL")); + *gotdspp = dsp; + } } if (nd->nd_repstat != 0) error = nd->nd_repstat; @@ -5213,11 +5220,12 @@ nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, str * mount point and a pointer to it is returned. */ static int -nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_storage *ssp, - struct nfsclds **dspp, NFSPROC_T *p) +nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, + struct sockaddr_in6 *sin6, sa_family_t af, int vers, struct nfsclds **dspp, + NFSPROC_T *p) { - struct sockaddr_in *msad, *sad, *ssd; - struct sockaddr_in6 *msad6, *sad6, *ssd6; + struct sockaddr_in *msad, *sad; + struct sockaddr_in6 *msad6, *sad6; struct nfsclclient *clp; struct nfssockreq *nrp; struct nfsclds *dsp, *tdsp; @@ -5232,10 +5240,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st NFSUNLOCKCLSTATE(); if (clp == NULL) return (EPERM); - if (ssp->ss_family == AF_INET) { - ssd = (struct sockaddr_in *)ssp; + if (af == AF_INET) { NFSLOCKMNT(nmp); - /* * Check to see if we already have a session for this * address that is usable for a DS. @@ -5246,8 +5252,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st tdsp = TAILQ_FIRST(&nmp->nm_sess); while (tdsp != NULL) { if (msad != NULL && msad->sin_family == AF_INET && - ssd->sin_addr.s_addr == msad->sin_addr.s_addr && - ssd->sin_port == msad->sin_port && + sin->sin_addr.s_addr == msad->sin_addr.s_addr && + sin->sin_port == msad->sin_port && (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; @@ -5268,14 +5274,12 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st sad = malloc(sizeof(*sad), M_SONAME, M_WAITOK | M_ZERO); sad->sin_len = sizeof(*sad); sad->sin_family = AF_INET; - sad->sin_port = ssd->sin_port; - sad->sin_addr.s_addr = ssd->sin_addr.s_addr; + sad->sin_port = sin->sin_port; + sad->sin_addr.s_addr = sin->sin_addr.s_addr; nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); nrp->nr_nam = (struct sockaddr *)sad; - } else if (ssp->ss_family == AF_INET6) { - ssd6 = (struct sockaddr_in6 *)ssp; + } else if (af == AF_INET6) { NFSLOCKMNT(nmp); - /* * Check to see if we already have a session for this * address that is usable for a DS. @@ -5286,9 +5290,9 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st tdsp = TAILQ_FIRST(&nmp->nm_sess); while (tdsp != NULL) { if (msad6 != NULL && msad6->sin6_family == AF_INET6 && - IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr, + IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &msad6->sin6_addr) && - ssd6->sin6_port == msad6->sin6_port && + sin6->sin6_port == msad6->sin6_port && (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; @@ -5308,8 +5312,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st sad6 = malloc(sizeof(*sad6), M_SONAME, M_WAITOK | M_ZERO); sad6->sin6_len = sizeof(*sad6); sad6->sin6_family = AF_INET6; - sad6->sin6_port = ssd6->sin6_port; - NFSBCOPY(&ssd6->sin6_addr, &sad6->sin6_addr, + sad6->sin6_port = sin6->sin6_port; + NFSBCOPY(&sin6->sin6_addr, &sad6->sin6_addr, sizeof(struct in6_addr)); nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); nrp->nr_nam = (struct sockaddr *)sad6; @@ -5319,7 +5323,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st nrp->nr_sotype = SOCK_STREAM; mtx_init(&nrp->nr_mtx, "nfssock", NULL, MTX_DEF); nrp->nr_prog = NFS_PROG; - nrp->nr_vers = NFS_VER4; + nrp->nr_vers = vers; /* * Use the credentials that were used for the mount, which are From owner-svn-src-head@freebsd.org Thu Sep 28 23:05:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82FC0E0E692; Thu, 28 Sep 2017 23:05:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4524171469; Thu, 28 Sep 2017 23:05:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SN59Uw004941; Thu, 28 Sep 2017 23:05:09 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8SN599s004940; Thu, 28 Sep 2017 23:05:09 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709282305.v8SN599s004940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 28 Sep 2017 23:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324091 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 324091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Sep 2017 23:05:10 -0000 Author: rmacklem Date: Thu Sep 28 23:05:08 2017 New Revision: 324091 URL: https://svnweb.freebsd.org/changeset/base/324091 Log: Add the NFS client state flag that enables Flexible File Layout. This patch adds a NFSSTA_FLEXFILE flag that will be used to enable Flexible File Layout for the NFSv4.1 pNFS client. It is not yet used, but will be after a future commit adds Flex File Layout support. Modified: head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Thu Sep 28 22:33:01 2017 (r324090) +++ head/sys/fs/nfs/nfsport.h Thu Sep 28 23:05:08 2017 (r324091) @@ -896,6 +896,7 @@ int newnfs_realign(struct mbuf **, int); #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */ #define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */ #define NFSSTA_OPENMODE 0x00200000 /* Must use correct open mode */ +#define NFSSTA_FLEXFILE 0x00800000 /* Use Flex File Layout */ #define NFSSTA_NOLAYOUTCOMMIT 0x04000000 /* Don't do LayoutCommit */ #define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */ #define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */ @@ -926,6 +927,7 @@ int newnfs_realign(struct mbuf **, int); #define NFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT) #define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST) #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS) +#define NFSHASFLEXFILE(n) ((n)->nm_state & NFSSTA_FLEXFILE) #define NFSHASOPENMODE(n) ((n)->nm_state & NFSSTA_OPENMODE) #define NFSHASONEOPENOWN(n) (((n)->nm_flag & NFSMNT_ONEOPENOWN) != 0 && \ (n)->nm_minorvers > 0) From owner-svn-src-head@freebsd.org Fri Sep 29 01:19:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B38C8E12333; Fri, 29 Sep 2017 01:19:23 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8272174833; Fri, 29 Sep 2017 01:19:23 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8T1JM1X058510; Fri, 29 Sep 2017 01:19:22 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8T1JMKg058508; Fri, 29 Sep 2017 01:19:22 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201709290119.v8T1JMKg058508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 29 Sep 2017 01:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324095 - in head/sys/dev/usb: . net X-SVN-Group: head X-SVN-Commit-Author: kevlo X-SVN-Commit-Paths: in head/sys/dev/usb: . net X-SVN-Commit-Revision: 324095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 01:19:23 -0000 Author: kevlo Date: Fri Sep 29 01:19:22 2017 New Revision: 324095 URL: https://svnweb.freebsd.org/changeset/base/324095 Log: Add ThinkPad USB 3.0 Ethernet Adapter. Submitted by: jh Modified: head/sys/dev/usb/net/if_ure.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_ure.c ============================================================================== --- head/sys/dev/usb/net/if_ure.c Fri Sep 29 00:01:06 2017 (r324094) +++ head/sys/dev/usb/net/if_ure.c Fri Sep 29 01:19:22 2017 (r324095) @@ -67,6 +67,7 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN */ static const STRUCT_USB_HOST_ID ure_devs[] = { #define URE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + URE_DEV(LENOVO, RTL8153, 0), URE_DEV(REALTEK, RTL8152, URE_FLAG_8152), URE_DEV(REALTEK, RTL8153, 0), #undef URE_DEV Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Sep 29 00:01:06 2017 (r324094) +++ head/sys/dev/usb/usbdevs Fri Sep 29 01:19:22 2017 (r324095) @@ -2703,6 +2703,7 @@ product LEADTEK 9531 0x2101 9531 GPS /* Lenovo products */ product LENOVO GIGALAN 0x304b USB 3.0 Ethernet product LENOVO ETHERNET 0x7203 USB 2.0 Ethernet +product LENOVO RTL8153 0x7205 USB 3.0 Ethernet /* Lexar products */ product LEXAR JUMPSHOT 0x0001 jumpSHOT CompactFlash Reader From owner-svn-src-head@freebsd.org Fri Sep 29 04:52:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8770E22F30; Fri, 29 Sep 2017 04:52:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 830667D9ED; Fri, 29 Sep 2017 04:52:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8T4qFHN048528; Fri, 29 Sep 2017 04:52:15 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8T4qFUC048526; Fri, 29 Sep 2017 04:52:15 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709290452.v8T4qFUC048526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 29 Sep 2017 04:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324097 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 324097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 04:52:16 -0000 Author: scottl Date: Fri Sep 29 04:52:15 2017 New Revision: 324097 URL: https://svnweb.freebsd.org/changeset/base/324097 Log: Convert sysctl sbuf usage to use a fully dynaic sbuf. This is strictly needed, but it silences an erroneous Coverity warning and makes the code a little more logically consistent. Also mark the sysctl as MPSAFE. Sponsored by: Netflix Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mps/mps.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Fri Sep 29 04:24:13 2017 (r324096) +++ head/sys/dev/mpr/mpr.c Fri Sep 29 04:52:15 2017 (r324097) @@ -1723,8 +1723,8 @@ mpr_setup_sysctl(struct mpr_softc *sc) } SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "debug_level", CTLTYPE_STRING | CTLFLAG_RW, sc, 0, - mpr_debug_sysctl, "A", "mpr debug level"); + OID_AUTO, "debug_level", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, + sc, 0, mpr_debug_sysctl, "A", "mpr debug level"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "disable_msix", CTLFLAG_RD, &sc->disable_msix, 0, @@ -1839,7 +1839,7 @@ mpr_debug_sysctl(SYSCTL_HANDLER_ARGS) { struct mpr_softc *sc; struct mpr_debug_string *string; - struct sbuf sbuf; + struct sbuf *sbuf; char *buffer; size_t sz; int i, len, debug, error; @@ -1850,20 +1850,20 @@ mpr_debug_sysctl(SYSCTL_HANDLER_ARGS) if (error != 0) return (error); - sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + sbuf = sbuf_new_for_sysctl(NULL, NULL, 128, req); debug = sc->mpr_debug; - sbuf_printf(&sbuf, "%#x", debug); + sbuf_printf(sbuf, "%#x", debug); sz = sizeof(mpr_debug_strings) / sizeof(mpr_debug_strings[0]); for (i = 0; i < sz; i++) { string = &mpr_debug_strings[i]; if (debug & string->flag) - sbuf_printf(&sbuf, ",%s", string->name); + sbuf_printf(sbuf, ",%s", string->name); } - error = sbuf_finish(&sbuf); - sbuf_delete(&sbuf); + error = sbuf_finish(sbuf); + sbuf_delete(sbuf); if (error || req->newptr == NULL) return (error); Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Fri Sep 29 04:24:13 2017 (r324096) +++ head/sys/dev/mps/mps.c Fri Sep 29 04:52:15 2017 (r324097) @@ -1585,8 +1585,8 @@ mps_setup_sysctl(struct mps_softc *sc) } SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "debug_level", CTLTYPE_STRING | CTLFLAG_RW, sc, 0, - mps_debug_sysctl, "A", "mps debug level"); + OID_AUTO, "debug_level", CTLTYPE_STRING | CTLFLAG_RW |CTLFLAG_MPSAFE, + sc, 0, mps_debug_sysctl, "A", "mps debug level"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "disable_msix", CTLFLAG_RD, &sc->disable_msix, 0, @@ -1679,7 +1679,7 @@ mps_setup_sysctl(struct mps_softc *sc) "Use the phy number for enumeration"); } -struct mps_debug_string { +static struct mps_debug_string { char *name; int flag; } mps_debug_strings[] = { @@ -1701,7 +1701,7 @@ mps_debug_sysctl(SYSCTL_HANDLER_ARGS) { struct mps_softc *sc; struct mps_debug_string *string; - struct sbuf sbuf; + struct sbuf *sbuf; char *buffer; size_t sz; int i, len, debug, error; @@ -1712,20 +1712,20 @@ mps_debug_sysctl(SYSCTL_HANDLER_ARGS) if (error != 0) return (error); - sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + sbuf = sbuf_new_for_sysctl(NULL, NULL, 128, req); debug = sc->mps_debug; - sbuf_printf(&sbuf, "%#x", debug); + sbuf_printf(sbuf, "%#x", debug); sz = sizeof(mps_debug_strings) / sizeof(mps_debug_strings[0]); for (i = 0; i < sz; i++) { string = &mps_debug_strings[i]; if (debug & string->flag) - sbuf_printf(&sbuf, ",%s", string->name); + sbuf_printf(sbuf, ",%s", string->name); } - error = sbuf_finish(&sbuf); - sbuf_delete(&sbuf); + error = sbuf_finish(sbuf); + sbuf_delete(sbuf); if (error || req->newptr == NULL) return (error); From owner-svn-src-head@freebsd.org Fri Sep 29 06:24:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4BA6E2497F; Fri, 29 Sep 2017 06:24:46 +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 85E327FB55; Fri, 29 Sep 2017 06:24:46 +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 v8T6OjXo085431; Fri, 29 Sep 2017 06:24:45 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8T6Ojhq085430; Fri, 29 Sep 2017 06:24:45 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201709290624.v8T6Ojhq085430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 29 Sep 2017 06:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324098 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 324098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 06:24:46 -0000 Author: ae Date: Fri Sep 29 06:24:45 2017 New Revision: 324098 URL: https://svnweb.freebsd.org/changeset/base/324098 Log: Some mbuf related fixes in icmp_error() * check mbuf length before doing mtod() and accessing to IP header; * update oip pointer and all depending pointers after m_pullup(); * remove extra checks and extra parentheses, wrap long lines; PR: 222670 Reported by: Prabhakar Lakhera MFC after: 1 week Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Fri Sep 29 04:52:15 2017 (r324097) +++ head/sys/netinet/ip_icmp.c Fri Sep 29 06:24:45 2017 (r324098) @@ -185,17 +185,14 @@ kmod_icmpstat_inc(int statnum) void icmp_error(struct mbuf *n, int type, int code, uint32_t dest, int mtu) { - struct ip *oip = mtod(n, struct ip *), *nip; - unsigned oiphlen = oip->ip_hl << 2; + struct ip *oip, *nip; struct icmp *icp; struct mbuf *m; - unsigned icmplen, icmpelen, nlen; + unsigned icmplen, icmpelen, nlen, oiphlen; - KASSERT((u_int)type <= ICMP_MAXTYPE, ("%s: illegal ICMP type", __func__)); -#ifdef ICMPPRINTFS - if (icmpprintfs) - printf("icmp_error(%p, %x, %d)\n", oip, type, code); -#endif + KASSERT((u_int)type <= ICMP_MAXTYPE, ("%s: illegal ICMP type", + __func__)); + if (type != ICMP_REDIRECT) ICMPSTAT_INC(icps_error); /* @@ -207,19 +204,28 @@ icmp_error(struct mbuf *n, int type, int code, uint32_ */ if (n->m_flags & M_DECRYPTED) goto freeit; - if (oip->ip_off & htons(~(IP_MF|IP_DF))) - goto freeit; if (n->m_flags & (M_BCAST|M_MCAST)) goto freeit; + + /* Drop if IP header plus 8 bytes is not contiguous in first mbuf. */ + if (n->m_len < sizeof(struct ip) + ICMP_MINLEN) + goto freeit; + oip = mtod(n, struct ip *); + oiphlen = oip->ip_hl << 2; + if (n->m_len < oiphlen + ICMP_MINLEN) + goto freeit; +#ifdef ICMPPRINTFS + if (icmpprintfs) + printf("icmp_error(%p, %x, %d)\n", oip, type, code); +#endif + if (oip->ip_off & htons(~(IP_MF|IP_DF))) + goto freeit; if (oip->ip_p == IPPROTO_ICMP && type != ICMP_REDIRECT && - n->m_len >= oiphlen + ICMP_MINLEN && - !ICMP_INFOTYPE(((struct icmp *)((caddr_t)oip + oiphlen))->icmp_type)) { + !ICMP_INFOTYPE(((struct icmp *)((caddr_t)oip + + oiphlen))->icmp_type)) { ICMPSTAT_INC(icps_oldicmp); goto freeit; } - /* Drop if IP header plus 8 bytes is not contignous in first mbuf. */ - if (oiphlen + 8 > n->m_len) - goto freeit; /* * Calculate length to quote from original packet and * prevent the ICMP mbuf from overflowing. @@ -235,9 +241,10 @@ icmp_error(struct mbuf *n, int type, int code, uint32_ n->m_next == NULL) goto stdreply; if (n->m_len < oiphlen + sizeof(struct tcphdr) && - ((n = m_pullup(n, oiphlen + sizeof(struct tcphdr))) == NULL)) + (n = m_pullup(n, oiphlen + sizeof(struct tcphdr))) == NULL) goto freeit; - th = (struct tcphdr *)((caddr_t)oip + oiphlen); + oip = mtod(n, struct ip *); + th = mtodo(n, oiphlen); tcphlen = th->th_off << 2; if (tcphlen < sizeof(struct tcphdr)) goto freeit; @@ -245,8 +252,8 @@ icmp_error(struct mbuf *n, int type, int code, uint32_ goto freeit; if (oiphlen + tcphlen > n->m_len && n->m_next == NULL) goto stdreply; - if (n->m_len < oiphlen + tcphlen && - ((n = m_pullup(n, oiphlen + tcphlen)) == NULL)) + if (n->m_len < oiphlen + tcphlen && + (n = m_pullup(n, oiphlen + tcphlen)) == NULL) goto freeit; icmpelen = max(tcphlen, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); @@ -262,24 +269,31 @@ icmp_error(struct mbuf *n, int type, int code, uint32_ if (n->m_len < oiphlen + sizeof(struct sctphdr) && (n = m_pullup(n, oiphlen + sizeof(struct sctphdr))) == NULL) goto freeit; + oip = mtod(n, struct ip *); icmpelen = max(sizeof(struct sctphdr), min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); - sh = (struct sctphdr *)((caddr_t)oip + oiphlen); + sh = mtodo(n, oiphlen); if (ntohl(sh->v_tag) == 0 && - ntohs(oip->ip_len) >= oiphlen + sizeof(struct sctphdr) + 8 && + ntohs(oip->ip_len) >= oiphlen + + sizeof(struct sctphdr) + 8 && (n->m_len >= oiphlen + sizeof(struct sctphdr) + 8 || n->m_next != NULL)) { if (n->m_len < oiphlen + sizeof(struct sctphdr) + 8 && - (n = m_pullup(n, oiphlen + sizeof(struct sctphdr) + 8)) == NULL) + (n = m_pullup(n, oiphlen + + sizeof(struct sctphdr) + 8)) == NULL) goto freeit; + oip = mtod(n, struct ip *); + sh = mtodo(n, oiphlen); ch = (struct sctp_chunkhdr *)(sh + 1); if (ch->chunk_type == SCTP_INITIATION) { icmpelen = max(sizeof(struct sctphdr) + 8, - min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + min(V_icmp_quotelen, ntohs(oip->ip_len) - + oiphlen)); } } } else -stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); +stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - + oiphlen)); icmplen = min(oiphlen + icmpelen, nlen); if (icmplen < sizeof(struct ip)) @@ -294,7 +308,8 @@ stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs #ifdef MAC mac_netinet_icmp_reply(n, m); #endif - icmplen = min(icmplen, M_TRAILINGSPACE(m) - sizeof(struct ip) - ICMP_MINLEN); + icmplen = min(icmplen, M_TRAILINGSPACE(m) - + sizeof(struct ip) - ICMP_MINLEN); m_align(m, ICMP_MINLEN + icmplen); m->m_len = ICMP_MINLEN + icmplen; From owner-svn-src-head@freebsd.org Fri Sep 29 06:36:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 696DCE24D58; Fri, 29 Sep 2017 06:36:20 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38956800B2; Fri, 29 Sep 2017 06:36:20 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8T6aJQf089558; Fri, 29 Sep 2017 06:36:19 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8T6aJDG089556; Fri, 29 Sep 2017 06:36:19 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201709290636.v8T6aJDG089556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Fri, 29 Sep 2017 06:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324099 - in head: share/mk sys/boot X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head: share/mk sys/boot X-SVN-Commit-Revision: 324099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 06:36:20 -0000 Author: wma Date: Fri Sep 29 06:36:19 2017 New Revision: 324099 URL: https://svnweb.freebsd.org/changeset/base/324099 Log: Compile loader as Little-Endian on PPC64/POWER8 Add flag to the makefile to allow loader compilation as Little-Endian 32-bit executable. Usage: make WITH_LOADER_FORCE_LE=yes -C sys/boot all Submitted by: Wojciech Macek Reviewed by: imp, nwhitehorn Obtained from: Semihalf Sponsored by: QCM Technologies Differential revision: https://reviews.freebsd.org/D12421 Modified: head/share/mk/src.opts.mk head/sys/boot/Makefile.inc Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Sep 29 06:24:45 2017 (r324098) +++ head/share/mk/src.opts.mk Fri Sep 29 06:36:19 2017 (r324099) @@ -180,6 +180,7 @@ __DEFAULT_NO_OPTIONS = \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ + LOADER_FORCE_LE \ NAND \ OFED \ OPENLDAP \ Modified: head/sys/boot/Makefile.inc ============================================================================== --- head/sys/boot/Makefile.inc Fri Sep 29 06:24:45 2017 (r324098) +++ head/sys/boot/Makefile.inc Fri Sep 29 06:36:19 2017 (r324099) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include SSP_CFLAGS= @@ -22,3 +22,11 @@ CFLAGS.clang+= -mfpu=none # when this test succeeds rather than require dd to be a bootstrap tool. DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true DD=dd ${DD_NOSTATUS} + +.if ${MK_LOADER_FORCE_LE} != "no" + +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif + +.endif From owner-svn-src-head@freebsd.org Fri Sep 29 07:44:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C5E7E2629F; Fri, 29 Sep 2017 07:44:49 +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 39A4981DE1; Fri, 29 Sep 2017 07:44:49 +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 v8T7imkE017936; Fri, 29 Sep 2017 07:44:48 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8T7imbn017935; Fri, 29 Sep 2017 07:44:48 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709290744.v8T7imbn017935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 29 Sep 2017 07:44:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324100 - head/usr.bin/man X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.bin/man X-SVN-Commit-Revision: 324100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 07:44:49 -0000 Author: bapt Date: Fri Sep 29 07:44:48 2017 New Revision: 324100 URL: https://svnweb.freebsd.org/changeset/base/324100 Log: man(1): silent the output of mandoc when testing This reduce the spam a user may face when mandoc tries to figure out if it can renders a manpage or fallback on groff(1) Reported by: bdrewery MFC after: 3 days Modified: head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Fri Sep 29 06:36:19 2017 (r324099) +++ head/usr.bin/man/man.sh Fri Sep 29 07:44:48 2017 (r324100) @@ -333,7 +333,7 @@ man_display_page() { if [ -n "$use_width" ]; then mandoc_args="-O width=${use_width}" fi - testline="mandoc -Tlint -Wunsupp 2>/dev/null" + testline="mandoc -Tlint -Wunsupp >/dev/null 2>&1" if [ -n "$tflag" ]; then pipeline="mandoc -Tps $mandoc_args" else From owner-svn-src-head@freebsd.org Fri Sep 29 15:53:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CBDCE2F8CD; Fri, 29 Sep 2017 15:53:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C5396B29E; Fri, 29 Sep 2017 15:53:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8TFrQFZ022221; Fri, 29 Sep 2017 15:53:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TFrQbu022220; Fri, 29 Sep 2017 15:53:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709291553.v8TFrQbu022220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 29 Sep 2017 15:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324102 - head/sys/netsmb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/netsmb X-SVN-Commit-Revision: 324102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 15:53:27 -0000 Author: cem Date: Fri Sep 29 15:53:26 2017 New Revision: 324102 URL: https://svnweb.freebsd.org/changeset/base/324102 Log: netsmb: Fix buggy/racy smb_strdupin() smb_strdupin() tried to roll a copyin() based strlen to allocate a buffer and then blindly copyin that size. Of course, a malicious user program could simultaneously manipulate the buffer, resulting in a non-terminated string being copied. Later assumptions in the code rely upon the string being nul-terminated. Just use copyinstr() and drop the racy sizing. PR: 222687 Reported by: Meng Xu Security: possible local DoS Sponsored by: Dell EMC Isilon Modified: head/sys/netsmb/smb_subr.c Modified: head/sys/netsmb/smb_subr.c ============================================================================== --- head/sys/netsmb/smb_subr.c Fri Sep 29 15:13:28 2017 (r324101) +++ head/sys/netsmb/smb_subr.c Fri Sep 29 15:53:26 2017 (r324102) @@ -110,22 +110,11 @@ smb_strdup(const char *s) char * smb_strdupin(char *s, size_t maxlen) { - char *p, bt; + char *p; int error; - size_t len; - len = 0; - for (p = s; ;p++) { - if (copyin(p, &bt, 1)) - return NULL; - len++; - if (maxlen && len > maxlen) - return NULL; - if (bt == 0) - break; - } - p = malloc(len, M_SMBSTR, M_WAITOK); - error = copyin(s, p, len); + p = malloc(maxlen + 1, M_SMBSTR, M_WAITOK); + error = copyinstr(s, p, maxlen + 1, NULL); if (error) { free(p, M_SMBSTR); return (NULL); From owner-svn-src-head@freebsd.org Fri Sep 29 16:30:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A3DFE3008E; Fri, 29 Sep 2017 16:30:51 +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 230CF6C6F5; Fri, 29 Sep 2017 16:30:51 +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 v8TGUoTc038156; Fri, 29 Sep 2017 16:30:50 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TGUo8N038154; Fri, 29 Sep 2017 16:30:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201709291630.v8TGUo8N038154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 29 Sep 2017 16:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324103 - head/lib/libc/locale X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/lib/libc/locale X-SVN-Commit-Revision: 324103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 16:30:51 -0000 Author: bdrewery Date: Fri Sep 29 16:30:50 2017 New Revision: 324103 URL: https://svnweb.freebsd.org/changeset/base/324103 Log: __setrunelocale: Fix asprintf(3) failure not returning an error. Also fix the style of the asprintf(3) call in __collate_load_tables_l(). Both of these lines were modified away from snprintf(3) during the import from DragonFly/Illumos. Reviewed by: jilles (briefly over shoulder) MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libc/locale/collate.c head/lib/libc/locale/setrunelocale.c Modified: head/lib/libc/locale/collate.c ============================================================================== --- head/lib/libc/locale/collate.c Fri Sep 29 15:53:26 2017 (r324102) +++ head/lib/libc/locale/collate.c Fri Sep 29 16:30:50 2017 (r324103) @@ -125,8 +125,7 @@ __collate_load_tables_l(const char *encoding, struct x return (_LDP_CACHE); } - asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding); - if (buf == NULL) + if (asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding) == -1) return (_LDP_ERROR); if ((fd = _open(buf, O_RDONLY)) < 0) { Modified: head/lib/libc/locale/setrunelocale.c ============================================================================== --- head/lib/libc/locale/setrunelocale.c Fri Sep 29 15:53:26 2017 (r324102) +++ head/lib/libc/locale/setrunelocale.c Fri Sep 29 16:30:50 2017 (r324103) @@ -110,9 +110,8 @@ __setrunelocale(struct xlocale_ctype *l, const char *e } /* Range checking not needed, encoding length already checked before */ - asprintf(&path, "%s/%s/LC_CTYPE", _PathLocale, encoding); - if (path == NULL) - return (0); + if (asprintf(&path, "%s/%s/LC_CTYPE", _PathLocale, encoding) == -1) + return (errno); if ((rl = _Read_RuneMagi(path)) == NULL) { free(path); From owner-svn-src-head@freebsd.org Fri Sep 29 19:56:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C20E4E33FED; Fri, 29 Sep 2017 19:56:10 +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 8E7547352F; Fri, 29 Sep 2017 19:56:10 +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 v8TJu91c023954; Fri, 29 Sep 2017 19:56:09 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TJu92e023952; Fri, 29 Sep 2017 19:56:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709291956.v8TJu92e023952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 29 Sep 2017 19:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324106 - head/sys/crypto/aesni X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/crypto/aesni X-SVN-Commit-Revision: 324106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 19:56:10 -0000 Author: cem Date: Fri Sep 29 19:56:09 2017 New Revision: 324106 URL: https://svnweb.freebsd.org/changeset/base/324106 Log: aesni(4): Fix GCC build The GCC xmmintrin.h header brokenly includes mm_malloc.h unconditionally. (The Clang version of xmmintrin.h only includes mm_malloc.h if not compiling in standalone mode.) Hack around GCC's broken header by defining the include guard macro ahead of including xmmintrin.h. Reported by: lwhsu, jhb Tested by: lwhsu Sponsored by: Dell EMC Isilon Modified: head/sys/crypto/aesni/intel_sha1.c head/sys/crypto/aesni/intel_sha256.c Modified: head/sys/crypto/aesni/intel_sha1.c ============================================================================== --- head/sys/crypto/aesni/intel_sha1.c Fri Sep 29 17:09:13 2017 (r324105) +++ head/sys/crypto/aesni/intel_sha1.c Fri Sep 29 19:56:09 2017 (r324106) @@ -59,9 +59,10 @@ __FBSDID("$FreeBSD$"); #include -#include - +#include #include + +#include void intel_sha1_step(uint32_t *digest, const char *data, uint32_t num_blks) { __m128i abcd, e0, e1; Modified: head/sys/crypto/aesni/intel_sha256.c ============================================================================== --- head/sys/crypto/aesni/intel_sha256.c Fri Sep 29 17:09:13 2017 (r324105) +++ head/sys/crypto/aesni/intel_sha256.c Fri Sep 29 19:56:09 2017 (r324106) @@ -59,9 +59,10 @@ __FBSDID("$FreeBSD$"); #include -#include - +#include #include + +#include void intel_sha256_step(uint32_t *digest, const char *data, uint32_t num_blks) { __m128i state0, state1; From owner-svn-src-head@freebsd.org Fri Sep 29 22:13:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC5F2E3610C; Fri, 29 Sep 2017 22:13:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAB4C76E47; Fri, 29 Sep 2017 22:13:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8TMDQLX081359; Fri, 29 Sep 2017 22:13:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TMDQLN081354; Fri, 29 Sep 2017 22:13:26 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709292213.v8TMDQLN081354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 29 Sep 2017 22:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324107 - in head: etc etc/defaults sbin/mdmfs X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: etc etc/defaults sbin/mdmfs X-SVN-Commit-Revision: 324107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 22:13:28 -0000 Author: ian Date: Fri Sep 29 22:13:26 2017 New Revision: 324107 URL: https://svnweb.freebsd.org/changeset/base/324107 Log: Enhance mdmfs(8) to work with tmpfs(5). Existing scripts and associated config such as rc.initdiskless, rc.d/var, and others, use mdmfs to create memory filesystems. That program accepts a size argument which allows SI suffixes and treats an unsuffixed number as a count of 512 byte sectors. That makes it difficult to convert existing scripts to use tmpfs instead of mdmfs, because tmpfs treats unsuffixed numbers as a count of bytes. The script logic to deal with existing user config that might include suffixed and unsuffixed numbers is... unpleasant. Also, there is no g'tee that tmpfs will be available. It is sometimes configured out of small-resource embedded systems to save memory and flash storage space. These changes enhance mdmfs(8) so that it accepts two new values for the 'md-device' arg: 'tmpfs' and 'auto'. With tmpfs, the program always uses tmpfs(5) (and fails if it's not available). With 'auto' the program prefers tmpfs, but falls back to using md(4) if tmpfs isn't available. It also handles the -s argument so that the mdconfig interpetation of unsuffixed numbers applies when tmpfs is used as well, so that existing user config keeps working after a switch to tmpfs. A new rc setting, mfs_type, is added to etc/defaults/rc.conf to let users force the use of tmpfs or md; the default value is "auto". Differential Revision: https://reviews.freebsd.org/D12301 Modified: head/etc/defaults/rc.conf head/etc/rc.initdiskless head/etc/rc.subr head/sbin/mdmfs/mdmfs.8 head/sbin/mdmfs/mdmfs.c Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Fri Sep 29 19:56:09 2017 (r324106) +++ head/etc/defaults/rc.conf Fri Sep 29 22:13:26 2017 (r324107) @@ -53,6 +53,7 @@ tmpmfs_flags="-S" # Extra mdmfs options for the mfs /t varmfs="AUTO" # Set to YES to always create an mfs /var, NO to never varsize="32m" # Size of mfs /var if created varmfs_flags="-S" # Extra mount options for the mfs /var +mfs_type="auto" # "md", "tmpfs", "auto" to prefer tmpfs with md as fallback populate_var="AUTO" # Set to YES to always (re)populate /var, NO to never cleanvar_enable="YES" # Clean the /var directory local_startup="/usr/local/etc/rc.d" # startup script dirs. Modified: head/etc/rc.initdiskless ============================================================================== --- head/etc/rc.initdiskless Fri Sep 29 19:56:09 2017 (r324106) +++ head/etc/rc.initdiskless Fri Sep 29 22:13:26 2017 (r324107) @@ -195,10 +195,10 @@ handle_remount() { # $1 = mount point to_umount="$b ${to_umount}" } -# Create a generic memory disk (using tmpfs) -# +# Create a generic memory disk. +# The 'auto' parameter will attempt to use tmpfs(5), falls back to md(4). mount_md() { - mount -t tmpfs -o size=$(($1 * 512)) tmpfs $2 + /sbin/mdmfs $flags -s $1 auto $2 } # Create the memory filesystem if it has not already been created Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Fri Sep 29 19:56:09 2017 (r324106) +++ head/etc/rc.subr Fri Sep 29 22:13:26 2017 (r324107) @@ -1790,7 +1790,7 @@ mount_md() if [ -n "$3" ]; then flags="$3" fi - /sbin/mdmfs $flags -s $1 md $2 + /sbin/mdmfs $flags -s $1 ${mfs_type} $2 } # Code common to scripts that need to load a kernel module Modified: head/sbin/mdmfs/mdmfs.8 ============================================================================== --- head/sbin/mdmfs/mdmfs.8 Fri Sep 29 19:56:09 2017 (r324106) +++ head/sbin/mdmfs/mdmfs.8 Fri Sep 29 22:13:26 2017 (r324107) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2016 +.Dd September 9, 2017 .Dt MDMFS 8 .Os .Sh NAME @@ -33,7 +33,9 @@ .Nm mount_mfs .Nd configure and mount an in-memory file system using the .Xr md 4 -driver +driver or the +.Xr tmpfs 5 +filesystem .Sh SYNOPSIS .Nm .Op Fl DLlMNnPStTUX @@ -63,9 +65,13 @@ utility is designed to be a work-alike and look-alike .Xr mount_mfs 8 . The end result is essentially the same, but is accomplished in a completely different way. -The +Based on +.Ar md-device , +the .Nm -utility configures an +utility either creates a +.Xr tmpfs 5 +filesystem, or it configures an .Xr md 4 disk using .Xr mdconfig 8 , @@ -81,6 +87,44 @@ compressed disk images, as long as the kernel supports All the command line options are passed to the appropriate program at the appropriate stage in order to achieve the desired effect. .Pp +When +.Ar md-device +is `auto', +.Nm +uses +.Xr tmpfs 5 +if it is present in the kernel or can be loaded as a module, +otherwise it falls back to using +.Xr md 4 +auto-unit as if `md' had been specified. +.Pp +When +.Ar md-device +is `tmpfs', +.Nm +mounts a +.Xr tmpfs 5 +filesystem, translating the +.Fl s +size option, if present, into a `-o size=' mount option. +Any +.Fl o +options on the command line are passed through to the +.Xr tmpfs 5 +mount. +Options specific to +.Xr mdconfig 8 +or +.Xr newfs 8 +are ignored. +.Pp +When +.Ar md-device +does not result in +.Xr tmpfs 5 +being used, then an +.Xr md 4 +device is configured instead. By default, .Nm creates a swap-based @@ -219,14 +263,10 @@ is .Em not specified. That is, -this will work for the default swap-backed -.Pq Dv MD_SWAP -disks, -and the optional -.Pq Fl M -.Xr malloc 9 -backed disks -.Pq Dv MD_MALLOC . +this will work when the backing storage is some form of +memory, as opposed to a fixed-size file. +The size may include the usual SI suffixes (k, m, g, t, p). +A number without a suffix is interpreted as a count of 512-byte sectors. .It Fl t Turn on the TRIM enable flag for .Xr newfs 8 . @@ -392,6 +432,7 @@ was given on the command line. .Sh SEE ALSO .Xr md 4 , .Xr fstab 5 , +.Xr tmpfs 5 , .Xr mdconfig 8 , .Xr mount 8 , .Xr newfs 8 Modified: head/sbin/mdmfs/mdmfs.c ============================================================================== --- head/sbin/mdmfs/mdmfs.c Fri Sep 29 19:56:09 2017 (r324106) +++ head/sbin/mdmfs/mdmfs.c Fri Sep 29 22:13:26 2017 (r324107) @@ -34,15 +34,19 @@ __FBSDID("$FreeBSD$"); #include +#include #include +#include #include #include #include #include #include +#include #include #include +#include #include #include #include @@ -78,7 +82,8 @@ static void debugprintf(const char *, ...) __printfli static void do_mdconfig_attach(const char *, const enum md_types); static void do_mdconfig_attach_au(const char *, const enum md_types); static void do_mdconfig_detach(void); -static void do_mount(const char *, const char *); +static void do_mount_md(const char *, const char *); +static void do_mount_tmpfs(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); static void extract_ugid(const char *, struct mtpt_info *); @@ -89,14 +94,15 @@ int main(int argc, char **argv) { struct mtpt_info mi; /* Mountpoint info. */ + intmax_t mdsize; char *mdconfig_arg, *newfs_arg, /* Args to helper programs. */ *mount_arg; enum md_types mdtype; /* The type of our memory disk. */ - bool have_mdtype; + bool have_mdtype, mlmac; bool detach, softdep, autounit, newfs; - char *mtpoint, *unitstr; + const char *mtpoint, *size_arg, *unitstr; char *p; - int ch; + int ch, idx; void *set; unsigned long ul; @@ -105,6 +111,7 @@ main(int argc, char **argv) detach = true; softdep = true; autounit = false; + mlmac = false; newfs = true; have_mdtype = false; mdtype = MD_SWAP; @@ -119,6 +126,7 @@ main(int argc, char **argv) mdconfig_arg = strdup(""); newfs_arg = strdup(""); mount_arg = strdup(""); + size_arg = NULL; /* If we were started as mount_mfs or mfs, imply -C. */ if (strcmp(getprogname(), "mount_mfs") == 0 || @@ -175,6 +183,7 @@ main(int argc, char **argv) loudsubs = true; break; case 'l': + mlmac = true; argappend(&newfs_arg, "-l"); break; case 'M': @@ -213,7 +222,7 @@ main(int argc, char **argv) softdep = false; break; case 's': - argappend(&mdconfig_arg, "-s %s", optarg); + size_arg = optarg; break; case 't': argappend(&newfs_arg, "-t"); @@ -242,42 +251,107 @@ main(int argc, char **argv) if (argc < 2) usage(); - /* Derive 'unit' (global). */ - unitstr = argv[0]; - if (strncmp(unitstr, "/dev/", 5) == 0) - unitstr += 5; - if (strncmp(unitstr, mdname, mdnamelen) == 0) - unitstr += mdnamelen; - if (!isdigit(*unitstr)) { - autounit = true; - unit = -1; - mdsuffix = unitstr; - } else { - ul = strtoul(unitstr, &p, 10); - if (ul == ULONG_MAX) - errx(1, "bad device unit: %s", unitstr); - unit = ul; - mdsuffix = p; /* can be empty */ + /* + * Historically our size arg was passed directly to mdconfig, which + * treats a number without a suffix as a count of 512-byte sectors; + * tmpfs would treat it as a count of bytes. To get predictable + * behavior for 'auto' we document that the size always uses mdconfig + * rules. To make that work, decode the size here so it can be passed + * to either tmpfs or mdconfig as a count of bytes. + */ + if (size_arg != NULL) { + mdsize = (intmax_t)strtoumax(size_arg, &p, 0); + if (p == size_arg || (p[0] != 0 && p[1] != 0) || mdsize < 0) + errx(1, "invalid size '%s'", size_arg); + switch (*p) { + case 'p': + case 'P': + mdsize *= 1024; + case 't': + case 'T': + mdsize *= 1024; + case 'g': + case 'G': + mdsize *= 1024; + case 'm': + case 'M': + mdsize *= 1024; + case 'k': + case 'K': + mdsize *= 1024; + case 'b': + case 'B': + break; + case '\0': + mdsize *= 512; + break; + default: + errx(1, "invalid size suffix on '%s'", size_arg); + } } + /* + * Based on the command line 'md-device' either mount a tmpfs filesystem + * or configure the md device then format and mount a filesystem on it. + * If the device is 'auto' use tmpfs if it is available and there is no + * request for multilabel MAC (which tmpfs does not support). + */ + unitstr = argv[0]; mtpoint = argv[1]; - if (!have_mdtype) - mdtype = MD_SWAP; - if (softdep) - argappend(&newfs_arg, "-U"); - if (mdtype != MD_VNODE && !newfs) - errx(1, "-P requires a vnode-backed disk"); - /* Do the work. */ - if (detach && !autounit) - do_mdconfig_detach(); - if (autounit) - do_mdconfig_attach_au(mdconfig_arg, mdtype); - else - do_mdconfig_attach(mdconfig_arg, mdtype); - if (newfs) - do_newfs(newfs_arg); - do_mount(mount_arg, mtpoint); + if (strcmp(unitstr, "auto") == 0) { + if (mlmac) + idx = -1; /* Must use md for mlmac. */ + else if ((idx = modfind("tmpfs")) == -1) + idx = kldload("tmpfs"); + if (idx == -1) + unitstr = "md"; + else + unitstr = "tmpfs"; + } + + if (strcmp(unitstr, "tmpfs") == 0) { + if (size_arg != NULL && mdsize != 0) + argappend(&mount_arg, "-o size=%jd", mdsize); + do_mount_tmpfs(mount_arg, mtpoint); + } else { + if (size_arg != NULL) + argappend(&mdconfig_arg, "-s %jdB", mdsize); + if (strncmp(unitstr, "/dev/", 5) == 0) + unitstr += 5; + if (strncmp(unitstr, mdname, mdnamelen) == 0) + unitstr += mdnamelen; + if (!isdigit(*unitstr)) { + autounit = true; + unit = -1; + mdsuffix = unitstr; + } else { + ul = strtoul(unitstr, &p, 10); + if (ul == ULONG_MAX) + errx(1, "bad device unit: %s", unitstr); + unit = ul; + mdsuffix = p; /* can be empty */ + } + + if (!have_mdtype) + mdtype = MD_SWAP; + if (softdep) + argappend(&newfs_arg, "-U"); + if (mdtype != MD_VNODE && !newfs) + errx(1, "-P requires a vnode-backed disk"); + + /* Do the work. */ + if (detach && !autounit) + do_mdconfig_detach(); + if (autounit) + do_mdconfig_attach_au(mdconfig_arg, mdtype); + else + do_mdconfig_attach(mdconfig_arg, mdtype); + if (newfs) + do_newfs(newfs_arg); + do_mount_md(mount_arg, mtpoint); + } + do_mtptsetup(mtpoint, &mi); return (0); @@ -434,7 +508,7 @@ do_mdconfig_detach(void) * Mount the configured memory disk. */ static void -do_mount(const char *args, const char *mtpoint) +do_mount_md(const char *args, const char *mtpoint) { int rv; @@ -442,6 +516,19 @@ do_mount(const char *args, const char *mtpoint) mdname, unit, mdsuffix, mtpoint); if (rv) errx(1, "mount exited with error code %d", rv); +} + +/* + * Mount the configured tmpfs. + */ +static void +do_mount_tmpfs(const char *args, const char *mtpoint) +{ + int rv; + + rv = run(NULL, "%s -t tmpfs %s tmp %s", _PATH_MOUNT, args, mtpoint); + if (rv) + errx(1, "tmpfs mount exited with error code %d", rv); } /* From owner-svn-src-head@freebsd.org Fri Sep 29 22:21:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0EC8E361BF; Fri, 29 Sep 2017 22:21:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0E70772C3; Fri, 29 Sep 2017 22:21:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8TMLgGR084744; Fri, 29 Sep 2017 22:21:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TMLgFr084743; Fri, 29 Sep 2017 22:21:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709292221.v8TMLgFr084743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 29 Sep 2017 22:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324108 - head/etc X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/etc X-SVN-Commit-Revision: 324108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 22:21:44 -0000 Author: ian Date: Fri Sep 29 22:21:42 2017 New Revision: 324108 URL: https://svnweb.freebsd.org/changeset/base/324108 Log: Remove spurious $flags; it's a paste-o from copying the line from rc.subr. Also, add a comment documenting the args passed to mount_md(). Modified: head/etc/rc.initdiskless Modified: head/etc/rc.initdiskless ============================================================================== --- head/etc/rc.initdiskless Fri Sep 29 22:13:26 2017 (r324107) +++ head/etc/rc.initdiskless Fri Sep 29 22:21:42 2017 (r324108) @@ -197,8 +197,9 @@ handle_remount() { # $1 = mount point # Create a generic memory disk. # The 'auto' parameter will attempt to use tmpfs(5), falls back to md(4). +# $1 is size in 512-byte sectors, $2 is the mount point. mount_md() { - /sbin/mdmfs $flags -s $1 auto $2 + /sbin/mdmfs -s $1 auto $2 } # Create the memory filesystem if it has not already been created From owner-svn-src-head@freebsd.org Fri Sep 29 23:02:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4186AE36AA3; Fri, 29 Sep 2017 23:02:51 +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 EC0F67C32B; Fri, 29 Sep 2017 23:02:50 +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 v8TN2o17002348; Fri, 29 Sep 2017 23:02:50 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TN2nTl002342; Fri, 29 Sep 2017 23:02:49 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201709292302.v8TN2nTl002342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 29 Sep 2017 23:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/hardware sys/contrib/dev/ac... X-SVN-Commit-Revision: 324109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 23:02:51 -0000 Author: jkim Date: Fri Sep 29 23:02:49 2017 New Revision: 324109 URL: https://svnweb.freebsd.org/changeset/base/324109 Log: Merge ACPICA 20170929. Added: head/sys/contrib/dev/acpica/compiler/aslallocate.c - copied, changed from r324104, vendor-sys/acpica/dist/source/compiler/aslallocate.c head/sys/contrib/dev/acpica/compiler/aslcache.c - copied, changed from r324104, vendor-sys/acpica/dist/source/compiler/aslcache.c Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/adfile.c head/sys/contrib/dev/acpica/common/ahtable.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/common/dmtbdump.c head/sys/contrib/dev/acpica/common/dmtbinfo.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/aslcompiler.l head/sys/contrib/dev/acpica/compiler/asldebug.c head/sys/contrib/dev/acpica/compiler/aslerror.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/aslhelp.c head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmapenter.c head/sys/contrib/dev/acpica/compiler/aslmaputils.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslmethod.c head/sys/contrib/dev/acpica/compiler/asloperands.c head/sys/contrib/dev/acpica/compiler/aslopt.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/aslparseop.c head/sys/contrib/dev/acpica/compiler/aslprintf.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/aslsupport.l head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/cvcompiler.c head/sys/contrib/dev/acpica/compiler/cvparser.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dtexpress.c head/sys/contrib/dev/acpica/compiler/dtfield.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dtparser.y head/sys/contrib/dev/acpica/compiler/dtsubtable.c head/sys/contrib/dev/acpica/compiler/dttable.c head/sys/contrib/dev/acpica/compiler/dttable1.c head/sys/contrib/dev/acpica/compiler/dttable2.c head/sys/contrib/dev/acpica/compiler/dttemplate.c head/sys/contrib/dev/acpica/compiler/dttemplate.h head/sys/contrib/dev/acpica/compiler/dtutils.c head/sys/contrib/dev/acpica/compiler/prexpress.c head/sys/contrib/dev/acpica/compiler/prmacros.c head/sys/contrib/dev/acpica/compiler/prparser.y head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/compiler/prutils.c head/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c head/sys/contrib/dev/acpica/components/hardware/hwtimer.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nssearch.c head/sys/contrib/dev/acpica/components/parser/psobject.c head/sys/contrib/dev/acpica/components/parser/psutils.c head/sys/contrib/dev/acpica/components/utilities/utinit.c head/sys/contrib/dev/acpica/components/utilities/utmath.c head/sys/contrib/dev/acpica/include/acapps.h head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/acexcep.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actbl1.h head/sys/contrib/dev/acpica/include/actbl2.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/dev/acpica/acpi_cpu.c head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri Sep 29 22:21:42 2017 (r324108) +++ head/sys/contrib/dev/acpica/changes.txt Fri Sep 29 23:02:49 2017 (r324109) @@ -1,4 +1,104 @@ ---------------------------------------- +29 September 2017. Summary of changes for version 20170929: + + +1) ACPICA kernel-resident subsystem: + +Redesigned and implemented an improved ASL While() loop timeout +mechanism. This mechanism is used to prevent infinite loops in the kernel +AML interpreter caused by either non-responsive hardware or incorrect AML +code. The new implementation uses AcpiOsGetTimer instead of a simple +maximum loop count, and is thus more accurate and constant across +different machines. The default timeout is currently 30 seconds, but this +may be adjusted later. + +Renamed the ACPI_AML_INFINITE_LOOP exception to AE_AML_LOOP_TIMEOUT to +better reflect the new implementation of the loop timeout mechanism. + +Updated the AcpiGetTimerDuration interface to cleanup the 64-bit support +and to fix an off-by-one error. Jung-uk Kim. + +Fixed an EFI build problem by updating the makefiles to for a new file +that was added, utstrsuppt.c + + +2) iASL Compiler/Disassembler and Tools: + +Implemented full support for the PDTT, SDEV, and TPM2 ACPI tables. This +includes support in the table disassembler, compiler, and template +generator. + +iASL: Added an exception for an illegal type of recursive method +invocation. If a method creates named objects, the first recursive call +will fail at runtime. This change adds an error detection at compile time +to catch the problem up front. Note: Marking such a method as +"serialized" will not help with this problem, because the same thread can +acquire the method mutex more than once. Example compiler and runtime +output: + + Method (MTH1) + { + Name (INT1, 1) + MTH1 () + } + + dsdt.asl 22: MTH1 () + Error 6152 - ^ Illegal recursive call to method + that creates named objects (MTH1) + +Previous runtime exception: + ACPI Error: [INT1] Namespace lookup failure, + AE_ALREADY_EXISTS (20170831/dswload2-465) + +iASL: Updated support for External() opcodes to improve namespace +management and error detection. These changes are related to issues seen +with multiple-segment namespace pathnames within External declarations, +such as below: + + External(\_SB.PCI0.GFX0, DeviceObj) + External(\_SB.PCI0.GFX0.ALSI) + +iASL: Implemented support for multi-line error/warning messages. This +enables more detailed and helpful error messages as below, from the +initial deployment for the duplicate names error: + + DSDT.iiii 1692: Device(PEG2) { + Error 6074 - ^ Name already exists in scope +(PEG2) + + Original name creation/declaration below: + DSDT.iiii 93: External(\_SB.PCI0.PEG2, DeviceObj) + +AcpiXtract: Added additional flexibility to support differing input hex +dump formats. Specifically, hex dumps that contain partial disassembly +and/or comments within the ACPI table data definition. There exist some +dump utilities seen in the field that create this type of hex dump (such +as Simics). For example: + + DSDT @ 0xdfffd0c0 (10999 bytes) + Signature DSDT + Length 10999 + Revision 1 + Checksum 0xf3 (Ok) + OEM_ID BXPC + OEM_table_id BXDSDT + OEM_revision 1 + Creator_id 1280593481 + Creator_revision 537399345 + 0000: 44 53 44 54 f7 2a 00 00 01 f3 42 58 50 43 00 00 + ... + 2af0: 5f 4c 30 46 00 a4 01 + +Test suite: Miscellaneous changes/fixes: + More cleanup and simplification of makefiles + Continue compilation of test cases after a compile failure + Do not perform binary compare unless both files actually exist + +iASL: Performed some code/module restructuring. Moved all memory +allocation functions to new modules. Two new files, aslallocate.c and +aslcache.c + +---------------------------------------- 31 August 2017. Summary of changes for version 20170831: Modified: head/sys/contrib/dev/acpica/common/adfile.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adfile.c Fri Sep 29 22:21:42 2017 (r324108) +++ head/sys/contrib/dev/acpica/common/adfile.c Fri Sep 29 23:02:49 2017 (r324109) @@ -314,7 +314,7 @@ FlGenerateFilename ( * Copy the original filename to a new buffer. Leave room for the worst * case where we append the suffix, an added dot and the null terminator. */ - NewFilename = UtStringCacheCalloc ((ACPI_SIZE) + NewFilename = UtLocalCacheCalloc ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); strcpy (NewFilename, InputFilename); @@ -358,7 +358,7 @@ FlStrdup ( char *NewString; - NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1); + NewString = UtLocalCacheCalloc ((ACPI_SIZE) strlen (String) + 1); strcpy (NewString, String); return (NewString); } Modified: head/sys/contrib/dev/acpica/common/ahtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/ahtable.c Fri Sep 29 22:21:42 2017 (r324108) +++ head/sys/contrib/dev/acpica/common/ahtable.c Fri Sep 29 23:02:49 2017 (r324109) @@ -232,6 +232,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_MTMR, "MID Timer Table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, + {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, @@ -240,6 +241,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, + {ACPI_SIG_SDEV, "Secure Devices table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Fri Sep 29 22:21:42 2017 (r324108) +++ head/sys/contrib/dev/acpica/common/dmtable.c Fri Sep 29 23:02:49 2017 (r324109) @@ -154,7 +154,6 @@ #include #include #include -#include /* This module used for application-level code only */ @@ -290,9 +289,9 @@ static const char *AcpiDmHestSubnames[] = "IA-32 Machine Check Exception", "IA-32 Corrected Machine Check", "IA-32 Non-Maskable Interrupt", - "Unknown SubTable Type", /* 3 - Reserved */ - "Unknown SubTable Type", /* 4 - Reserved */ - "Unknown SubTable Type", /* 5 - Reserved */ + "Unknown Subtable Type", /* 3 - Reserved */ + "Unknown Subtable Type", /* 4 - Reserved */ + "Unknown Subtable Type", /* 5 - Reserved */ "PCI Express Root Port AER", "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", @@ -374,7 +373,7 @@ static const char *AcpiDmPmttSubnames[] = { "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ - "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ + "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ "Unknown Subtable Type" /* Reserved */ }; @@ -382,10 +381,17 @@ static const char *AcpiDmPpttSubnames[] = { "Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */ "Cache Type", /* ACPI_PPTT_TYPE_CACHE */ - "ID", /* ACPI_PMTT_TYPE_ID */ + "ID", /* ACPI_PPTT_TYPE_ID */ "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmSdevSubnames[] = +{ + "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */ + "PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */ + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", @@ -396,6 +402,23 @@ static const char *AcpiDmSratSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmTpm2Subnames[] = +{ + "Illegal Start Method value", + "Reserved", + "ACPI Start Method", + "Reserved", + "Reserved", + "Reserved", + "Memory Mapped I/O", + "Command Response Buffer", + "Command Response Buffer with ACPI Start Method", + "Reserved", + "Reserved", + "Command Response Buffer with ARM SMC", + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmIvrsSubnames[] = { "Hardware Definition Block", @@ -487,6 +510,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, + {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, @@ -494,6 +518,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei}, + {ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev}, {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, @@ -501,7 +526,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, - {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, + {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, @@ -917,6 +942,7 @@ AcpiDmDumpTable ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: + case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -948,6 +974,7 @@ AcpiDmDumpTable ( case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: + case ACPI_DMT_TPM2: ByteLength = 4; break; @@ -1583,6 +1610,20 @@ AcpiDmDumpTable ( CurrentOffset, NULL); break; + case ACPI_DMT_SDEV: + + /* SDEV subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_SDEV_TYPE_RESERVED) + { + Temp8 = ACPI_SDEV_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmSdevSubnames[Temp8]); + break; + case ACPI_DMT_SRAT: /* SRAT subtable types */ @@ -1596,6 +1637,22 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]); break; + + case ACPI_DMT_TPM2: + + /* TPM2 Start Method types */ + + Temp8 = *Target; + if (Temp8 > ACPI_TPM2_RESERVED) + { + Temp8 = ACPI_TPM2_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmTpm2Subnames[Temp8]); + break; + + case ACPI_DMT_FADTPM: Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump.c Fri Sep 29 22:21:42 2017 (r324108) +++ head/sys/contrib/dev/acpica/common/dmtbdump.c Fri Sep 29 23:02:49 2017 (r324109) @@ -623,7 +623,7 @@ AcpiDmDumpAsf ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); - ACPI_ASF_INFO *SubTable; + ACPI_ASF_INFO *Subtable; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMTABLE_INFO *DataInfoTable = NULL; UINT8 *DataTable = NULL; @@ -636,13 +636,13 @@ AcpiDmDumpAsf ( /* No main table, only subtables */ - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Header.Length, AcpiDmTableInfoAsfHdr); if (ACPI_FAILURE (Status)) { return; @@ -650,7 +650,7 @@ AcpiDmDumpAsf ( /* The actual type is the lower 7 bits of Type */ - Type = (UINT8) (SubTable->Header.Type & 0x7F); + Type = (UINT8) (Subtable->Header.Type & 0x7F); switch (Type) { @@ -663,9 +663,9 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf1; DataInfoTable = AcpiDmTableInfoAsf1a; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts; - DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength; + DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT)); + DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts; + DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_ALERT); break; @@ -673,9 +673,9 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf2; DataInfoTable = AcpiDmTableInfoAsf2a; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls; - DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength; + DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE)); + DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls; + DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); break; @@ -687,20 +687,20 @@ AcpiDmDumpAsf ( case ACPI_ASF_TYPE_ADDRESS: InfoTable = AcpiDmTableInfoAsf4; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS)); - DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices; + DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS)); + DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices; DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); break; default: AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", - SubTable->Header.Type); + Subtable->Header.Type); return; } - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Header.Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -762,15 +762,15 @@ AcpiDmDumpAsf ( /* Point to next subtable */ - if (!SubTable->Header.Length) + if (!Subtable->Header.Length) { AcpiOsPrintf ("Invalid zero subtable header length\n"); return; } - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, - SubTable->Header.Length); + Offset += Subtable->Header.Length; + Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, + Subtable->Header.Length); } } @@ -793,7 +793,7 @@ AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_CPEP_POLLING *SubTable; + ACPI_CPEP_POLLING *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -808,12 +808,12 @@ AcpiDmDumpCpep ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Header.Length, AcpiDmTableInfoCpep0); if (ACPI_FAILURE (Status)) { return; @@ -821,9 +821,9 @@ AcpiDmDumpCpep ( /* Point to next subtable */ - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, - SubTable->Header.Length); + Offset += Subtable->Header.Length; + Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable, + Subtable->Header.Length); } } @@ -846,9 +846,9 @@ AcpiDmDumpCsrt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_CSRT_GROUP *SubTable; + ACPI_CSRT_GROUP *Subtable; ACPI_CSRT_SHARED_INFO *SharedInfoTable; - ACPI_CSRT_DESCRIPTOR *SubSubTable; + ACPI_CSRT_DESCRIPTOR *SubSubtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CSRT); UINT32 SubOffset; @@ -860,14 +860,14 @@ AcpiDmDumpCsrt ( /* Subtables (Resource Groups) */ - SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); while (Offset < Table->Length) { /* Resource group subtable */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoCsrt0); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoCsrt0); if (ACPI_FAILURE (Status)) { return; @@ -887,19 +887,19 @@ AcpiDmDumpCsrt ( return; } - SubOffset += SubTable->SharedInfoLength; + SubOffset += Subtable->SharedInfoLength; /* Sub-Subtables (Resource Descriptors) */ - SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, + SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, Offset + SubOffset); - while ((SubOffset < SubTable->Length) && + while ((SubOffset < Subtable->Length) && ((Offset + SubOffset) < Table->Length)) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable, - SubSubTable->Length, AcpiDmTableInfoCsrt2); + Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable, + SubSubtable->Length, AcpiDmTableInfoCsrt2); if (ACPI_FAILURE (Status)) { return; @@ -909,7 +909,7 @@ AcpiDmDumpCsrt ( /* Resource-specific info buffer */ - InfoLength = SubSubTable->Length - SubSubOffset; + InfoLength = SubSubtable->Length - SubSubOffset; if (InfoLength) { Status = AcpiDmDumpTable (Length, @@ -924,16 +924,16 @@ AcpiDmDumpCsrt ( /* Point to next sub-subtable */ - SubOffset += SubSubTable->Length; - SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable, - SubSubTable->Length); + SubOffset += SubSubtable->Length; + SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable, + SubSubtable->Length); } /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, + Subtable->Length); } } @@ -956,7 +956,7 @@ AcpiDmDumpDbg2 ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DBG2_DEVICE *SubTable; + ACPI_DBG2_DEVICE *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DBG2); UINT32 i; @@ -975,12 +975,12 @@ AcpiDmDumpDbg2 ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDbg2Device); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoDbg2Device); if (ACPI_FAILURE (Status)) { return; @@ -988,15 +988,15 @@ AcpiDmDumpDbg2 ( /* Dump the BaseAddress array */ - for (i = 0; i < SubTable->RegisterCount; i++) + for (i = 0; i < Subtable->RegisterCount; i++) { - ArrayOffset = SubTable->BaseAddressOffset + + ArrayOffset = Subtable->BaseAddressOffset + (sizeof (ACPI_GENERIC_ADDRESS) * i); AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) SubTable + ArrayOffset; + Array = (UINT8 *) Subtable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Addr); + Subtable->Length, AcpiDmTableInfoDbg2Addr); if (ACPI_FAILURE (Status)) { return; @@ -1005,15 +1005,15 @@ AcpiDmDumpDbg2 ( /* Dump the AddressSize array */ - for (i = 0; i < SubTable->RegisterCount; i++) + for (i = 0; i < Subtable->RegisterCount; i++) { - ArrayOffset = SubTable->AddressSizeOffset + + ArrayOffset = Subtable->AddressSizeOffset + (sizeof (UINT32) * i); AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) SubTable + ArrayOffset; + Array = (UINT8 *) Subtable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Size); + Subtable->Length, AcpiDmTableInfoDbg2Size); if (ACPI_FAILURE (Status)) { return; @@ -1023,12 +1023,12 @@ AcpiDmDumpDbg2 ( /* Dump the Namestring (required) */ AcpiOsPrintf ("\n"); - ArrayOffset = SubTable->NamepathOffset; + ArrayOffset = Subtable->NamepathOffset; AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) SubTable + ArrayOffset; + Array = (UINT8 *) Subtable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Name); + Subtable->Length, AcpiDmTableInfoDbg2Name); if (ACPI_FAILURE (Status)) { return; @@ -1036,10 +1036,10 @@ AcpiDmDumpDbg2 ( /* Dump the OemData (optional) */ - if (SubTable->OemDataOffset) + if (Subtable->OemDataOffset) { - Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset, - Table, SubTable->OemDataLength, + Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset, + Table, Subtable->OemDataLength, AcpiDmTableInfoDbg2OemData); if (ACPI_FAILURE (Status)) { @@ -1049,9 +1049,9 @@ AcpiDmDumpDbg2 ( /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable, + Subtable->Length); } } @@ -1074,7 +1074,7 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DMAR_HEADER *SubTable; + ACPI_DMAR_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); ACPI_DMTABLE_INFO *InfoTable; @@ -1094,14 +1094,14 @@ AcpiDmDumpDmar ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoDmarHdr); if (ACPI_FAILURE (Status)) { return; @@ -1109,7 +1109,7 @@ AcpiDmDumpDmar ( AcpiOsPrintf ("\n"); - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_DMAR_TYPE_HARDWARE_UNIT: @@ -1144,12 +1144,12 @@ AcpiDmDumpDmar ( default: AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1158,16 +1158,16 @@ AcpiDmDumpDmar ( /* * Dump the optional device scope entries */ - if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || - (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE)) + if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || + (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE)) { /* These types do not support device scopes */ goto NextSubtable; } - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); - while (ScopeOffset < SubTable->Length) + ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset); + while (ScopeOffset < Subtable->Length) { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, @@ -1208,9 +1208,9 @@ AcpiDmDumpDmar ( NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, + Subtable->Length); } } @@ -1343,7 +1343,7 @@ AcpiDmDumpEinj ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_WHEA_HEADER *SubTable; + ACPI_WHEA_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_EINJ); @@ -1358,11 +1358,11 @@ AcpiDmDumpEinj ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, + Status = AcpiDmDumpTable (Length, Offset, Subtable, sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); if (ACPI_FAILURE (Status)) { @@ -1372,7 +1372,7 @@ AcpiDmDumpEinj ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, sizeof (ACPI_WHEA_HEADER)); } } @@ -1396,7 +1396,7 @@ AcpiDmDumpErst ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_WHEA_HEADER *SubTable; + ACPI_WHEA_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_ERST); @@ -1411,11 +1411,11 @@ AcpiDmDumpErst ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, + Status = AcpiDmDumpTable (Length, Offset, Subtable, sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); if (ACPI_FAILURE (Status)) { @@ -1425,7 +1425,7 @@ AcpiDmDumpErst ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, sizeof (ACPI_WHEA_HEADER)); } } @@ -1449,7 +1449,7 @@ AcpiDmDumpFpdt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_FPDT_HEADER *SubTable; + ACPI_FPDT_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_FPDT); ACPI_DMTABLE_INFO *InfoTable; @@ -1459,20 +1459,20 @@ AcpiDmDumpFpdt ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoFpdtHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoFpdtHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_FPDT_TYPE_BOOT: @@ -1487,31 +1487,31 @@ AcpiDmDumpFpdt ( default: AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubTable; + goto NextSubtable; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, + Subtable->Length); } } @@ -1534,11 +1534,11 @@ AcpiDmDumpGtdt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_GTDT_HEADER *SubTable; + ACPI_GTDT_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_GTDT); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubTableLength; + UINT32 SubtableLength; UINT32 GtCount; ACPI_GTDT_TIMER_ENTRY *GtxTable; @@ -1553,34 +1553,34 @@ AcpiDmDumpGtdt ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoGtdtHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoGtdtHdr); if (ACPI_FAILURE (Status)) { return; } GtCount = 0; - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_GTDT_TYPE_TIMER_BLOCK: - SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); + SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, - SubTable))->TimerCount; + Subtable))->TimerCount; InfoTable = AcpiDmTableInfoGtdt0; break; case ACPI_GTDT_TYPE_WATCHDOG: - SubTableLength = sizeof (ACPI_GTDT_WATCHDOG); + SubtableLength = sizeof (ACPI_GTDT_WATCHDOG); InfoTable = AcpiDmTableInfoGtdt1; break; @@ -1590,12 +1590,12 @@ AcpiDmDumpGtdt ( /* Cannot continue on unknown type - no length */ AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1603,15 +1603,15 @@ AcpiDmDumpGtdt ( /* Point to end of current subtable (each subtable above is of fixed length) */ - Offset += SubTableLength; + Offset += SubtableLength; /* If there are any Gt Timer Blocks from above, dump them now */ if (GtCount) { GtxTable = ACPI_ADD_PTR ( - ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength); - SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); + ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength); + SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); while (GtCount) { @@ -1630,7 +1630,7 @@ AcpiDmDumpGtdt ( /* Point to next subtable */ - SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength); + Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength); } } @@ -1653,11 +1653,11 @@ AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_HEST_HEADER *SubTable; + ACPI_HEST_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubTableLength; + UINT32 SubtableLength; UINT32 BankCount; ACPI_HEST_IA_ERROR_BANK *BankTable; @@ -1672,70 +1672,70 @@ AcpiDmDumpHest ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) { BankCount = 0; - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_HEST_TYPE_IA32_CHECK: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Sep 29 23:13:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1AC3E36D37; Fri, 29 Sep 2017 23:13:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8050A7C991; Fri, 29 Sep 2017 23:13:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8TND1Xr006577; Fri, 29 Sep 2017 23:13:01 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TND1fS006576; Fri, 29 Sep 2017 23:13:01 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201709292313.v8TND1fS006576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 29 Sep 2017 23:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324111 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 324111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 23:13:02 -0000 Author: rmacklem Date: Fri Sep 29 23:13:01 2017 New Revision: 324111 URL: https://svnweb.freebsd.org/changeset/base/324111 Log: Add support for Flex File Layout to the pNFS client structures. This patch modifies the pNFS client layout and deviceinfo structures to add fields and unions for the Flex File Layout. Until a future commit adds Flex File layout support, these new fields are not used. This patch should not affect the "pnfs" option for File Layout. Modified: head/sys/fs/nfs/nfsclstate.h Modified: head/sys/fs/nfs/nfsclstate.h ============================================================================== --- head/sys/fs/nfs/nfsclstate.h Fri Sep 29 23:05:56 2017 (r324110) +++ head/sys/fs/nfs/nfsclstate.h Fri Sep 29 23:13:01 2017 (r324111) @@ -258,9 +258,24 @@ struct nfscllayout { #define NFSLY_RECALLALL 0x0040 #define NFSLY_RETONCLOSE 0x0080 #define NFSLY_WRITTEN 0x0100 /* Has been used to write to a DS. */ +#define NFSLY_FLEXFILE 0x0200 /* - * MALLOC'd to the correct length to accommodate the file handle list. + * Flex file layout mirror specific stuff for nfsclflayout. + */ +struct nfsffm { + nfsv4stateid_t st; + char dev[NFSX_V4DEVICEID]; + uint32_t eff; + uid_t user; + gid_t group; + struct nfsfh *fh[NFSDEV_MAXVERS]; + uint16_t fhcnt; +}; + +/* + * MALLOC'd to the correct length to accommodate the file handle list for File + * layout and the list of mirrors for the Flex File Layout. * These hang off of nfsly_flayread and nfsly_flayrw, sorted in increasing * offset order. * The nfsly_flayread list holds the ones with iomode == NFSLAYOUTIOMODE_READ, @@ -268,23 +283,49 @@ struct nfscllayout { */ struct nfsclflayout { LIST_ENTRY(nfsclflayout) nfsfl_list; - uint8_t nfsfl_dev[NFSX_V4DEVICEID]; uint64_t nfsfl_off; uint64_t nfsfl_end; - uint64_t nfsfl_patoff; - struct nfscldevinfo *nfsfl_devp; uint32_t nfsfl_iomode; - uint32_t nfsfl_util; - uint32_t nfsfl_stripe1; + struct nfscldevinfo *nfsfl_devp; uint16_t nfsfl_flags; - uint16_t nfsfl_fhcnt; - struct nfsfh *nfsfl_fh[1]; /* FH list for DS */ + union { + struct { + uint64_t patoff; + uint32_t util; + uint32_t stripe1; + uint8_t dev[NFSX_V4DEVICEID]; + uint16_t fhcnt; + } fl; + struct { + uint64_t stripeunit; + uint32_t fflags; + uint32_t statshint; + uint16_t mirrorcnt; + } ff; + } nfsfl_un; + union { + struct nfsfh *fh[0]; /* FH list for DS File layout */ + struct nfsffm ffm[0]; /* Mirror list for Flex File */ + } nfsfl_un2; /* Must be last. Malloc'd to correct array length */ }; +#define nfsfl_patoff nfsfl_un.fl.patoff +#define nfsfl_util nfsfl_un.fl.util +#define nfsfl_stripe1 nfsfl_un.fl.stripe1 +#define nfsfl_dev nfsfl_un.fl.dev +#define nfsfl_fhcnt nfsfl_un.fl.fhcnt +#define nfsfl_stripeunit nfsfl_un.ff.stripeunit +#define nfsfl_fflags nfsfl_un.ff.fflags +#define nfsfl_statshint nfsfl_un.ff.statshint +#define nfsfl_mirrorcnt nfsfl_un.ff.mirrorcnt +#define nfsfl_fh nfsfl_un2.fh +#define nfsfl_ffm nfsfl_un2.ffm /* * Flags for nfsfl_flags. */ #define NFSFL_RECALL 0x0001 /* File layout has been recalled */ +#define NFSFL_FILE 0x0002 /* File layout */ +#define NFSFL_FLEXFILE 0x0004 /* Flex File layout */ /* * Structure that is used to store a LAYOUTRECALL. @@ -306,6 +347,7 @@ struct nfsclrecalllayout { * - stripe indices, each stored as one byte, since there can be many * of them. (This implies a limit of 256 on nfsdi_addrcnt, since the * indices select which address.) + * For Flex File, the addrcnt is always one and no stripe indices exist. */ struct nfscldevinfo { LIST_ENTRY(nfscldevinfo) nfsdi_list; @@ -313,10 +355,33 @@ struct nfscldevinfo { struct nfsclclient *nfsdi_clp; uint32_t nfsdi_refcnt; uint32_t nfsdi_layoutrefs; - uint16_t nfsdi_stripecnt; + union { + struct { + uint16_t stripecnt; + } fl; + struct { + int versindex; + uint32_t vers; + uint32_t minorvers; + uint32_t rsize; + uint32_t wsize; + } ff; + } nfsdi_un; uint16_t nfsdi_addrcnt; + uint16_t nfsdi_flags; struct nfsclds *nfsdi_data[0]; }; +#define nfsdi_stripecnt nfsdi_un.fl.stripecnt +#define nfsdi_versindex nfsdi_un.ff.versindex +#define nfsdi_vers nfsdi_un.ff.vers +#define nfsdi_minorvers nfsdi_un.ff.minorvers +#define nfsdi_rsize nfsdi_un.ff.rsize +#define nfsdi_wsize nfsdi_un.ff.wsize + +/* Flags for nfsdi_flags. */ +#define NFSDI_FILELAYOUT 0x0001 +#define NFSDI_FLEXFILE 0x0002 +#define NFSDI_TIGHTCOUPLED 0X0004 /* These inline functions return values from nfsdi_data[]. */ /* From owner-svn-src-head@freebsd.org Fri Sep 29 23:47:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B485E37334; Fri, 29 Sep 2017 23:47:25 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3B3D7D590; Fri, 29 Sep 2017 23:47:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8TNlOCE018996; Fri, 29 Sep 2017 23:47:24 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8TNlNoa018992; Fri, 29 Sep 2017 23:47:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201709292347.v8TNlNoa018992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 29 Sep 2017 23:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324112 - in head/bin: chflags mkdir rcp rmdir X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/bin: chflags mkdir rcp rmdir X-SVN-Commit-Revision: 324112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Sep 2017 23:47:25 -0000 Author: asomers Date: Fri Sep 29 23:47:23 2017 New Revision: 324112 URL: https://svnweb.freebsd.org/changeset/base/324112 Log: Fix Makefile entries from r323275 Reported by: Vladimir Zakharov Reviewed by: ngie MFC after: 3 weeks X-MFC-With: 323275 Modified: head/bin/chflags/Makefile head/bin/mkdir/Makefile head/bin/rcp/Makefile head/bin/rmdir/Makefile Modified: head/bin/chflags/Makefile ============================================================================== --- head/bin/chflags/Makefile Fri Sep 29 23:13:01 2017 (r324111) +++ head/bin/chflags/Makefile Fri Sep 29 23:47:23 2017 (r324112) @@ -1,6 +1,8 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= chflags Modified: head/bin/mkdir/Makefile ============================================================================== --- head/bin/mkdir/Makefile Fri Sep 29 23:13:01 2017 (r324111) +++ head/bin/mkdir/Makefile Fri Sep 29 23:47:23 2017 (r324112) @@ -1,6 +1,8 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= mkdir Modified: head/bin/rcp/Makefile ============================================================================== --- head/bin/rcp/Makefile Fri Sep 29 23:13:01 2017 (r324111) +++ head/bin/rcp/Makefile Fri Sep 29 23:47:23 2017 (r324112) @@ -1,6 +1,8 @@ # @(#)Makefile 8.1 (Berkeley) 7/19/93 # $FreeBSD$ +.include + PACKAGE=rcmds PROG= rcp SRCS= rcp.c util.c Modified: head/bin/rmdir/Makefile ============================================================================== --- head/bin/rmdir/Makefile Fri Sep 29 23:13:01 2017 (r324111) +++ head/bin/rmdir/Makefile Fri Sep 29 23:47:23 2017 (r324112) @@ -1,9 +1,10 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= rmdir - HAS_TESTS= SUBDIR.${MK_TESTS}+= tests From owner-svn-src-head@freebsd.org Sat Sep 30 09:59:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37F90E236C7; Sat, 30 Sep 2017 09:59:33 +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 0539868A24; Sat, 30 Sep 2017 09:59:32 +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 v8U9xWWc069217; Sat, 30 Sep 2017 09:59:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8U9xW3V069216; Sat, 30 Sep 2017 09:59:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709300959.v8U9xW3V069216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 30 Sep 2017 09:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324113 - head/usr.sbin/cpucontrol X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/cpucontrol X-SVN-Commit-Revision: 324113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 09:59:33 -0000 Author: kib Date: Sat Sep 30 09:59:32 2017 New Revision: 324113 URL: https://svnweb.freebsd.org/changeset/base/324113 Log: Allow to disable default microcode updates search path with the new '-n' option. Look for updates in the default locations only after user-supplied locations are tried. If newer microcode files are put into non-standard path, both measures allow to avoid situation where older update loaded from the default path first, and then the second update is applied from non-standard path. Applying intermediate updates might be undesirable. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/usr.sbin/cpucontrol/cpucontrol.c Modified: head/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- head/usr.sbin/cpucontrol/cpucontrol.c Fri Sep 29 23:47:23 2017 (r324112) +++ head/usr.sbin/cpucontrol/cpucontrol.c Sat Sep 30 09:59:32 2017 (r324113) @@ -60,6 +60,7 @@ int verbosity_level = 0; #define FLAG_I 0x01 #define FLAG_M 0x02 #define FLAG_U 0x04 +#define FLAG_N 0x08 #define OP_INVAL 0x00 #define OP_READ 0x01 @@ -427,11 +428,7 @@ main(int argc, char *argv[]) error = 0; cmdarg = ""; /* To keep gcc3 happy. */ - /* - * Add all default data dirs to the list first. - */ - datadir_add(DEFAULT_DATADIR); - while ((c = getopt(argc, argv, "d:hi:m:uv")) != -1) { + while ((c = getopt(argc, argv, "d:hi:m:nuv")) != -1) { switch (c) { case 'd': datadir_add(optarg); @@ -444,6 +441,9 @@ main(int argc, char *argv[]) flags |= FLAG_M; cmdarg = optarg; break; + case 'n': + flags |= FLAG_N; + break; case 'u': flags |= FLAG_U; break; @@ -463,6 +463,8 @@ main(int argc, char *argv[]) usage(); /* NOTREACHED */ } + if ((flags & FLAG_N) == 0) + datadir_add(DEFAULT_DATADIR); dev = argv[0]; c = flags & (FLAG_I | FLAG_M | FLAG_U); switch (c) { From owner-svn-src-head@freebsd.org Sat Sep 30 10:03:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14903E239DC; Sat, 30 Sep 2017 10:03:44 +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 DE71269355; Sat, 30 Sep 2017 10:03:43 +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 v8UA3hMj073201; Sat, 30 Sep 2017 10:03:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UA3h4j073200; Sat, 30 Sep 2017 10:03:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709301003.v8UA3h4j073200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 30 Sep 2017 10:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324114 - head/usr.sbin/cpucontrol X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/cpucontrol X-SVN-Commit-Revision: 324114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 10:03:44 -0000 Author: kib Date: Sat Sep 30 10:03:42 2017 New Revision: 324114 URL: https://svnweb.freebsd.org/changeset/base/324114 Log: Update cpucontrol(8). Mention new -n flag. Remove optional -h from the operation list lines, -h would cause the utility to exit without performing the action. Explain the default path behavior, list default path. Correct example of update performed from the non-default path, it needs -n and the trailing slash is redundand. Remove useless BUGS section. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/usr.sbin/cpucontrol/cpucontrol.8 Modified: head/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- head/usr.sbin/cpucontrol/cpucontrol.8 Sat Sep 30 09:59:32 2017 (r324113) +++ head/usr.sbin/cpucontrol/cpucontrol.8 Sat Sep 30 10:03:42 2017 (r324114) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2009 +.Dd September 30, 2017 .Dt CPUCONTROL 8 .Os .Sh NAME @@ -34,43 +34,43 @@ device .Sh SYNOPSIS .Nm -.Op Fl vh +.Op Fl v .Fl m Ar msr .Bk .Ar device .Ek .Nm -.Op Fl vh +.Op Fl v .Fl m Ar msr Ns = Ns Ar value .Bk .Ar device .Ek .Nm -.Op Fl vh +.Op Fl v .Fl m Ar msr Ns &= Ns Ar mask .Bk .Ar device .Ek .Nm -.Op Fl vh +.Op Fl v .Fl m Ar msr Ns |= Ns Ar mask .Bk .Ar device .Ek .Nm -.Op Fl vh +.Op Fl v .Fl i Ar level .Bk .Ar device .Ek .Nm -.Op Fl vh +.Op Fl v .Fl i Ar level,level_type .Bk .Ar device .Ek .Nm -.Op Fl vh +.Op Fl vn .Op Fl d Ar datadir .Fl u .Bk @@ -88,8 +88,14 @@ It can also be used to apply CPU firmware updates. The following options are available: .Bl -tag -width indent .It Fl d Ar datadir -Where to look for microcode images. +Directory paths where to look for microcode images. The option can be specified multiple times. +The paths are added in order of the options appearance on the command +line, default directories are appended after the user-supplied paths. +.It Fl n +Do not look for the microcode images in the standard directories. +Currently standard directory to look for the microcode update files is +.Pa /usr/local/share/cpucontrol . .It Fl m Ar msr Show value of the specified MSR. MSR register number should be given as a hexadecimal number. @@ -163,10 +169,10 @@ The command will retrieve the CPUID level 0x1 from CPU 1. .Pp To perform firmware updates on CPU 0 from images located at -.Pa /usr/local/share/cpuctl/ +.Pa /usr/local/share/cpuctl use the following command: .Pp -.Dq Li "cpucontrol -d /usr/local/share/cpuctl/ -u /dev/cpuctl0" +.Dq Li "cpucontrol -nd /usr/local/share/cpuctl -u /dev/cpuctl0" .Sh SEE ALSO .Xr cpuctl 4 .Sh HISTORY @@ -179,5 +185,3 @@ The .Nm utility and this manual page was written by .An Stanislav Sedov Aq Mt stas@FreeBSD.org . -.Sh BUGS -Yes, probably, report if any. From owner-svn-src-head@freebsd.org Sat Sep 30 10:34:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0170E24835; Sat, 30 Sep 2017 10:34:08 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACF0E6B04C; Sat, 30 Sep 2017 10:34:08 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8UAY7Pw087327; Sat, 30 Sep 2017 10:34:07 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UAY7Cv087326; Sat, 30 Sep 2017 10:34:07 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201709301034.v8UAY7Cv087326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sat, 30 Sep 2017 10:34:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324117 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: jmcneill X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 10:34:09 -0000 Author: jmcneill Date: Sat Sep 30 10:34:07 2017 New Revision: 324117 URL: https://svnweb.freebsd.org/changeset/base/324117 Log: Fix if_awg tx dma status reg offsets. Submitted by: guyyur@gmail.com Differential Revision: https://reviews.freebsd.org/D12535 Modified: head/sys/arm/allwinner/if_awgreg.h Modified: head/sys/arm/allwinner/if_awgreg.h ============================================================================== --- head/sys/arm/allwinner/if_awgreg.h Sat Sep 30 10:16:15 2017 (r324116) +++ head/sys/arm/allwinner/if_awgreg.h Sat Sep 30 10:34:07 2017 (r324117) @@ -115,9 +115,9 @@ #define EMAC_MII_DATA 0x4c #define EMAC_ADDR_HIGH(n) (0x50 + (n) * 8) #define EMAC_ADDR_LOW(n) (0x54 + (n) * 8) -#define EMAC_TX_DMA_STA 0x80 -#define EMAC_TX_DMA_CUR_DESC 0x84 -#define EMAC_TX_DMA_CUR_BUF 0x88 +#define EMAC_TX_DMA_STA 0xb0 +#define EMAC_TX_DMA_CUR_DESC 0xb4 +#define EMAC_TX_DMA_CUR_BUF 0xb8 #define EMAC_RX_DMA_STA 0xc0 #define EMAC_RX_DMA_CUR_DESC 0xc4 #define EMAC_RX_DMA_CUR_BUF 0xc8 From owner-svn-src-head@freebsd.org Sat Sep 30 10:35:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99BDEE24954; Sat, 30 Sep 2017 10:35:45 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68C956B24D; Sat, 30 Sep 2017 10:35:45 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8UAZiUn087434; Sat, 30 Sep 2017 10:35:44 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UAZinf087433; Sat, 30 Sep 2017 10:35:44 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201709301035.v8UAZinf087433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sat, 30 Sep 2017 10:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324118 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: jmcneill X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 10:35:45 -0000 Author: jmcneill Date: Sat Sep 30 10:35:44 2017 New Revision: 324118 URL: https://svnweb.freebsd.org/changeset/base/324118 Log: Disable/enable CSUM_UDP and CSUM_TCP along with CSUM_IP Submitted by: guyyur@gmail.com Differential Revision: https://reviews.freebsd.org/D12536 Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Sat Sep 30 10:34:07 2017 (r324117) +++ head/sys/arm/allwinner/if_awg.c Sat Sep 30 10:35:44 2017 (r324118) @@ -1041,10 +1041,10 @@ awg_ioctl(if_t ifp, u_long cmd, caddr_t data) if_togglecapenable(ifp, IFCAP_RXCSUM); if (mask & IFCAP_TXCSUM) if_togglecapenable(ifp, IFCAP_TXCSUM); - if ((if_getcapenable(ifp) & (IFCAP_RXCSUM|IFCAP_TXCSUM)) != 0) - if_sethwassistbits(ifp, CSUM_IP, 0); + if ((if_getcapenable(ifp) & IFCAP_TXCSUM) != 0) + if_sethwassistbits(ifp, CSUM_IP | CSUM_UDP | CSUM_TCP, 0); else - if_sethwassistbits(ifp, 0, CSUM_IP); + if_sethwassistbits(ifp, 0, CSUM_IP | CSUM_UDP | CSUM_TCP); break; default: error = ether_ioctl(ifp, cmd, data); From owner-svn-src-head@freebsd.org Sat Sep 30 10:58:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0803AE24E39; Sat, 30 Sep 2017 10:58:42 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC1046BB54; Sat, 30 Sep 2017 10:58:41 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1129) id 393531720F; Sat, 30 Sep 2017 10:58:41 +0000 (UTC) Date: Sat, 30 Sep 2017 10:58:41 +0000 From: Li-Wen Hsu To: Jung-uk Kim Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... Message-ID: <20170930105841.GA25789@freefall.freebsd.org> References: <201709292302.v8TN2nTl002342@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709292302.v8TN2nTl002342@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 10:58:42 -0000 On Fri, Sep 29, 2017 at 23:02:49 +0000, Jung-uk Kim wrote: > Author: jkim > Date: Fri Sep 29 23:02:49 2017 > New Revision: 324109 > URL: https://svnweb.freebsd.org/changeset/base/324109 > > Log: > Merge ACPICA 20170929. > > Added: > head/sys/contrib/dev/acpica/compiler/aslallocate.c > - copied, changed from r324104, vendor-sys/acpica/dist/source/compiler/aslallocate.c Hi Jung-uk, After this change, the test machine booting in bhyve panics with this message: panic: acpi: timer op not yet supported during boot Could you help to check what happened here? The full boot log can be found here: https://ci.freebsd.org/job/FreeBSD-head-amd64-test/4496/console Thanks, Li-Wen -- Li-Wen Hsu https://lwhsu.org From owner-svn-src-head@freebsd.org Sat Sep 30 11:40:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEE66E258E3; Sat, 30 Sep 2017 11:40:19 +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 CB4066CD1D; Sat, 30 Sep 2017 11:40:19 +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 v8UBeIGb013156; Sat, 30 Sep 2017 11:40:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UBeIR8013154; Sat, 30 Sep 2017 11:40:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709301140.v8UBeIR8013154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 30 Sep 2017 11:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324119 - head/usr.sbin/traceroute6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/traceroute6 X-SVN-Commit-Revision: 324119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 11:40:20 -0000 Author: tuexen Date: Sat Sep 30 11:40:18 2017 New Revision: 324119 URL: https://svnweb.freebsd.org/changeset/base/324119 Log: * Update function definitions. * Ensure that the datalen always describes the length after the IPv6 header consistently, not matter which protocol us used for probes.. * Document that the default length is 20, not 12. * Don't send inormation in probe packets which is not needed or even checked when the responses are processed. * Address CID 978587. This is mainly a cleanup preparing the addition of SCTP and TCP as possible probe packet protocols. MFC after: 4 weeks Modified: head/usr.sbin/traceroute6/traceroute6.8 head/usr.sbin/traceroute6/traceroute6.c Modified: head/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.8 Sat Sep 30 10:35:44 2017 (r324118) +++ head/usr.sbin/traceroute6/traceroute6.8 Sat Sep 30 11:40:18 2017 (r324119) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2009 +.Dd September 30, 2017 .Dt TRACEROUTE6 8 .Os .\" @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl adIlnNrvU +.Op Fl adIlnNrUv .Ek .Bk -words .Op Fl f Ar firsthop @@ -79,7 +79,7 @@ uses the IPv6 protocol hop limit field to elicit an IC response from each gateway along the path to some host. .Pp The only mandatory parameter is the destination host name or IPv6 address. -The default probe datagram carries 12 bytes of payload, +The default probe datagram carries 20 bytes of payload, in addition to the IPv6 header. The size of the payload can be specified by giving a length (in bytes) @@ -96,9 +96,9 @@ Debug mode. .It Fl f Ar firsthop Specify how many hops to skip in trace. .It Fl g Ar gateway -Specify intermediate gateway -.Nm ( -uses routing header). +Specify intermediate gateway. Please note that +.Nm +tries to use routing headers. .It Fl I Use ICMP6 ECHO instead of UDP datagrams. .It Fl l Modified: head/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.c Sat Sep 30 10:35:44 2017 (r324118) +++ head/usr.sbin/traceroute6/traceroute6.c Sat Sep 30 11:40:18 2017 (r324119) @@ -289,23 +289,8 @@ static const char rcsid[] = #define freehostent(x) #endif -/* - * format of a (udp) probe packet. - */ -struct tv32 { - u_int32_t tv32_sec; - u_int32_t tv32_usec; -}; - -struct opacket { - u_char seq; /* sequence number of this packet */ - u_char hops; /* hop limit of the packet */ - u_char pad[2]; - struct tv32 tv; /* time packet left */ -} __attribute__((__packed__)); - u_char packet[512]; /* last inbound (icmp) packet */ -struct opacket *outpacket; /* last output (udp) packet */ +char *outpacket; /* last output packet */ int main(int, char *[]); int wait_for_reply(int, struct msghdr *); @@ -333,7 +318,7 @@ int rcvhlim; struct in6_pktinfo *rcvpktinfo; struct sockaddr_in6 Src, Dst, Rcv; -u_long datalen; /* How much data */ +u_long datalen = 20; /* How much data */ #define ICMP6ECHOLEN 8 /* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */ char rtbuf[2064]; @@ -362,9 +347,7 @@ char *as_server = NULL; void *asn; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM }; char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep; @@ -533,12 +516,12 @@ main(argc, argv) */ source = optarg; break; - case 'v': - verbose++; - break; case 'U': useproto = IPPROTO_UDP; break; + case 'v': + verbose++; + break; case 'w': ep = NULL; errno = 0; @@ -574,13 +557,13 @@ main(argc, argv) } break; case IPPROTO_NONE: - if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) { + if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) { perror("socket(SOCK_RAW)"); exit(5); } break; default: - fprintf(stderr, "traceroute6: unknown probe protocol %d", + fprintf(stderr, "traceroute6: unknown probe protocol %d\n", useproto); exit(5); } @@ -641,7 +624,7 @@ main(argc, argv) ep = NULL; errno = 0; datalen = strtoul(*argv, &ep, 0); - if (errno || !*argv || *ep) { + if (errno || *ep) { fprintf(stderr, "traceroute6: invalid packet length.\n"); exit(1); @@ -649,10 +632,10 @@ main(argc, argv) } switch (useproto) { case IPPROTO_ICMPV6: - minlen = ICMP6ECHOLEN + sizeof(struct tv32); + minlen = ICMP6ECHOLEN; break; case IPPROTO_UDP: - minlen = sizeof(struct opacket); + minlen = sizeof(struct udphdr); break; case IPPROTO_NONE: minlen = 0; @@ -671,6 +654,8 @@ main(argc, argv) minlen, MAXPACKET); exit(1); } + if (useproto == IPPROTO_UDP) + datalen -= sizeof(struct udphdr); outpacket = malloc(datalen); if (!outpacket) { perror("malloc"); @@ -735,8 +720,10 @@ main(argc, argv) #ifdef SO_SNDBUF i = datalen; + if (i == 0) + i = 1; if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&i, - sizeof(i)) < 0 && useproto != IPPROTO_NONE) { + sizeof(i)) < 0) { perror("setsockopt(SO_SNDBUF)"); exit(6); } @@ -977,9 +964,7 @@ main(argc, argv) } int -wait_for_reply(sock, mhdr) - int sock; - struct msghdr *mhdr; +wait_for_reply(int sock, struct msghdr *mhdr) { #ifdef HAVE_POLL struct pollfd pfd[1]; @@ -1038,14 +1023,9 @@ setpolicy(so, policy) #endif void -send_probe(seq, hops) - int seq; - u_long hops; +send_probe(int seq, u_long hops) { struct icmp6_hdr *icp; - struct opacket *op; - struct timeval tv; - struct tv32 tv32; int i; i = hops; @@ -1055,9 +1035,6 @@ send_probe(seq, hops) } Dst.sin6_port = htons(port + seq); - (void) gettimeofday(&tv, NULL); - tv32.tv32_sec = htonl(tv.tv_sec); - tv32.tv32_usec = htonl(tv.tv_usec); switch (useproto) { case IPPROTO_ICMPV6: @@ -1068,15 +1045,8 @@ send_probe(seq, hops) icp->icmp6_cksum = 0; icp->icmp6_id = ident; icp->icmp6_seq = htons(seq); - bcopy(&tv32, ((u_int8_t *)outpacket + ICMP6ECHOLEN), - sizeof(tv32)); break; case IPPROTO_UDP: - op = outpacket; - - op->seq = seq; - op->hops = hops; - bcopy(&tv32, &op->tv, sizeof tv32); break; case IPPROTO_NONE: /* No space for anything. No harm as seq/tv32 are decorative. */ @@ -1098,8 +1068,7 @@ send_probe(seq, hops) } int -get_hoplim(mhdr) - struct msghdr *mhdr; +get_hoplim(struct msghdr *mhdr) { struct cmsghdr *cm; @@ -1115,8 +1084,7 @@ get_hoplim(mhdr) } double -deltaT(t1p, t2p) - struct timeval *t1p, *t2p; +deltaT(struct timeval *t1p, struct timeval *t2p) { double dt; @@ -1185,10 +1153,7 @@ pr_type(int t0) } int -packet_ok(mhdr, cc, seq) - struct msghdr *mhdr; - int cc; - int seq; +packet_ok(struct msghdr *mhdr, int cc, int seq) { struct icmp6_hdr *icp; struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name; @@ -1262,6 +1227,8 @@ packet_ok(mhdr, cc, seq) if ((type == ICMP6_TIME_EXCEEDED && code == ICMP6_TIME_EXCEED_TRANSIT) || type == ICMP6_DST_UNREACH) { struct ip6_hdr *hip; + struct icmp6_hdr *icmp; + struct udphdr *udp; void *up; hip = (struct ip6_hdr *)(icp + 1); @@ -1272,14 +1239,16 @@ packet_ok(mhdr, cc, seq) } switch (useproto) { case IPPROTO_ICMPV6: - if (((struct icmp6_hdr *)up)->icmp6_id == ident && - ((struct icmp6_hdr *)up)->icmp6_seq == htons(seq)) + icmp = (struct icmp6_hdr *)up; + if (icmp->icmp6_id == ident && + icmp->icmp6_seq == htons(seq)) return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); break; case IPPROTO_UDP: - if (((struct udphdr *)up)->uh_sport == htons(srcport) && - ((struct udphdr *)up)->uh_dport == htons(port + seq)) + udp = (struct udphdr *)up; + if (udp->uh_sport == htons(srcport) && + udp->uh_dport == htons(port + seq)) return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); break; @@ -1328,9 +1297,7 @@ packet_ok(mhdr, cc, seq) * Increment pointer until find the UDP or ICMP header. */ void * -get_uphdr(ip6, lim) - struct ip6_hdr *ip6; - u_char *lim; +get_uphdr(struct ip6_hdr *ip6, u_char *lim) { u_char *cp = (u_char *)ip6, nh; int hlen; @@ -1374,9 +1341,7 @@ get_uphdr(ip6, lim) } void -print(mhdr, cc) - struct msghdr *mhdr; - int cc; +print(struct msghdr *mhdr, int cc) { struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name; char hbuf[NI_MAXHOST]; @@ -1412,8 +1377,7 @@ print(mhdr, cc) * numeric value, otherwise try for symbolic name. */ const char * -inetname(sa) - struct sockaddr *sa; +inetname(struct sockaddr *sa) { static char line[NI_MAXHOST], domain[MAXHOSTNAMELEN + 1]; static int first = 1; @@ -1447,7 +1411,7 @@ inetname(sa) } void -usage() +usage(void) { fprintf(stderr, From owner-svn-src-head@freebsd.org Sat Sep 30 11:45:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F810E25AF4; Sat, 30 Sep 2017 11:45:35 +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 DFBF96D100; Sat, 30 Sep 2017 11:45:34 +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 v8UBjYvj017153; Sat, 30 Sep 2017 11:45:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UBjXvs017151; Sat, 30 Sep 2017 11:45:33 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709301145.v8UBjXvs017151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 30 Sep 2017 11:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324120 - head/usr.sbin/traceroute6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/traceroute6 X-SVN-Commit-Revision: 324120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 11:45:35 -0000 Author: tuexen Date: Sat Sep 30 11:45:33 2017 New Revision: 324120 URL: https://svnweb.freebsd.org/changeset/base/324120 Log: Add SCTP and TCP as protocols for sending probe packets. MFC after: 4 weeks Modified: head/usr.sbin/traceroute6/traceroute6.8 head/usr.sbin/traceroute6/traceroute6.c Modified: head/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.8 Sat Sep 30 11:40:18 2017 (r324119) +++ head/usr.sbin/traceroute6/traceroute6.8 Sat Sep 30 11:45:33 2017 (r324120) @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl adIlnNrUv +.Op Fl adIlnNrSTUv .Ek .Bk -words .Op Fl f Ar firsthop @@ -119,7 +119,7 @@ Do not resolve numeric address to hostname. Use a packet with no upper layer header for the probes, instead of UDP datagrams. .It Fl p Ar port -Set UDP port number to +Set SCTP/TCP/UDP port number to .Ar port . .It Fl q Ar probes Set the number of probe per hop count to @@ -138,6 +138,10 @@ that has no route through it .It Fl s Ar src .Ar Src specifies the source IPv6 address to be used. +.It Fl S +Use SCTP packets for the probes. +.It Fl T +Use TCP segments for the probes. .It Fl U Use UDP datagrams for the probes. This is the default. Modified: head/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.c Sat Sep 30 11:40:18 2017 (r324119) +++ head/usr.sbin/traceroute6/traceroute6.c Sat Sep 30 11:45:33 2017 (r324120) @@ -271,6 +271,8 @@ static const char rcsid[] = #include #include +#include +#include #include #ifdef IPSEC @@ -307,10 +309,14 @@ const char *pr_type(int); int packet_ok(struct msghdr *, int, int); void print(struct msghdr *, int); const char *inetname(struct sockaddr *); +u_int32_t sctp_crc32c(void *, u_int32_t); +u_int16_t in_cksum(u_int16_t *addr, int); +u_int16_t tcp_chksum(struct sockaddr_in6 *, struct sockaddr_in6 *, + void *, u_int32_t); void usage(void); int rcvsock; /* receive (icmp) socket file descriptor */ -int sndsock; /* send (udp) socket file descriptor */ +int sndsock; /* send (raw/udp) socket file descriptor */ struct msghdr rcvmhdr; struct iovec rcviov[2]; @@ -394,8 +400,9 @@ main(int argc, char *argv[]) #endif seq = 0; + ident = htons(getpid() & 0xffff); /* same as ping6 */ - while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1) + while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:STUvw:")) != -1) switch (ch) { case 'a': as_path = 1; @@ -455,7 +462,6 @@ main(int argc, char *argv[]) break; case 'I': useproto = IPPROTO_ICMPV6; - ident = htons(getpid() & 0xffff); /* same as ping6 */ break; case 'l': lflag++; @@ -516,6 +522,12 @@ main(int argc, char *argv[]) */ source = optarg; break; + case 'S': + useproto = IPPROTO_SCTP; + break; + case 'T': + useproto = IPPROTO_TCP; + break; case 'U': useproto = IPPROTO_UDP; break; @@ -557,7 +569,9 @@ main(int argc, char *argv[]) } break; case IPPROTO_NONE: - if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) { + case IPPROTO_SCTP: + case IPPROTO_TCP: + if ((sndsock = socket(AF_INET6, SOCK_RAW, useproto)) < 0) { perror("socket(SOCK_RAW)"); exit(5); } @@ -641,6 +655,12 @@ main(int argc, char *argv[]) minlen = 0; datalen = 0; break; + case IPPROTO_SCTP: + minlen = sizeof(struct sctphdr); + break; + case IPPROTO_TCP: + minlen = sizeof(struct tcphdr); + break; default: fprintf(stderr, "traceroute6: unknown probe protocol %d.\n", useproto); @@ -1026,6 +1046,9 @@ void send_probe(int seq, u_long hops) { struct icmp6_hdr *icp; + struct sctphdr *sctp; + struct sctp_chunkhdr *chk; + struct tcphdr *tcp; int i; i = hops; @@ -1051,6 +1074,43 @@ send_probe(int seq, u_long hops) case IPPROTO_NONE: /* No space for anything. No harm as seq/tv32 are decorative. */ break; + case IPPROTO_SCTP: + sctp = (struct sctphdr *)outpacket; + + sctp->src_port = htons(ident); + sctp->dest_port = htons(port + seq); + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + sctp->checksum = htonl(0); + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (datalen >= (u_long)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons((u_int16_t)(datalen - + sizeof(struct sctphdr) - + sizeof(struct sctp_chunkhdr))); + } + sctp->checksum = sctp_crc32c(outpacket, datalen); + break; + case IPPROTO_TCP: + tcp = (struct tcphdr *)outpacket; + + tcp->th_sport = htons(ident); + tcp->th_dport = htons(port + seq); + tcp->th_seq = (tcp->th_sport << 16) | tcp->th_dport; + tcp->th_ack = 0; + tcp->th_off = 5; + tcp->th_flags = TH_SYN; + tcp->th_sum = 0; + tcp->th_sum = tcp_chksum(&Src, &Dst, outpacket, datalen); + break; default: fprintf(stderr, "Unknown probe protocol %d.\n", useproto); exit(1); @@ -1228,6 +1288,8 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) || type == ICMP6_DST_UNREACH) { struct ip6_hdr *hip; struct icmp6_hdr *icmp; + struct sctphdr *sctp; + struct tcphdr *tcp; struct udphdr *udp; void *up; @@ -1252,6 +1314,24 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); break; + case IPPROTO_SCTP: + sctp = (struct sctphdr *)up; + if (sctp->src_port == htons(ident) && + sctp->dest_port == htons(port + seq) && + sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)) + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + break; + case IPPROTO_TCP: + tcp = (struct tcphdr *)up; + if (tcp->th_sport == htons(ident) && + tcp->th_dport == htons(port + seq) && + tcp->th_seq == + (tcp_seq)((tcp->th_sport << 16) | tcp->th_dport)) + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + break; case IPPROTO_NONE: return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); default: @@ -1312,10 +1392,11 @@ get_uphdr(struct ip6_hdr *ip6, u_char *lim) while (lim - cp >= (nh == IPPROTO_NONE ? 0 : 8)) { switch (nh) { case IPPROTO_ESP: - case IPPROTO_TCP: return(NULL); case IPPROTO_ICMPV6: return(useproto == nh ? cp : NULL); + case IPPROTO_SCTP: + case IPPROTO_TCP: case IPPROTO_UDP: return(useproto == nh ? cp : NULL); case IPPROTO_NONE: @@ -1410,12 +1491,163 @@ inetname(struct sockaddr *sa) return line; } +/* + * CRC32C routine for the Stream Control Transmission Protocol + */ + +#define CRC32C(c, d) (c = (c>>8) ^ crc_c[(c^(d))&0xFF]) + +static u_int32_t crc_c[256] = { + 0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, + 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB, + 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B, + 0x4D43CFD0, 0xBF284CD3, 0xAC78BF27, 0x5E133C24, + 0x105EC76F, 0xE235446C, 0xF165B798, 0x030E349B, + 0xD7C45070, 0x25AFD373, 0x36FF2087, 0xC494A384, + 0x9A879FA0, 0x68EC1CA3, 0x7BBCEF57, 0x89D76C54, + 0x5D1D08BF, 0xAF768BBC, 0xBC267848, 0x4E4DFB4B, + 0x20BD8EDE, 0xD2D60DDD, 0xC186FE29, 0x33ED7D2A, + 0xE72719C1, 0x154C9AC2, 0x061C6936, 0xF477EA35, + 0xAA64D611, 0x580F5512, 0x4B5FA6E6, 0xB93425E5, + 0x6DFE410E, 0x9F95C20D, 0x8CC531F9, 0x7EAEB2FA, + 0x30E349B1, 0xC288CAB2, 0xD1D83946, 0x23B3BA45, + 0xF779DEAE, 0x05125DAD, 0x1642AE59, 0xE4292D5A, + 0xBA3A117E, 0x4851927D, 0x5B016189, 0xA96AE28A, + 0x7DA08661, 0x8FCB0562, 0x9C9BF696, 0x6EF07595, + 0x417B1DBC, 0xB3109EBF, 0xA0406D4B, 0x522BEE48, + 0x86E18AA3, 0x748A09A0, 0x67DAFA54, 0x95B17957, + 0xCBA24573, 0x39C9C670, 0x2A993584, 0xD8F2B687, + 0x0C38D26C, 0xFE53516F, 0xED03A29B, 0x1F682198, + 0x5125DAD3, 0xA34E59D0, 0xB01EAA24, 0x42752927, + 0x96BF4DCC, 0x64D4CECF, 0x77843D3B, 0x85EFBE38, + 0xDBFC821C, 0x2997011F, 0x3AC7F2EB, 0xC8AC71E8, + 0x1C661503, 0xEE0D9600, 0xFD5D65F4, 0x0F36E6F7, + 0x61C69362, 0x93AD1061, 0x80FDE395, 0x72966096, + 0xA65C047D, 0x5437877E, 0x4767748A, 0xB50CF789, + 0xEB1FCBAD, 0x197448AE, 0x0A24BB5A, 0xF84F3859, + 0x2C855CB2, 0xDEEEDFB1, 0xCDBE2C45, 0x3FD5AF46, + 0x7198540D, 0x83F3D70E, 0x90A324FA, 0x62C8A7F9, + 0xB602C312, 0x44694011, 0x5739B3E5, 0xA55230E6, + 0xFB410CC2, 0x092A8FC1, 0x1A7A7C35, 0xE811FF36, + 0x3CDB9BDD, 0xCEB018DE, 0xDDE0EB2A, 0x2F8B6829, + 0x82F63B78, 0x709DB87B, 0x63CD4B8F, 0x91A6C88C, + 0x456CAC67, 0xB7072F64, 0xA457DC90, 0x563C5F93, + 0x082F63B7, 0xFA44E0B4, 0xE9141340, 0x1B7F9043, + 0xCFB5F4A8, 0x3DDE77AB, 0x2E8E845F, 0xDCE5075C, + 0x92A8FC17, 0x60C37F14, 0x73938CE0, 0x81F80FE3, + 0x55326B08, 0xA759E80B, 0xB4091BFF, 0x466298FC, + 0x1871A4D8, 0xEA1A27DB, 0xF94AD42F, 0x0B21572C, + 0xDFEB33C7, 0x2D80B0C4, 0x3ED04330, 0xCCBBC033, + 0xA24BB5A6, 0x502036A5, 0x4370C551, 0xB11B4652, + 0x65D122B9, 0x97BAA1BA, 0x84EA524E, 0x7681D14D, + 0x2892ED69, 0xDAF96E6A, 0xC9A99D9E, 0x3BC21E9D, + 0xEF087A76, 0x1D63F975, 0x0E330A81, 0xFC588982, + 0xB21572C9, 0x407EF1CA, 0x532E023E, 0xA145813D, + 0x758FE5D6, 0x87E466D5, 0x94B49521, 0x66DF1622, + 0x38CC2A06, 0xCAA7A905, 0xD9F75AF1, 0x2B9CD9F2, + 0xFF56BD19, 0x0D3D3E1A, 0x1E6DCDEE, 0xEC064EED, + 0xC38D26C4, 0x31E6A5C7, 0x22B65633, 0xD0DDD530, + 0x0417B1DB, 0xF67C32D8, 0xE52CC12C, 0x1747422F, + 0x49547E0B, 0xBB3FFD08, 0xA86F0EFC, 0x5A048DFF, + 0x8ECEE914, 0x7CA56A17, 0x6FF599E3, 0x9D9E1AE0, + 0xD3D3E1AB, 0x21B862A8, 0x32E8915C, 0xC083125F, + 0x144976B4, 0xE622F5B7, 0xF5720643, 0x07198540, + 0x590AB964, 0xAB613A67, 0xB831C993, 0x4A5A4A90, + 0x9E902E7B, 0x6CFBAD78, 0x7FAB5E8C, 0x8DC0DD8F, + 0xE330A81A, 0x115B2B19, 0x020BD8ED, 0xF0605BEE, + 0x24AA3F05, 0xD6C1BC06, 0xC5914FF2, 0x37FACCF1, + 0x69E9F0D5, 0x9B8273D6, 0x88D28022, 0x7AB90321, + 0xAE7367CA, 0x5C18E4C9, 0x4F48173D, 0xBD23943E, + 0xF36E6F75, 0x0105EC76, 0x12551F82, 0xE03E9C81, + 0x34F4F86A, 0xC69F7B69, 0xD5CF889D, 0x27A40B9E, + 0x79B737BA, 0x8BDCB4B9, 0x988C474D, 0x6AE7C44E, + 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351 +}; + +u_int32_t +sctp_crc32c(void *packet, u_int32_t len) +{ + u_int32_t i, crc32c; + u_int8_t byte0, byte1, byte2, byte3; + u_int8_t *buf = (u_int8_t *)packet; + + crc32c = ~0; + for (i = 0; i < len; i++) + CRC32C(crc32c, buf[i]); + crc32c = ~crc32c; + byte0 = crc32c & 0xff; + byte1 = (crc32c>>8) & 0xff; + byte2 = (crc32c>>16) & 0xff; + byte3 = (crc32c>>24) & 0xff; + crc32c = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3); + return htonl(crc32c); +} + +u_int16_t +in_cksum(u_int16_t *addr, int len) +{ + int nleft = len; + u_int16_t *w = addr; + u_int16_t answer; + int sum = 0; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), + * we add sequential 16 bit words to it, and at the end, fold + * back all the carry bits from the top 16 bits into the lower + * 16 bits. + */ + while (nleft > 1) { + sum += *w++; + nleft -= 2; + } + + /* mop up an odd byte, if necessary */ + if (nleft == 1) + sum += *(u_char *)w; + + /* + * add back carry outs from top 16 bits to low 16 bits + */ + sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return (answer); +} + +u_int16_t +tcp_chksum(struct sockaddr_in6 *src, struct sockaddr_in6 *dst, + void *payload, u_int32_t len) +{ + struct { + struct in6_addr src; + struct in6_addr dst; + u_int32_t len; + u_int8_t zero[3]; + u_int8_t next; + } pseudo_hdr; + u_int16_t sum[2]; + + pseudo_hdr.src = src->sin6_addr; + pseudo_hdr.dst = dst->sin6_addr; + pseudo_hdr.len = htonl(len); + pseudo_hdr.zero[0] = 0; + pseudo_hdr.zero[1] = 0; + pseudo_hdr.zero[2] = 0; + pseudo_hdr.next = IPPROTO_TCP; + + sum[1] = in_cksum((u_int16_t *)&pseudo_hdr, sizeof(pseudo_hdr)); + sum[0] = in_cksum(payload, len); + + return (~in_cksum(sum, sizeof(sum))); +} + void usage(void) { fprintf(stderr, -"usage: traceroute6 [-adIlnNrUv] [-A as_server] [-f firsthop] [-g gateway]\n" +"usage: traceroute6 [-adIlnNrSTUv] [-A as_server] [-f firsthop] [-g gateway]\n" " [-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target\n" " [datalen]\n"); exit(1); From owner-svn-src-head@freebsd.org Sat Sep 30 12:04:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7063E26AE9; Sat, 30 Sep 2017 12:04:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B5D46E601; Sat, 30 Sep 2017 12:04:42 +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 v8UC4aU7097187 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 30 Sep 2017 15:04:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v8UC4aU7097187 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v8UC4aKo097186; Sat, 30 Sep 2017 15:04:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 30 Sep 2017 15:04:36 +0300 From: Konstantin Belousov To: Li-Wen Hsu Cc: Jung-uk Kim , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... Message-ID: <20170930120436.GJ95911@kib.kiev.ua> References: <201709292302.v8TN2nTl002342@repo.freebsd.org> <20170930105841.GA25789@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170930105841.GA25789@freefall.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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.23 Precedence: list List-Id: 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, 30 Sep 2017 12:04:42 -0000 On Sat, Sep 30, 2017 at 10:58:41AM +0000, Li-Wen Hsu wrote: > On Fri, Sep 29, 2017 at 23:02:49 +0000, Jung-uk Kim wrote: > > Author: jkim > > Date: Fri Sep 29 23:02:49 2017 > > New Revision: 324109 > > URL: https://svnweb.freebsd.org/changeset/base/324109 > > > > Log: > > Merge ACPICA 20170929. > > > > Added: > > head/sys/contrib/dev/acpica/compiler/aslallocate.c > > - copied, changed from r324104, vendor-sys/acpica/dist/source/compiler/aslallocate.c > > Hi Jung-uk, > > After this change, the test machine booting in bhyve panics with this > message: > > panic: acpi: timer op not yet supported during boot > > Could you help to check what happened here? The full boot log can be > found here: > > https://ci.freebsd.org/job/FreeBSD-head-amd64-test/4496/console > This happens for me on the real hardware as well. SMP: passed TSC synchronization test Timecounter "TSC" frequency 2095144854 Hz quality 1000 random: entropy device external interface io: nfslock: pseudo-device mem: null: nexus0 random: harvesting attach, 8 bytes (4 bits) from ram0 acpi0: on motherboard ACPI: 4 ACPI AML tables successfully acquired and loaded panic: acpi: timer op not yet supported during boot cpuid = 17 time = 1 KDB: stack backtrace: db_trace_self_wrapper() at 0xffffffff802ac6fb = db_trace_self_wrapper+0x2b/frame 0xffffffff80de9da0 vpanic() at 0xffffffff80380e0c = vpanic+0x19c/frame 0xffffffff80de9e20 kassert_panic() at 0xffffffff80380c6f = kassert_panic+0x16f/frame 0xffffffff80de9e90 AcpiOsGetTimer() at 0xffffffff802b1b08 = AcpiOsGetTimer+0x48/frame 0xffffffff80de9eb0 AcpiDsExecBeginControlOp() at 0xffffffff80276f40 = AcpiDsExecBeginControlOp+0x80/frame 0xffffffff80de9ee0 AcpiPsCreateOp() at 0xffffffff80290c83 = AcpiPsCreateOp+0x1b3/frame 0xffffffff80de9f30 AcpiPsParseLoop() at 0xffffffff8029047f = AcpiPsParseLoop+0x1bf/frame 0xffffffff80de9fa0 AcpiPsParseAml() at 0xffffffff80291540 = AcpiPsParseAml+0x80/frame 0xffffffff80de9fe0 AcpiDsExecuteArguments() at 0xffffffff80276d4d = AcpiDsExecuteArguments+0x13d/frame 0xffffffff80dea040 AcpiDsGetRegionArguments() at 0xffffffff80276e96 = AcpiDsGetRegionArguments+0x36/frame 0xffffffff80dea060 AcpiNsInitOneObject() at 0xffffffff8028b153 = AcpiNsInitOneObject+0xd3/frame 0xffffffff80dea0a0 AcpiNsWalkNamespace() at 0xffffffff8028e673 = AcpiNsWalkNamespace+0xc3/frame 0xffffffff80dea100 AcpiWalkNamespace() at 0xffffffff8028ebf9 = AcpiWalkNamespace+0x99/frame 0xffffffff80dea160 AcpiNsInitializeObjects() at 0xffffffff8028b052 = AcpiNsInitializeObjects+0x42/frame 0xffffffff80dea1c0 AcpiLoadTables() at 0xffffffff80296648 = AcpiLoadTables+0x78/frame 0xffffffff80dea1e0 acpi_attach() at 0xffffffff802b59cc = acpi_attach+0x31c/frame 0xffffffff80dea290 device_attach() at 0xffffffff803b7833 = device_attach+0x3f3/frame 0xffffffff80dea2d0 bus_generic_attach() at 0xffffffff803b898a = bus_generic_attach+0x5a/frame 0xffffffff80dea2f0 nexus_acpi_attach() at 0xffffffff805b3593 = nexus_acpi_attach+0x73/frame 0xffffffff80dea320 device_attach() at 0xffffffff803b7833 = device_attach+0x3f3/frame 0xffffffff80dea360 bus_generic_new_pass() at 0xffffffff803b9016 = bus_generic_new_pass+0x116/frame 0xffffffff80dea390 bus_set_pass() at 0xffffffff803b4e1c = bus_set_pass+0x8c/frame 0xffffffff80dea3c0 configure() at 0xffffffff806283a9 = configure+0x9/frame 0xffffffff80dea3d0 mi_startup() at 0xffffffff8031f4cc = mi_startup+0x9c/frame 0xffffffff80dea3f0 btext() at 0xffffffff80268e8c = btext+0x2c KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at 0xffffffff803c4d9b = kdb_enter+0x3b: movq $0,0xffffffff80a3e260 = kdb_why From owner-svn-src-head@freebsd.org Sat Sep 30 12:30:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AD3BE271BA; Sat, 30 Sep 2017 12:30:07 +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 CDECE6EE99; Sat, 30 Sep 2017 12:30:06 +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 v8UCU5lv035029; Sat, 30 Sep 2017 12:30:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UCU5H6035028; Sat, 30 Sep 2017 12:30:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709301230.v8UCU5H6035028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 30 Sep 2017 12:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324122 - head/usr.sbin/traceroute6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/traceroute6 X-SVN-Commit-Revision: 324122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 12:30:07 -0000 Author: tuexen Date: Sat Sep 30 12:30:05 2017 New Revision: 324122 URL: https://svnweb.freebsd.org/changeset/base/324122 Log: Fix reporting of probing size. This bug was introduced in r324119. MFC after: 4 weeks Modified: head/usr.sbin/traceroute6/traceroute6.c Modified: head/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.c Sat Sep 30 12:06:21 2017 (r324121) +++ head/usr.sbin/traceroute6/traceroute6.c Sat Sep 30 12:30:05 2017 (r324122) @@ -904,7 +904,8 @@ main(int argc, char *argv[]) if (source) fprintf(stderr, " from %s", source); fprintf(stderr, ", %lu hops max, %lu byte packets\n", - max_hops, datalen); + max_hops, + datalen + ((useproto == IPPROTO_UDP) ? sizeof(struct udphdr) : 0)); (void) fflush(stderr); if (first_hop > 1) From owner-svn-src-head@freebsd.org Sat Sep 30 13:17:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D73E5E27BDE; Sat, 30 Sep 2017 13:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AA786FF3C; Sat, 30 Sep 2017 13:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8UDHVP8055313; Sat, 30 Sep 2017 13:17:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UDHVq1055311; Sat, 30 Sep 2017 13:17:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709301317.v8UDHVq1055311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 30 Sep 2017 13:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324123 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 324123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 13:17:33 -0000 Author: mav Date: Sat Sep 30 13:17:31 2017 New Revision: 324123 URL: https://svnweb.freebsd.org/changeset/base/324123 Log: Add sysctl/tunable for maximal request time. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_io.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Sep 30 12:30:05 2017 (r324122) +++ head/sys/cam/ctl/ctl.c Sat Sep 30 13:17:31 2017 (r324123) @@ -40,8 +40,6 @@ * Author: Ken Merry */ -#define _CTL_C - #include __FBSDID("$FreeBSD$"); @@ -410,6 +408,11 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWT static int ctl_lun_map_size = 1024; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, &ctl_lun_map_size, 0, "Size of per-port LUN map (max LUN + 1)"); +#ifdef CTL_TIME_IO +static int ctl_time_io_secs = CTL_TIME_IO_DEFAULT_SECS; +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, time_io_secs, CTLFLAG_RWTUN, + &ctl_time_io_secs, 0, "Log requests taking more seconds"); +#endif /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Sat Sep 30 12:30:05 2017 (r324122) +++ head/sys/cam/ctl/ctl_io.h Sat Sep 30 13:17:31 2017 (r324123) @@ -40,12 +40,6 @@ #ifndef _CTL_IO_H_ #define _CTL_IO_H_ -#ifdef _CTL_C -#define EXTERN(__var,__val) __var = __val -#else -#define EXTERN(__var,__val) extern __var -#endif - #define CTL_MAX_CDBLEN 32 /* * Uncomment this next line to enable printing out times for I/Os @@ -55,7 +49,6 @@ #define CTL_TIME_IO #ifdef CTL_TIME_IO #define CTL_TIME_IO_DEFAULT_SECS 90 -EXTERN(int ctl_time_io_secs, CTL_TIME_IO_DEFAULT_SECS); #endif /* From owner-svn-src-head@freebsd.org Sat Sep 30 14:44:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C39D7E28E40; Sat, 30 Sep 2017 14:44:04 +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 5738571CB6; Sat, 30 Sep 2017 14:44:02 +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 RAA04486; Sat, 30 Sep 2017 17:43:54 +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 1dyIzi-000HZx-Hk; Sat, 30 Sep 2017 17:43:54 +0300 Subject: Re: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... To: Konstantin Belousov , Li-Wen Hsu Cc: Jung-uk Kim , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201709292302.v8TN2nTl002342@repo.freebsd.org> <20170930105841.GA25789@freefall.freebsd.org> <20170930120436.GJ95911@kib.kiev.ua> From: Andriy Gapon Message-ID: <71b114f5-0482-6e69-9c8d-e7f81abcacda@FreeBSD.org> Date: Sat, 30 Sep 2017 17:42:55 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170930120436.GJ95911@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 14:44:04 -0000 On 30/09/2017 15:04, Konstantin Belousov wrote: > On Sat, Sep 30, 2017 at 10:58:41AM +0000, Li-Wen Hsu wrote: >> On Fri, Sep 29, 2017 at 23:02:49 +0000, Jung-uk Kim wrote: >>> Author: jkim >>> Date: Fri Sep 29 23:02:49 2017 >>> New Revision: 324109 >>> URL: https://svnweb.freebsd.org/changeset/base/324109 >>> >>> Log: >>> Merge ACPICA 20170929. >>> >>> Added: >>> head/sys/contrib/dev/acpica/compiler/aslallocate.c >>> - copied, changed from r324104, vendor-sys/acpica/dist/source/compiler/aslallocate.c >> >> Hi Jung-uk, >> >> After this change, the test machine booting in bhyve panics with this >> message: >> >> panic: acpi: timer op not yet supported during boot >> >> Could you help to check what happened here? The full boot log can be >> found here: >> >> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/4496/console >> > > This happens for me on the real hardware as well. > > SMP: passed TSC synchronization test > Timecounter "TSC" frequency 2095144854 Hz quality 1000 > random: entropy device external interface > io: > nfslock: pseudo-device > mem: > null: > nexus0 > random: harvesting attach, 8 bytes (4 bits) from ram0 > acpi0: on motherboard > ACPI: 4 ACPI AML tables successfully acquired and loaded > panic: acpi: timer op not yet supported during boot Seems like it's triggered by the code that's supposed to limit execution time of loops. > cpuid = 17 > time = 1 > KDB: stack backtrace: > db_trace_self_wrapper() at 0xffffffff802ac6fb = db_trace_self_wrapper+0x2b/frame 0xffffffff80de9da0 > vpanic() at 0xffffffff80380e0c = vpanic+0x19c/frame 0xffffffff80de9e20 > kassert_panic() at 0xffffffff80380c6f = kassert_panic+0x16f/frame 0xffffffff80de9e90 > AcpiOsGetTimer() at 0xffffffff802b1b08 = AcpiOsGetTimer+0x48/frame 0xffffffff80de9eb0 > AcpiDsExecBeginControlOp() at 0xffffffff80276f40 = AcpiDsExecBeginControlOp+0x80/frame 0xffffffff80de9ee0 > AcpiPsCreateOp() at 0xffffffff80290c83 = AcpiPsCreateOp+0x1b3/frame 0xffffffff80de9f30 > AcpiPsParseLoop() at 0xffffffff8029047f = AcpiPsParseLoop+0x1bf/frame 0xffffffff80de9fa0 > AcpiPsParseAml() at 0xffffffff80291540 = AcpiPsParseAml+0x80/frame 0xffffffff80de9fe0 > AcpiDsExecuteArguments() at 0xffffffff80276d4d = AcpiDsExecuteArguments+0x13d/frame 0xffffffff80dea040 > AcpiDsGetRegionArguments() at 0xffffffff80276e96 = AcpiDsGetRegionArguments+0x36/frame 0xffffffff80dea060 > AcpiNsInitOneObject() at 0xffffffff8028b153 = AcpiNsInitOneObject+0xd3/frame 0xffffffff80dea0a0 > AcpiNsWalkNamespace() at 0xffffffff8028e673 = AcpiNsWalkNamespace+0xc3/frame 0xffffffff80dea100 > AcpiWalkNamespace() at 0xffffffff8028ebf9 = AcpiWalkNamespace+0x99/frame 0xffffffff80dea160 > AcpiNsInitializeObjects() at 0xffffffff8028b052 = AcpiNsInitializeObjects+0x42/frame 0xffffffff80dea1c0 > AcpiLoadTables() at 0xffffffff80296648 = AcpiLoadTables+0x78/frame 0xffffffff80dea1e0 > acpi_attach() at 0xffffffff802b59cc = acpi_attach+0x31c/frame 0xffffffff80dea290 > device_attach() at 0xffffffff803b7833 = device_attach+0x3f3/frame 0xffffffff80dea2d0 > bus_generic_attach() at 0xffffffff803b898a = bus_generic_attach+0x5a/frame 0xffffffff80dea2f0 > nexus_acpi_attach() at 0xffffffff805b3593 = nexus_acpi_attach+0x73/frame 0xffffffff80dea320 > device_attach() at 0xffffffff803b7833 = device_attach+0x3f3/frame 0xffffffff80dea360 > bus_generic_new_pass() at 0xffffffff803b9016 = bus_generic_new_pass+0x116/frame 0xffffffff80dea390 > bus_set_pass() at 0xffffffff803b4e1c = bus_set_pass+0x8c/frame 0xffffffff80dea3c0 > configure() at 0xffffffff806283a9 = configure+0x9/frame 0xffffffff80dea3d0 > mi_startup() at 0xffffffff8031f4cc = mi_startup+0x9c/frame 0xffffffff80dea3f0 > btext() at 0xffffffff80268e8c = btext+0x2c > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at 0xffffffff803c4d9b = kdb_enter+0x3b: movq $0,0xffffffff80a3e260 = kdb_why -- Andriy Gapon From owner-svn-src-head@freebsd.org Sat Sep 30 16:16:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E226BE2A0FC; Sat, 30 Sep 2017 16:16:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B38B73C83; Sat, 30 Sep 2017 16:16:34 +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 v8UGGOZ4054341 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 30 Sep 2017 19:16:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v8UGGOZ4054341 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v8UGGO8B054340; Sat, 30 Sep 2017 19:16:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 30 Sep 2017 19:16:24 +0300 From: Konstantin Belousov To: Andriy Gapon Cc: Li-Wen Hsu , Jung-uk Kim , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... Message-ID: <20170930161624.GK95911@kib.kiev.ua> References: <201709292302.v8TN2nTl002342@repo.freebsd.org> <20170930105841.GA25789@freefall.freebsd.org> <20170930120436.GJ95911@kib.kiev.ua> <71b114f5-0482-6e69-9c8d-e7f81abcacda@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71b114f5-0482-6e69-9c8d-e7f81abcacda@FreeBSD.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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.23 Precedence: list List-Id: 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, 30 Sep 2017 16:16:35 -0000 On Sat, Sep 30, 2017 at 05:42:55PM +0300, Andriy Gapon wrote: > On 30/09/2017 15:04, Konstantin Belousov wrote: > > On Sat, Sep 30, 2017 at 10:58:41AM +0000, Li-Wen Hsu wrote: > >> On Fri, Sep 29, 2017 at 23:02:49 +0000, Jung-uk Kim wrote: > >>> Author: jkim > >>> Date: Fri Sep 29 23:02:49 2017 > >>> New Revision: 324109 > >>> URL: https://svnweb.freebsd.org/changeset/base/324109 > >>> > >>> Log: > >>> Merge ACPICA 20170929. > >>> > >>> Added: > >>> head/sys/contrib/dev/acpica/compiler/aslallocate.c > >>> - copied, changed from r324104, vendor-sys/acpica/dist/source/compiler/aslallocate.c > >> > >> Hi Jung-uk, > >> > >> After this change, the test machine booting in bhyve panics with this > >> message: > >> > >> panic: acpi: timer op not yet supported during boot > >> > >> Could you help to check what happened here? The full boot log can be > >> found here: > >> > >> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/4496/console > >> > > > > This happens for me on the real hardware as well. > > > > SMP: passed TSC synchronization test > > Timecounter "TSC" frequency 2095144854 Hz quality 1000 > > random: entropy device external interface > > io: > > nfslock: pseudo-device > > mem: > > null: > > nexus0 > > random: harvesting attach, 8 bytes (4 bits) from ram0 > > acpi0: on motherboard > > ACPI: 4 ACPI AML tables successfully acquired and loaded > > panic: acpi: timer op not yet supported during boot > > Seems like it's triggered by the code that's supposed to limit execution time of > loops. > After your comment I thought that this is another case of an update requiring EARLY_AP_STARTUP option, but apparently the kernel config on this box does contain it already. > > cpuid = 17 > > time = 1 > > KDB: stack backtrace: > > db_trace_self_wrapper() at 0xffffffff802ac6fb = db_trace_self_wrapper+0x2b/frame 0xffffffff80de9da0 > > vpanic() at 0xffffffff80380e0c = vpanic+0x19c/frame 0xffffffff80de9e20 > > kassert_panic() at 0xffffffff80380c6f = kassert_panic+0x16f/frame 0xffffffff80de9e90 > > AcpiOsGetTimer() at 0xffffffff802b1b08 = AcpiOsGetTimer+0x48/frame 0xffffffff80de9eb0 > > AcpiDsExecBeginControlOp() at 0xffffffff80276f40 = AcpiDsExecBeginControlOp+0x80/frame 0xffffffff80de9ee0 > > AcpiPsCreateOp() at 0xffffffff80290c83 = AcpiPsCreateOp+0x1b3/frame 0xffffffff80de9f30 > > AcpiPsParseLoop() at 0xffffffff8029047f = AcpiPsParseLoop+0x1bf/frame 0xffffffff80de9fa0 > > AcpiPsParseAml() at 0xffffffff80291540 = AcpiPsParseAml+0x80/frame 0xffffffff80de9fe0 > > AcpiDsExecuteArguments() at 0xffffffff80276d4d = AcpiDsExecuteArguments+0x13d/frame 0xffffffff80dea040 > > AcpiDsGetRegionArguments() at 0xffffffff80276e96 = AcpiDsGetRegionArguments+0x36/frame 0xffffffff80dea060 > > AcpiNsInitOneObject() at 0xffffffff8028b153 = AcpiNsInitOneObject+0xd3/frame 0xffffffff80dea0a0 > > AcpiNsWalkNamespace() at 0xffffffff8028e673 = AcpiNsWalkNamespace+0xc3/frame 0xffffffff80dea100 > > AcpiWalkNamespace() at 0xffffffff8028ebf9 = AcpiWalkNamespace+0x99/frame 0xffffffff80dea160 > > AcpiNsInitializeObjects() at 0xffffffff8028b052 = AcpiNsInitializeObjects+0x42/frame 0xffffffff80dea1c0 > > AcpiLoadTables() at 0xffffffff80296648 = AcpiLoadTables+0x78/frame 0xffffffff80dea1e0 > > acpi_attach() at 0xffffffff802b59cc = acpi_attach+0x31c/frame 0xffffffff80dea290 > > device_attach() at 0xffffffff803b7833 = device_attach+0x3f3/frame 0xffffffff80dea2d0 > > bus_generic_attach() at 0xffffffff803b898a = bus_generic_attach+0x5a/frame 0xffffffff80dea2f0 > > nexus_acpi_attach() at 0xffffffff805b3593 = nexus_acpi_attach+0x73/frame 0xffffffff80dea320 > > device_attach() at 0xffffffff803b7833 = device_attach+0x3f3/frame 0xffffffff80dea360 > > bus_generic_new_pass() at 0xffffffff803b9016 = bus_generic_new_pass+0x116/frame 0xffffffff80dea390 > > bus_set_pass() at 0xffffffff803b4e1c = bus_set_pass+0x8c/frame 0xffffffff80dea3c0 > > configure() at 0xffffffff806283a9 = configure+0x9/frame 0xffffffff80dea3d0 > > mi_startup() at 0xffffffff8031f4cc = mi_startup+0x9c/frame 0xffffffff80dea3f0 > > btext() at 0xffffffff80268e8c = btext+0x2c > > KDB: enter: panic > > [ thread pid 0 tid 100000 ] > > Stopped at 0xffffffff803c4d9b = kdb_enter+0x3b: movq $0,0xffffffff80a3e260 = kdb_why > > > -- > Andriy Gapon From owner-svn-src-head@freebsd.org Sat Sep 30 16:47:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAE0CE2A95B; Sat, 30 Sep 2017 16:47:46 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 556947486A; Sat, 30 Sep 2017 16:47:46 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id yKvWdBNFnI8mCyKvXdNERC; Sat, 30 Sep 2017 10:47:44 -0600 X-Authority-Analysis: v=2.2 cv=HahkdmM8 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=2JCJgTwv5E4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=icVucg2hgZ0Oeu7F8MwA:9 a=bqAEnAvX_D_vEMB-:21 a=qnbIcWOTyDrJOcpX:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 601AB146B; Sat, 30 Sep 2017 09:47:42 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v8UGlfiY091269; Sat, 30 Sep 2017 09:47:41 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201709301647.v8UGlfiY091269@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Konstantin Belousov cc: Andriy Gapon , Li-Wen Hsu , Jung-uk Kim , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... In-Reply-To: Message from Konstantin Belousov of "Sat, 30 Sep 2017 19:16:24 +0300." <20170930161624.GK95911@kib.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 30 Sep 2017 09:47:41 -0700 X-CMAE-Envelope: MS4wfKihhCPUJQIDlORCY21OK0X+/lffsY9ojnt9VxoPLEitngip3bBoRtZsyBJggHPW3Q8wKqfNkEFoawx2ZLkcLzrOh4VjXzKNVKdshBo/v1e2SetnOjsA JgIm+MQ5DKUwYRyazaTST3Jxubx60c4umkyro37vgsnPjBm65j/GZ6W4olh0gUtbiVFd1UW38yC2AzYBoNzUqn7eVQqBq3lG5ymhlILtwRvs/PJmUMYg3ZLT vKO7T1jb2l9cho+Ge87e6YiiJvNBf0QVYPuSVYCvK5W2/EnQuc2k7gefzM4SgFCKC+H6tBOjXw/IvImcduDvHt4RwSHQDh6TKUxt29KkGXcXnbSPx1yqkdtk NCjN2HoAwN+WTxPIE4zlFK3Il6dIkA== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 16:47:46 -0000 In message <20170930161624.GK95911@kib.kiev.ua>, Konstantin Belousov writes: > On Sat, Sep 30, 2017 at 05:42:55PM +0300, Andriy Gapon wrote: > > On 30/09/2017 15:04, Konstantin Belousov wrote: > > > On Sat, Sep 30, 2017 at 10:58:41AM +0000, Li-Wen Hsu wrote: > > >> On Fri, Sep 29, 2017 at 23:02:49 +0000, Jung-uk Kim wrote: > > >>> Author: jkim > > >>> Date: Fri Sep 29 23:02:49 2017 > > >>> New Revision: 324109 > > >>> URL: https://svnweb.freebsd.org/changeset/base/324109 > > >>> > > >>> Log: > > >>> Merge ACPICA 20170929. > > >>> > > >>> Added: > > >>> head/sys/contrib/dev/acpica/compiler/aslallocate.c > > >>> - copied, changed from r324104, vendor-sys/acpica/dist/source/comp > iler/aslallocate.c > > >> > > >> Hi Jung-uk, > > >> > > >> After this change, the test machine booting in bhyve panics with this > > >> message: > > >> > > >> panic: acpi: timer op not yet supported during boot > > >> > > >> Could you help to check what happened here? The full boot log can be > > >> found here: > > >> > > >> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/4496/console > > >> > > > > > > This happens for me on the real hardware as well. > > > > > > SMP: passed TSC synchronization test > > > Timecounter "TSC" frequency 2095144854 Hz quality 1000 > > > random: entropy device external interface > > > io: > > > nfslock: pseudo-device > > > mem: > > > null: > > > nexus0 > > > random: harvesting attach, 8 bytes (4 bits) from ram0 > > > acpi0: on motherboard > > > ACPI: 4 ACPI AML tables successfully acquired and loaded > > > panic: acpi: timer op not yet supported during boot > > > > Seems like it's triggered by the code that's supposed to limit execution ti > me of > > loops. > > > After your comment I thought that this is another case of an update requiring > EARLY_AP_STARTUP option, but apparently the kernel config on this box does > contain it already. I have disabled EARLY_AP_STARTUP (due to an issue in a local bge WOL patch, which I have yet to resolve). My kernel boots, so EARLY_AP_STARTUP is likely not involved. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sat Sep 30 17:51:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD1B8E2BF20; Sat, 30 Sep 2017 17:51:11 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABF0076522; Sat, 30 Sep 2017 17:51:11 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8UHpAmY067187; Sat, 30 Sep 2017 17:51:10 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UHpAKv067186; Sat, 30 Sep 2017 17:51:10 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201709301751.v8UHpAKv067186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Sat, 30 Sep 2017 17:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324125 - head/sbin/mdmfs X-SVN-Group: head X-SVN-Commit-Author: andreast X-SVN-Commit-Paths: head/sbin/mdmfs X-SVN-Commit-Revision: 324125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 17:51:12 -0000 Author: andreast Date: Sat Sep 30 17:51:10 2017 New Revision: 324125 URL: https://svnweb.freebsd.org/changeset/base/324125 Log: Initialize mdsize to make gcc happy again. This fixes buildworld on powerpc. Reviewed by: ian@ Modified: head/sbin/mdmfs/mdmfs.c Modified: head/sbin/mdmfs/mdmfs.c ============================================================================== --- head/sbin/mdmfs/mdmfs.c Sat Sep 30 17:30:22 2017 (r324124) +++ head/sbin/mdmfs/mdmfs.c Sat Sep 30 17:51:10 2017 (r324125) @@ -117,6 +117,7 @@ main(int argc, char **argv) mdtype = MD_SWAP; mdname = MD_NAME; mdnamelen = strlen(mdname); + mdsize = 0; /* * Can't set these to NULL. They may be passed to the * respective programs without modification. I.e., we may not From owner-svn-src-head@freebsd.org Sat Sep 30 18:23:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A7A6E2C8DA; Sat, 30 Sep 2017 18:23:46 +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 14D86776D4; Sat, 30 Sep 2017 18:23:46 +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 v8UINjg9082912; Sat, 30 Sep 2017 18:23:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UINjDY082911; Sat, 30 Sep 2017 18:23:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709301823.v8UINjDY082911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 30 Sep 2017 18:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324127 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 324127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 18:23:46 -0000 Author: mjg Date: Sat Sep 30 18:23:45 2017 New Revision: 324127 URL: https://svnweb.freebsd.org/changeset/base/324127 Log: tmpfs: skip zero-sized page count updates Such updates consisted of vast majority of modificiations, especially in tmpfs_reg_resize. For the case where page count did no change and the size grew we only need to update tn_size. Use this fact to avoid vm object lock/relock. MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sat Sep 30 18:07:46 2017 (r324126) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sat Sep 30 18:23:45 2017 (r324127) @@ -350,7 +350,8 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - atomic_subtract_long(&tmp->tm_pages_used, uobj->size); + if (uobj->size != 0) + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1375,6 +1376,12 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, bool oldpages = OFF_TO_IDX(oldsize + PAGE_MASK); MPASS(oldpages == uobj->size); newpages = OFF_TO_IDX(newsize + PAGE_MASK); + + if (__predict_true(newpages == oldpages && newsize >= oldsize)) { + node->tn_size = newsize; + return (0); + } + if (newpages > oldpages && tmpfs_pages_check_avail(tmp, newpages - oldpages) == 0) return (ENOSPC); From owner-svn-src-head@freebsd.org Sat Sep 30 19:01:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7D51E2CF79; Sat, 30 Sep 2017 19:01:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69F8B7C8BB; Sat, 30 Sep 2017 19:01:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x233.google.com with SMTP id n24so1225568pfk.5; Sat, 30 Sep 2017 12:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=Jh8a/MH9kvKbtNKOKiqyaZ8kBCWGclH8Du+c/s7ud5Y=; b=S3ihF3J+7Jo9iOyP5wavpXaG7gwRW9f0LdAdBlhvzlsZU8NIR1TOSL+QxRL3PiH8BK 7JHzMkDceyo26ISiCRbIxiek8VzwljliWxvZViGpEAV/1A+nm2+s1r7aFBF2Eh4xmCUG v4Y3lOX5PhuojrwaTK1Kt2PPQkz+MlaflXKGnYeVAo5LYc6aR5lY61nO56Cz6ytF245U GrCsKDksCUzVhC+8qvRqpQekEaccwlwacjs/pdvj9rS0AefhkJle79a0hQW/wIPFODxO 3Fj9wy1TkDY3ahuWHNk4W0BaHTro8Lh5SOhmP/FmpXchz00TuHWTK4cyUKmUmYofi9jT TqbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=Jh8a/MH9kvKbtNKOKiqyaZ8kBCWGclH8Du+c/s7ud5Y=; b=LENMzFr3wBxl43rMbj2p97qtFzjBGvqfqsAeA+p4q9n1tg0JRd4TvWIOBa7qNlJF0K txUWzJ8brV6TCxWruJzf5h8DBw1anjPwIF8t9SpuA9ZO6EJ4RdqbPB3pO+Nhoxj924R9 sVrj2OHWBREAoPmXGyPLv3lJe6+2OhOrnXD8OydLHa27nAbAXbml2C1eA5Kvn/ZzHxPT wr5d1VgLX6E+Lw2COerYsE2pvc4UIFiG3Om+/Cos49i9epOUsREo88e+b6jgPgg6VcCY /XLEFRNrEZ/uds/zEWhQ6fxmuJMXht6MrNCE5Qi/KY3IMMUdu4NMZwQ4LuFjcebdkfBd xV8Q== X-Gm-Message-State: AHPjjUhnVTzheE1ahXWDeinRfxonrOndHU+B7r+owvLjEpH9l6sQHlB+ sr1pRhDNfiUq60Ary5ekQMA= X-Google-Smtp-Source: AOwi7QC/whvT2aC2Ga7BQTE8lXZGPVIBqwpRJ+OoFk7HCZo8sSBCGAi80gIIUDEyK7WoR+BcdIFw2w== X-Received: by 10.98.133.17 with SMTP id u17mr10883626pfd.235.1506798118752; Sat, 30 Sep 2017 12:01:58 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id a1sm13081112pgu.47.2017.09.30.12.01.57 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Sep 2017 12:01:57 -0700 (PDT) Subject: Re: svn commit: r324109 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_076F7004-831B-4F61-B510-4596E8113479"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <20170930161624.GK95911@kib.kiev.ua> Date: Sat, 30 Sep 2017 12:01:56 -0700 Cc: Andriy Gapon , Li-Wen Hsu , Jung-uk Kim , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-Id: References: <201709292302.v8TN2nTl002342@repo.freebsd.org> <20170930105841.GA25789@freefall.freebsd.org> <20170930120436.GJ95911@kib.kiev.ua> <71b114f5-0482-6e69-9c8d-e7f81abcacda@FreeBSD.org> <20170930161624.GK95911@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 19:01:59 -0000 --Apple-Mail=_076F7004-831B-4F61-B510-4596E8113479 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Sep 30, 2017, at 09:16, Konstantin Belousov = wrote: Given the number of panic reports, could the commit be reverted = and a fix be submitted later so others can develop on ^/head? Thanks, -Ngie --Apple-Mail=_076F7004-831B-4F61-B510-4596E8113479 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 iQIcBAEBCgAGBQJZz+okAAoJEPWDqSZpMIYVOW8QAJpI70un2zQ86WRt7/X6pT/u IGYLUaHEdGmB7Nzvp5BDO3naic2BPB1oCTcrlJZAFKC+Gv+kZJNZsZAM78vdwI0L Wv8lbdWR/X/kuvdxAnvphMhfwc5LNOUO6q0JpQQtlv+i8GT2+dEd4ENXuFqVQylv M5vvF3PRvnxiIkBUxSpqpnmLTtEzOw/iCRVjh2kKvKW8dQ2WusO2KdP6t4r+B7M/ kUWck1UIHecpEadViLV+1wJ3oY6tWRqdsHbxzlTgiZANL0d5flJriFtNMjCt/ez0 5YH3D2mPKFTTAMRYWgRWhc14/nJ/VdcM++xWCY872SAt3lIZuv91mc5hNBcNcCKC sorpI87DaCA2jCn2NA8mLAnm30FnPfBQh0mv+pE2yxvyPlxqDd1m7JY0+AiILBL2 Zn++ZeP65z6m+5l/CTRxJ9mXn6D3ZTC/4ddd5vg/AuxCvPoM6vHZaMgO16+MC1UA YIPKvtazq/UVuRnIWRdpj1x8KPELo7L/Pb6mLhE2S/kcafo2XePqpX25WvB60PN0 q+UfSwU0hSfS7T3KvlvQP3FDXSa3iJvuuCJn1/SQp+cqDqdqwleBgjDf6ZFmSfwv Ve/lWVTHhfG2phrbSv/2Sy+WTIwH/+Lw5uUZWr0y4x9t4EUcHqYZQSQ57VKSSEFK lp8lcHJUXjJQ6wAdW/w0 =5MH7 -----END PGP SIGNATURE----- --Apple-Mail=_076F7004-831B-4F61-B510-4596E8113479-- From owner-svn-src-head@freebsd.org Sat Sep 30 20:28:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05490E2E9F9; Sat, 30 Sep 2017 20:28:52 +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 9FF067F6FD; Sat, 30 Sep 2017 20:28:51 +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 v8UKSoJt033261; Sat, 30 Sep 2017 20:28:50 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UKSoxO033255; Sat, 30 Sep 2017 20:28:50 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201709302028.v8UKSoxO033255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Sat, 30 Sep 2017 20:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324136 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/ha... X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/dispatcher sys/contrib/dev/acpica/components/hardware sys/contrib/dev/ac... X-SVN-Commit-Revision: 324136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 20:28:52 -0000 Author: jkim Date: Sat Sep 30 20:28:50 2017 New Revision: 324136 URL: https://svnweb.freebsd.org/changeset/base/324136 Log: Revert r324109. This commit broke a number of systems. Reported by: lwhsu, kib Requested by: ngie Deleted: head/sys/contrib/dev/acpica/compiler/aslallocate.c head/sys/contrib/dev/acpica/compiler/aslcache.c Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/adfile.c head/sys/contrib/dev/acpica/common/ahtable.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/common/dmtbdump.c head/sys/contrib/dev/acpica/common/dmtbinfo.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/aslcompiler.l head/sys/contrib/dev/acpica/compiler/asldebug.c head/sys/contrib/dev/acpica/compiler/aslerror.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/aslhelp.c head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmapenter.c head/sys/contrib/dev/acpica/compiler/aslmaputils.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslmethod.c head/sys/contrib/dev/acpica/compiler/asloperands.c head/sys/contrib/dev/acpica/compiler/aslopt.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/aslparseop.c head/sys/contrib/dev/acpica/compiler/aslprintf.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/aslsupport.l head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/cvcompiler.c head/sys/contrib/dev/acpica/compiler/cvparser.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dtexpress.c head/sys/contrib/dev/acpica/compiler/dtfield.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dtparser.y head/sys/contrib/dev/acpica/compiler/dtsubtable.c head/sys/contrib/dev/acpica/compiler/dttable.c head/sys/contrib/dev/acpica/compiler/dttable1.c head/sys/contrib/dev/acpica/compiler/dttable2.c head/sys/contrib/dev/acpica/compiler/dttemplate.c head/sys/contrib/dev/acpica/compiler/dttemplate.h head/sys/contrib/dev/acpica/compiler/dtutils.c head/sys/contrib/dev/acpica/compiler/prexpress.c head/sys/contrib/dev/acpica/compiler/prmacros.c head/sys/contrib/dev/acpica/compiler/prparser.y head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/compiler/prutils.c head/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c head/sys/contrib/dev/acpica/components/hardware/hwtimer.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nssearch.c head/sys/contrib/dev/acpica/components/parser/psobject.c head/sys/contrib/dev/acpica/components/parser/psutils.c head/sys/contrib/dev/acpica/components/utilities/utinit.c head/sys/contrib/dev/acpica/components/utilities/utmath.c head/sys/contrib/dev/acpica/include/acapps.h head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/acexcep.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actbl1.h head/sys/contrib/dev/acpica/include/actbl2.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/dev/acpica/acpi_cpu.c head/usr.sbin/acpi/iasl/Makefile Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Sat Sep 30 20:07:57 2017 (r324135) +++ head/sys/contrib/dev/acpica/changes.txt Sat Sep 30 20:28:50 2017 (r324136) @@ -1,104 +1,4 @@ ---------------------------------------- -29 September 2017. Summary of changes for version 20170929: - - -1) ACPICA kernel-resident subsystem: - -Redesigned and implemented an improved ASL While() loop timeout -mechanism. This mechanism is used to prevent infinite loops in the kernel -AML interpreter caused by either non-responsive hardware or incorrect AML -code. The new implementation uses AcpiOsGetTimer instead of a simple -maximum loop count, and is thus more accurate and constant across -different machines. The default timeout is currently 30 seconds, but this -may be adjusted later. - -Renamed the ACPI_AML_INFINITE_LOOP exception to AE_AML_LOOP_TIMEOUT to -better reflect the new implementation of the loop timeout mechanism. - -Updated the AcpiGetTimerDuration interface to cleanup the 64-bit support -and to fix an off-by-one error. Jung-uk Kim. - -Fixed an EFI build problem by updating the makefiles to for a new file -that was added, utstrsuppt.c - - -2) iASL Compiler/Disassembler and Tools: - -Implemented full support for the PDTT, SDEV, and TPM2 ACPI tables. This -includes support in the table disassembler, compiler, and template -generator. - -iASL: Added an exception for an illegal type of recursive method -invocation. If a method creates named objects, the first recursive call -will fail at runtime. This change adds an error detection at compile time -to catch the problem up front. Note: Marking such a method as -"serialized" will not help with this problem, because the same thread can -acquire the method mutex more than once. Example compiler and runtime -output: - - Method (MTH1) - { - Name (INT1, 1) - MTH1 () - } - - dsdt.asl 22: MTH1 () - Error 6152 - ^ Illegal recursive call to method - that creates named objects (MTH1) - -Previous runtime exception: - ACPI Error: [INT1] Namespace lookup failure, - AE_ALREADY_EXISTS (20170831/dswload2-465) - -iASL: Updated support for External() opcodes to improve namespace -management and error detection. These changes are related to issues seen -with multiple-segment namespace pathnames within External declarations, -such as below: - - External(\_SB.PCI0.GFX0, DeviceObj) - External(\_SB.PCI0.GFX0.ALSI) - -iASL: Implemented support for multi-line error/warning messages. This -enables more detailed and helpful error messages as below, from the -initial deployment for the duplicate names error: - - DSDT.iiii 1692: Device(PEG2) { - Error 6074 - ^ Name already exists in scope -(PEG2) - - Original name creation/declaration below: - DSDT.iiii 93: External(\_SB.PCI0.PEG2, DeviceObj) - -AcpiXtract: Added additional flexibility to support differing input hex -dump formats. Specifically, hex dumps that contain partial disassembly -and/or comments within the ACPI table data definition. There exist some -dump utilities seen in the field that create this type of hex dump (such -as Simics). For example: - - DSDT @ 0xdfffd0c0 (10999 bytes) - Signature DSDT - Length 10999 - Revision 1 - Checksum 0xf3 (Ok) - OEM_ID BXPC - OEM_table_id BXDSDT - OEM_revision 1 - Creator_id 1280593481 - Creator_revision 537399345 - 0000: 44 53 44 54 f7 2a 00 00 01 f3 42 58 50 43 00 00 - ... - 2af0: 5f 4c 30 46 00 a4 01 - -Test suite: Miscellaneous changes/fixes: - More cleanup and simplification of makefiles - Continue compilation of test cases after a compile failure - Do not perform binary compare unless both files actually exist - -iASL: Performed some code/module restructuring. Moved all memory -allocation functions to new modules. Two new files, aslallocate.c and -aslcache.c - ----------------------------------------- 31 August 2017. Summary of changes for version 20170831: Modified: head/sys/contrib/dev/acpica/common/adfile.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adfile.c Sat Sep 30 20:07:57 2017 (r324135) +++ head/sys/contrib/dev/acpica/common/adfile.c Sat Sep 30 20:28:50 2017 (r324136) @@ -314,7 +314,7 @@ FlGenerateFilename ( * Copy the original filename to a new buffer. Leave room for the worst * case where we append the suffix, an added dot and the null terminator. */ - NewFilename = UtLocalCacheCalloc ((ACPI_SIZE) + NewFilename = UtStringCacheCalloc ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); strcpy (NewFilename, InputFilename); @@ -358,7 +358,7 @@ FlStrdup ( char *NewString; - NewString = UtLocalCacheCalloc ((ACPI_SIZE) strlen (String) + 1); + NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1); strcpy (NewString, String); return (NewString); } Modified: head/sys/contrib/dev/acpica/common/ahtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/ahtable.c Sat Sep 30 20:07:57 2017 (r324135) +++ head/sys/contrib/dev/acpica/common/ahtable.c Sat Sep 30 20:28:50 2017 (r324136) @@ -232,7 +232,6 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_MTMR, "MID Timer Table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, - {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, @@ -241,7 +240,6 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, - {ACPI_SIG_SDEV, "Secure Devices table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Sat Sep 30 20:07:57 2017 (r324135) +++ head/sys/contrib/dev/acpica/common/dmtable.c Sat Sep 30 20:28:50 2017 (r324136) @@ -154,6 +154,7 @@ #include #include #include +#include /* This module used for application-level code only */ @@ -289,9 +290,9 @@ static const char *AcpiDmHestSubnames[] = "IA-32 Machine Check Exception", "IA-32 Corrected Machine Check", "IA-32 Non-Maskable Interrupt", - "Unknown Subtable Type", /* 3 - Reserved */ - "Unknown Subtable Type", /* 4 - Reserved */ - "Unknown Subtable Type", /* 5 - Reserved */ + "Unknown SubTable Type", /* 3 - Reserved */ + "Unknown SubTable Type", /* 4 - Reserved */ + "Unknown SubTable Type", /* 5 - Reserved */ "PCI Express Root Port AER", "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", @@ -373,7 +374,7 @@ static const char *AcpiDmPmttSubnames[] = { "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ - "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ + "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ "Unknown Subtable Type" /* Reserved */ }; @@ -381,17 +382,10 @@ static const char *AcpiDmPpttSubnames[] = { "Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */ "Cache Type", /* ACPI_PPTT_TYPE_CACHE */ - "ID", /* ACPI_PPTT_TYPE_ID */ + "ID", /* ACPI_PMTT_TYPE_ID */ "Unknown Subtable Type" /* Reserved */ }; -static const char *AcpiDmSdevSubnames[] = -{ - "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */ - "PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */ - "Unknown Subtable Type" /* Reserved */ -}; - static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", @@ -402,23 +396,6 @@ static const char *AcpiDmSratSubnames[] = "Unknown Subtable Type" /* Reserved */ }; -static const char *AcpiDmTpm2Subnames[] = -{ - "Illegal Start Method value", - "Reserved", - "ACPI Start Method", - "Reserved", - "Reserved", - "Reserved", - "Memory Mapped I/O", - "Command Response Buffer", - "Command Response Buffer with ACPI Start Method", - "Reserved", - "Reserved", - "Command Response Buffer with ARM SMC", - "Unknown Subtable Type" /* Reserved */ -}; - static const char *AcpiDmIvrsSubnames[] = { "Hardware Definition Block", @@ -510,7 +487,6 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, - {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, @@ -518,7 +494,6 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei}, - {ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev}, {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, @@ -526,7 +501,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, - {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, + {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, @@ -942,7 +917,6 @@ AcpiDmDumpTable ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: - case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -974,7 +948,6 @@ AcpiDmDumpTable ( case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: - case ACPI_DMT_TPM2: ByteLength = 4; break; @@ -1610,20 +1583,6 @@ AcpiDmDumpTable ( CurrentOffset, NULL); break; - case ACPI_DMT_SDEV: - - /* SDEV subtable types */ - - Temp8 = *Target; - if (Temp8 > ACPI_SDEV_TYPE_RESERVED) - { - Temp8 = ACPI_SDEV_TYPE_RESERVED; - } - - AcpiOsPrintf (UINT8_FORMAT, *Target, - AcpiDmSdevSubnames[Temp8]); - break; - case ACPI_DMT_SRAT: /* SRAT subtable types */ @@ -1637,22 +1596,6 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]); break; - - case ACPI_DMT_TPM2: - - /* TPM2 Start Method types */ - - Temp8 = *Target; - if (Temp8 > ACPI_TPM2_RESERVED) - { - Temp8 = ACPI_TPM2_RESERVED; - } - - AcpiOsPrintf (UINT8_FORMAT, *Target, - AcpiDmTpm2Subnames[Temp8]); - break; - - case ACPI_DMT_FADTPM: Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump.c Sat Sep 30 20:07:57 2017 (r324135) +++ head/sys/contrib/dev/acpica/common/dmtbdump.c Sat Sep 30 20:28:50 2017 (r324136) @@ -623,7 +623,7 @@ AcpiDmDumpAsf ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); - ACPI_ASF_INFO *Subtable; + ACPI_ASF_INFO *SubTable; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMTABLE_INFO *DataInfoTable = NULL; UINT8 *DataTable = NULL; @@ -636,13 +636,13 @@ AcpiDmDumpAsf ( /* No main table, only subtables */ - Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - Subtable->Header.Length, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoAsfHdr); if (ACPI_FAILURE (Status)) { return; @@ -650,7 +650,7 @@ AcpiDmDumpAsf ( /* The actual type is the lower 7 bits of Type */ - Type = (UINT8) (Subtable->Header.Type & 0x7F); + Type = (UINT8) (SubTable->Header.Type & 0x7F); switch (Type) { @@ -663,9 +663,9 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf1; DataInfoTable = AcpiDmTableInfoAsf1a; - DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts; - DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength; + DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT)); + DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts; + DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_ALERT); break; @@ -673,9 +673,9 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf2; DataInfoTable = AcpiDmTableInfoAsf2a; - DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls; - DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength; + DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE)); + DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls; + DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); break; @@ -687,20 +687,20 @@ AcpiDmDumpAsf ( case ACPI_ASF_TYPE_ADDRESS: InfoTable = AcpiDmTableInfoAsf4; - DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS)); - DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices; + DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS)); + DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices; DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); break; default: AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", - Subtable->Header.Type); + SubTable->Header.Type); return; } - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - Subtable->Header.Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -762,15 +762,15 @@ AcpiDmDumpAsf ( /* Point to next subtable */ - if (!Subtable->Header.Length) + if (!SubTable->Header.Length) { AcpiOsPrintf ("Invalid zero subtable header length\n"); return; } - Offset += Subtable->Header.Length; - Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, - Subtable->Header.Length); + Offset += SubTable->Header.Length; + SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, + SubTable->Header.Length); } } @@ -793,7 +793,7 @@ AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_CPEP_POLLING *Subtable; + ACPI_CPEP_POLLING *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -808,12 +808,12 @@ AcpiDmDumpCpep ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Header.Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoCpep0); if (ACPI_FAILURE (Status)) { return; @@ -821,9 +821,9 @@ AcpiDmDumpCpep ( /* Point to next subtable */ - Offset += Subtable->Header.Length; - Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable, - Subtable->Header.Length); + Offset += SubTable->Header.Length; + SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, + SubTable->Header.Length); } } @@ -846,9 +846,9 @@ AcpiDmDumpCsrt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_CSRT_GROUP *Subtable; + ACPI_CSRT_GROUP *SubTable; ACPI_CSRT_SHARED_INFO *SharedInfoTable; - ACPI_CSRT_DESCRIPTOR *SubSubtable; + ACPI_CSRT_DESCRIPTOR *SubSubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CSRT); UINT32 SubOffset; @@ -860,14 +860,14 @@ AcpiDmDumpCsrt ( /* Subtables (Resource Groups) */ - Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); while (Offset < Table->Length) { /* Resource group subtable */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoCsrt0); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoCsrt0); if (ACPI_FAILURE (Status)) { return; @@ -887,19 +887,19 @@ AcpiDmDumpCsrt ( return; } - SubOffset += Subtable->SharedInfoLength; + SubOffset += SubTable->SharedInfoLength; /* Sub-Subtables (Resource Descriptors) */ - SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, + SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, Offset + SubOffset); - while ((SubOffset < Subtable->Length) && + while ((SubOffset < SubTable->Length) && ((Offset + SubOffset) < Table->Length)) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable, - SubSubtable->Length, AcpiDmTableInfoCsrt2); + Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable, + SubSubTable->Length, AcpiDmTableInfoCsrt2); if (ACPI_FAILURE (Status)) { return; @@ -909,7 +909,7 @@ AcpiDmDumpCsrt ( /* Resource-specific info buffer */ - InfoLength = SubSubtable->Length - SubSubOffset; + InfoLength = SubSubTable->Length - SubSubOffset; if (InfoLength) { Status = AcpiDmDumpTable (Length, @@ -924,16 +924,16 @@ AcpiDmDumpCsrt ( /* Point to next sub-subtable */ - SubOffset += SubSubtable->Length; - SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable, - SubSubtable->Length); + SubOffset += SubSubTable->Length; + SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable, + SubSubTable->Length); } /* Point to next subtable */ - Offset += Subtable->Length; - Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, - Subtable->Length); + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, + SubTable->Length); } } @@ -956,7 +956,7 @@ AcpiDmDumpDbg2 ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DBG2_DEVICE *Subtable; + ACPI_DBG2_DEVICE *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DBG2); UINT32 i; @@ -975,12 +975,12 @@ AcpiDmDumpDbg2 ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoDbg2Device); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDbg2Device); if (ACPI_FAILURE (Status)) { return; @@ -988,15 +988,15 @@ AcpiDmDumpDbg2 ( /* Dump the BaseAddress array */ - for (i = 0; i < Subtable->RegisterCount; i++) + for (i = 0; i < SubTable->RegisterCount; i++) { - ArrayOffset = Subtable->BaseAddressOffset + + ArrayOffset = SubTable->BaseAddressOffset + (sizeof (ACPI_GENERIC_ADDRESS) * i); AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) Subtable + ArrayOffset; + Array = (UINT8 *) SubTable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - Subtable->Length, AcpiDmTableInfoDbg2Addr); + SubTable->Length, AcpiDmTableInfoDbg2Addr); if (ACPI_FAILURE (Status)) { return; @@ -1005,15 +1005,15 @@ AcpiDmDumpDbg2 ( /* Dump the AddressSize array */ - for (i = 0; i < Subtable->RegisterCount; i++) + for (i = 0; i < SubTable->RegisterCount; i++) { - ArrayOffset = Subtable->AddressSizeOffset + + ArrayOffset = SubTable->AddressSizeOffset + (sizeof (UINT32) * i); AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) Subtable + ArrayOffset; + Array = (UINT8 *) SubTable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - Subtable->Length, AcpiDmTableInfoDbg2Size); + SubTable->Length, AcpiDmTableInfoDbg2Size); if (ACPI_FAILURE (Status)) { return; @@ -1023,12 +1023,12 @@ AcpiDmDumpDbg2 ( /* Dump the Namestring (required) */ AcpiOsPrintf ("\n"); - ArrayOffset = Subtable->NamepathOffset; + ArrayOffset = SubTable->NamepathOffset; AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) Subtable + ArrayOffset; + Array = (UINT8 *) SubTable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - Subtable->Length, AcpiDmTableInfoDbg2Name); + SubTable->Length, AcpiDmTableInfoDbg2Name); if (ACPI_FAILURE (Status)) { return; @@ -1036,10 +1036,10 @@ AcpiDmDumpDbg2 ( /* Dump the OemData (optional) */ - if (Subtable->OemDataOffset) + if (SubTable->OemDataOffset) { - Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset, - Table, Subtable->OemDataLength, + Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset, + Table, SubTable->OemDataLength, AcpiDmTableInfoDbg2OemData); if (ACPI_FAILURE (Status)) { @@ -1049,9 +1049,9 @@ AcpiDmDumpDbg2 ( /* Point to next subtable */ - Offset += Subtable->Length; - Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable, - Subtable->Length); + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, + SubTable->Length); } } @@ -1074,7 +1074,7 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DMAR_HEADER *Subtable; + ACPI_DMAR_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); ACPI_DMTABLE_INFO *InfoTable; @@ -1094,14 +1094,14 @@ AcpiDmDumpDmar ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDmarHdr); if (ACPI_FAILURE (Status)) { return; @@ -1109,7 +1109,7 @@ AcpiDmDumpDmar ( AcpiOsPrintf ("\n"); - switch (Subtable->Type) + switch (SubTable->Type) { case ACPI_DMAR_TYPE_HARDWARE_UNIT: @@ -1144,12 +1144,12 @@ AcpiDmDumpDmar ( default: AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", - Subtable->Type); + SubTable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1158,16 +1158,16 @@ AcpiDmDumpDmar ( /* * Dump the optional device scope entries */ - if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || - (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE)) + if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || + (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE)) { /* These types do not support device scopes */ goto NextSubtable; } - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset); - while (ScopeOffset < Subtable->Length) + ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); + while (ScopeOffset < SubTable->Length) { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, @@ -1208,9 +1208,9 @@ AcpiDmDumpDmar ( NextSubtable: /* Point to next subtable */ - Offset += Subtable->Length; - Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, - Subtable->Length); + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, + SubTable->Length); } } @@ -1343,7 +1343,7 @@ AcpiDmDumpEinj ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_WHEA_HEADER *Subtable; + ACPI_WHEA_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_EINJ); @@ -1358,11 +1358,11 @@ AcpiDmDumpEinj ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, + Status = AcpiDmDumpTable (Length, Offset, SubTable, sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); if (ACPI_FAILURE (Status)) { @@ -1372,7 +1372,7 @@ AcpiDmDumpEinj ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); - Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, sizeof (ACPI_WHEA_HEADER)); } } @@ -1396,7 +1396,7 @@ AcpiDmDumpErst ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_WHEA_HEADER *Subtable; + ACPI_WHEA_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_ERST); @@ -1411,11 +1411,11 @@ AcpiDmDumpErst ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, + Status = AcpiDmDumpTable (Length, Offset, SubTable, sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); if (ACPI_FAILURE (Status)) { @@ -1425,7 +1425,7 @@ AcpiDmDumpErst ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); - Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, sizeof (ACPI_WHEA_HEADER)); } } @@ -1449,7 +1449,7 @@ AcpiDmDumpFpdt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_FPDT_HEADER *Subtable; + ACPI_FPDT_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_FPDT); ACPI_DMTABLE_INFO *InfoTable; @@ -1459,20 +1459,20 @@ AcpiDmDumpFpdt ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoFpdtHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoFpdtHdr); if (ACPI_FAILURE (Status)) { return; } - switch (Subtable->Type) + switch (SubTable->Type) { case ACPI_FPDT_TYPE_BOOT: @@ -1487,31 +1487,31 @@ AcpiDmDumpFpdt ( default: AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", - Subtable->Type); + SubTable->Type); /* Attempt to continue */ - if (!Subtable->Length) + if (!SubTable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubtable; + goto NextSubTable; } - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; } -NextSubtable: +NextSubTable: /* Point to next subtable */ - Offset += Subtable->Length; - Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, - Subtable->Length); + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, + SubTable->Length); } } @@ -1534,11 +1534,11 @@ AcpiDmDumpGtdt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_GTDT_HEADER *Subtable; + ACPI_GTDT_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_GTDT); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubtableLength; + UINT32 SubTableLength; UINT32 GtCount; ACPI_GTDT_TIMER_ENTRY *GtxTable; @@ -1553,34 +1553,34 @@ AcpiDmDumpGtdt ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoGtdtHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoGtdtHdr); if (ACPI_FAILURE (Status)) { return; } GtCount = 0; - switch (Subtable->Type) + switch (SubTable->Type) { case ACPI_GTDT_TYPE_TIMER_BLOCK: - SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); + SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, - Subtable))->TimerCount; + SubTable))->TimerCount; InfoTable = AcpiDmTableInfoGtdt0; break; case ACPI_GTDT_TYPE_WATCHDOG: - SubtableLength = sizeof (ACPI_GTDT_WATCHDOG); + SubTableLength = sizeof (ACPI_GTDT_WATCHDOG); InfoTable = AcpiDmTableInfoGtdt1; break; @@ -1590,12 +1590,12 @@ AcpiDmDumpGtdt ( /* Cannot continue on unknown type - no length */ AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", - Subtable->Type); + SubTable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1603,15 +1603,15 @@ AcpiDmDumpGtdt ( /* Point to end of current subtable (each subtable above is of fixed length) */ - Offset += SubtableLength; + Offset += SubTableLength; /* If there are any Gt Timer Blocks from above, dump them now */ if (GtCount) { GtxTable = ACPI_ADD_PTR ( - ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength); - SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); + ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength); + SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); while (GtCount) { @@ -1630,7 +1630,7 @@ AcpiDmDumpGtdt ( /* Point to next subtable */ - Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength); + SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength); } } @@ -1653,11 +1653,11 @@ AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_HEST_HEADER *Subtable; + ACPI_HEST_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubtableLength; + UINT32 SubTableLength; UINT32 BankCount; ACPI_HEST_IA_ERROR_BANK *BankTable; @@ -1672,70 +1672,70 @@ AcpiDmDumpHest ( /* Subtables */ - Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) { BankCount = 0; - switch (Subtable->Type) + switch (SubTable->Type) { case ACPI_HEST_TYPE_IA32_CHECK: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Sep 30 21:00:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61DE4E2F3F0; Sat, 30 Sep 2017 21:00:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30338808D6; Sat, 30 Sep 2017 21:00:09 +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 v8UL081C046080; Sat, 30 Sep 2017 21:00:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UL089D046079; Sat, 30 Sep 2017 21:00:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201709302100.v8UL089D046079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 30 Sep 2017 21:00:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324143 - head X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 324143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 21:00:09 -0000 Author: ngie Date: Sat Sep 30 21:00:08 2017 New Revision: 324143 URL: https://svnweb.freebsd.org/changeset/base/324143 Log: Adjust r322633 to only apply to libexec/rtld-elf, and not usr.bin/ldd, when running build32/install32 This unbreaks installing usr.bin/ldd as ldd32 when NO_RTLD is defined. MFC after: 1 week MFC with: r322633 Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Sat Sep 30 20:50:31 2017 (r324142) +++ head/Makefile.libcompat Sat Sep 30 21:00:08 2017 (r324143) @@ -179,10 +179,12 @@ build${libcompat}: .PHONY .endfor ${_+_}cd ${.CURDIR}; \ ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries -.if ${libcompat} == "32" && !defined(NO_RTLD) +.if ${libcompat} == "32" .for _t in ${_obj} all +.if !defined(NO_RTLD) ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} +.endif ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ DIRPRFX=usr.bin/ldd ${_t} .endfor @@ -192,9 +194,11 @@ distribute${libcompat} install${libcompat}: .PHONY .for _dir in ${_LC_LIBDIRS.yes} ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} .endfor -.if ${libcompat} == "32" && !defined(NO_RTLD) +.if ${libcompat} == "32" +.if !defined(NO_RTLD) ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} +.endif ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ ${.TARGET:S/32$//} .endif From owner-svn-src-head@freebsd.org Sat Sep 30 21:00:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC2E5E2F456; Sat, 30 Sep 2017 21:00:47 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B877A80A49; Sat, 30 Sep 2017 21:00:47 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8UL0k43046140; Sat, 30 Sep 2017 21:00:46 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UL0kmr046139; Sat, 30 Sep 2017 21:00:46 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201709302100.v8UL0kmr046139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 30 Sep 2017 21:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324144 - head/sys/dev/usb/wlan X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/sys/dev/usb/wlan X-SVN-Commit-Revision: 324144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 21:00:48 -0000 Author: avos Date: Sat Sep 30 21:00:46 2017 New Revision: 324144 URL: https://svnweb.freebsd.org/changeset/base/324144 Log: uath(4): fix varible types, add missing checks for descriptor / command header structure fields. Reported by: hselasky Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D11786 Modified: head/sys/dev/usb/wlan/if_uath.c Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Sat Sep 30 21:00:08 2017 (r324143) +++ head/sys/dev/usb/wlan/if_uath.c Sat Sep 30 21:00:46 2017 (r324144) @@ -2201,17 +2201,19 @@ uath_sysctl_node(struct uath_softc *sc) #undef UATH_SYSCTL_STAT_ADD32 +CTASSERT(sizeof(u_int) >= sizeof(uint32_t)); + static void uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cmd) { struct uath_cmd_hdr *hdr; - int dlen; + uint32_t dlen; hdr = (struct uath_cmd_hdr *)cmd->buf; /* NB: msgid is passed thru w/o byte swapping */ #ifdef UATH_DEBUG if (sc->sc_debug & UATH_DEBUG_CMDS) { - int len = be32toh(hdr->len); + uint32_t len = be32toh(hdr->len); printf("%s: %s [ix %u] len %u status %u\n", __func__, uath_codename(be32toh(hdr->code)), hdr->msgid, len, be32toh(hdr->magic)); @@ -2227,15 +2229,9 @@ uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cm switch (hdr->code & 0xff) { /* reply to a read command */ default: - dlen = hdr->len - sizeof(*hdr); - if (dlen < 0) { - device_printf(sc->sc_dev, - "Invalid header length %d\n", dlen); - return; - } DPRINTF(sc, UATH_DEBUG_RX_PROC | UATH_DEBUG_RECV_ALL, - "%s: code %d data len %u\n", - __func__, hdr->code & 0xff, dlen); + "%s: code %d hdr len %u\n", + __func__, hdr->code & 0xff, hdr->len); /* * The first response from the target after the * HOST_AVAILABLE has an invalid msgid so we must @@ -2245,8 +2241,8 @@ uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cm uint32_t *rp = (uint32_t *)(hdr+1); u_int olen; - if (!(sizeof(*hdr) <= hdr->len && - hdr->len < UATH_MAX_CMDSZ)) { + if (sizeof(*hdr) > hdr->len || + hdr->len >= UATH_MAX_CMDSZ) { device_printf(sc->sc_dev, "%s: invalid WDC msg length %u; " "msg ignored\n", __func__, hdr->len); @@ -2258,7 +2254,8 @@ uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cm * number of bytes--unless it's 0 in which * case a single 32-bit word should be present. */ - if (dlen >= (int)sizeof(uint32_t)) { + dlen = hdr->len - sizeof(*hdr); + if (dlen >= sizeof(uint32_t)) { olen = be32toh(rp[0]); dlen -= sizeof(uint32_t); if (olen == 0) { @@ -2278,7 +2275,7 @@ uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cm cmd->olen); olen = cmd->olen; } - if (olen > (u_int)dlen) { + if (olen > dlen) { /* XXX complain, shouldn't happen */ device_printf(sc->sc_dev, "%s: cmd 0x%x olen %u dlen %u\n", @@ -2300,8 +2297,10 @@ uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cm return; } dlen = hdr->len - sizeof(*hdr); - if (dlen != (int)sizeof(uint32_t)) { - /* XXX something wrong */ + if (dlen != sizeof(uint32_t)) { + device_printf(sc->sc_dev, + "%s: dlen (%u) != %zu!\n", + __func__, dlen, sizeof(uint32_t)); return; } /* XXX have submitter do this */ @@ -2330,6 +2329,7 @@ uath_intr_rx_callback(struct usb_xfer *xfer, usb_error { struct uath_softc *sc = usbd_xfer_softc(xfer); struct uath_cmd *cmd; + struct uath_cmd_hdr *hdr; struct usb_page_cache *pc; int actlen; @@ -2347,10 +2347,25 @@ uath_intr_rx_callback(struct usb_xfer *xfer, usb_error STAILQ_INSERT_TAIL(&sc->sc_cmd_inactive, cmd, next); UATH_STAT_INC(sc, st_cmd_inactive); - KASSERT(actlen >= (int)sizeof(struct uath_cmd_hdr), - ("short xfer error")); + if (actlen < sizeof(struct uath_cmd_hdr)) { + device_printf(sc->sc_dev, + "%s: short xfer error (actlen %d)\n", + __func__, actlen); + goto setup; + } + pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, cmd->buf, actlen); + + hdr = (struct uath_cmd_hdr *)cmd->buf; + hdr->len = be32toh(hdr->len); + if (hdr->len > (uint32_t)actlen) { + device_printf(sc->sc_dev, + "%s: truncated xfer (len %u, actlen %d)\n", + __func__, hdr->len, actlen); + goto setup; + } + uath_cmdeof(sc, cmd); case USB_ST_SETUP: setup: @@ -2451,6 +2466,8 @@ uath_update_rxstat(struct uath_softc *sc, uint32_t sta } } +CTASSERT(UATH_MIN_RXBUFSZ >= sizeof(struct uath_chunk)); + static struct mbuf * uath_data_rxeof(struct usb_xfer *xfer, struct uath_data *data, struct uath_rx_desc **pdesc) @@ -2473,13 +2490,24 @@ uath_data_rxeof(struct usb_xfer *xfer, struct uath_dat } chunk = (struct uath_chunk *)data->buf; - if (chunk->seqnum == 0 && chunk->flags == 0 && chunk->length == 0) { + chunklen = be16toh(chunk->length); + if (chunk->seqnum == 0 && chunk->flags == 0 && chunklen == 0) { device_printf(sc->sc_dev, "%s: strange response\n", __func__); counter_u64_add(ic->ic_ierrors, 1); UATH_RESET_INTRX(sc); return (NULL); } + if (chunklen > actlen) { + device_printf(sc->sc_dev, + "%s: invalid chunk length (len %u > actlen %d)\n", + __func__, chunklen, actlen); + counter_u64_add(ic->ic_ierrors, 1); + /* XXX cleanup? */ + UATH_RESET_INTRX(sc); + return (NULL); + } + if (chunk->seqnum != sc->sc_intrx_nextnum) { DPRINTF(sc, UATH_DEBUG_XMIT, "invalid seqnum %d, expected %d\n", chunk->seqnum, sc->sc_intrx_nextnum); @@ -2496,9 +2524,19 @@ uath_data_rxeof(struct usb_xfer *xfer, struct uath_dat chunk->flags & UATH_CFLAGS_RXMSG) UATH_STAT_INC(sc, st_multichunk); - chunklen = be16toh(chunk->length); - if (chunk->flags & UATH_CFLAGS_FINAL) + if (chunk->flags & UATH_CFLAGS_FINAL) { + if (chunklen < sizeof(struct uath_rx_desc)) { + device_printf(sc->sc_dev, + "%s: invalid chunk length %d\n", + __func__, chunklen); + counter_u64_add(ic->ic_ierrors, 1); + if (sc->sc_intrx_head != NULL) + m_freem(sc->sc_intrx_head); + UATH_RESET_INTRX(sc); + return (NULL); + } chunklen -= sizeof(struct uath_rx_desc); + } if (chunklen > 0 && (!(chunk->flags & UATH_CFLAGS_FINAL) || !(chunk->seqnum == 0))) { @@ -2559,6 +2597,19 @@ uath_data_rxeof(struct usb_xfer *xfer, struct uath_dat (struct uath_rx_desc *)(((uint8_t *)chunk) + sizeof(struct uath_chunk) + be16toh(chunk->length) - sizeof(struct uath_rx_desc)); + if ((uint8_t *)chunk + actlen - sizeof(struct uath_rx_desc) < + (uint8_t *)desc) { + device_printf(sc->sc_dev, + "%s: wrong Rx descriptor pointer " + "(desc %p chunk %p actlen %d)\n", + __func__, desc, chunk, actlen); + counter_u64_add(ic->ic_ierrors, 1); + if (sc->sc_intrx_head != NULL) + m_freem(sc->sc_intrx_head); + UATH_RESET_INTRX(sc); + return (NULL); + } + *pdesc = desc; DPRINTF(sc, UATH_DEBUG_RECV | UATH_DEBUG_RECV_ALL, @@ -2586,8 +2637,33 @@ uath_data_rxeof(struct usb_xfer *xfer, struct uath_dat /* finalize mbuf */ if (sc->sc_intrx_head == NULL) { - m->m_pkthdr.len = m->m_len = - be32toh(desc->framelen) - UATH_RX_DUMMYSIZE; + uint32_t framelen; + + if (be32toh(desc->framelen) < UATH_RX_DUMMYSIZE) { + device_printf(sc->sc_dev, + "%s: framelen too small (%u)\n", + __func__, be32toh(desc->framelen)); + counter_u64_add(ic->ic_ierrors, 1); + if (sc->sc_intrx_head != NULL) + m_freem(sc->sc_intrx_head); + UATH_RESET_INTRX(sc); + return (NULL); + } + + framelen = be32toh(desc->framelen) - UATH_RX_DUMMYSIZE; + if (framelen > actlen - sizeof(struct uath_chunk) || + framelen < sizeof(struct ieee80211_frame_ack)) { + device_printf(sc->sc_dev, + "%s: wrong frame length (%u, actlen %d)!\n", + __func__, framelen, actlen); + counter_u64_add(ic->ic_ierrors, 1); + if (sc->sc_intrx_head != NULL) + m_freem(sc->sc_intrx_head); + UATH_RESET_INTRX(sc); + return (NULL); + } + + m->m_pkthdr.len = m->m_len = framelen; m->m_data += sizeof(struct uath_chunk); } else { mp = sc->sc_intrx_head; From owner-svn-src-head@freebsd.org Sat Sep 30 23:41:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E84EE31A79; Sat, 30 Sep 2017 23:41:29 +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 1E28E8486E; Sat, 30 Sep 2017 23:41:29 +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 v8UNfSDG014426; Sat, 30 Sep 2017 23:41:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8UNfSYc014425; Sat, 30 Sep 2017 23:41:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709302341.v8UNfSYc014425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 30 Sep 2017 23:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324146 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 30 Sep 2017 23:41:29 -0000 Author: markj Date: Sat Sep 30 23:41:28 2017 New Revision: 324146 URL: https://svnweb.freebsd.org/changeset/base/324146 Log: Have uiomove_object_page() keep accessed pages in the active queue. Previously, uiomove_object_page() would maintain LRU by requeuing the accessed page. This involves acquiring one of the heavily contended page queue locks. Moreover, it is unnecessarily expensive for pages in the active queue. As of r254304 the page daemon continually performs a slow scan of the active queue, with the effect that unreferenced pages are gradually moved to the inactive queue, from which they can be reclaimed. Prior to that revision, the active queue was scanned only during shortages of free and inactive pages, meaning that unreferenced pages could get "stuck" in the queue. Thus, tmpfs was required to use the inactive queue and requeue pages in order to maintain LRU. Now that this is no longer the case, tmpfs I/O operations can use the active queue and avoid the page queue locks in most cases, instead setting PGA_REFERENCED on referenced pages to provide pseudo-LRU. Reviewed by: alc (previous version) MFC after: 2 weeks Modified: head/sys/kern/uipc_shm.c Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Sat Sep 30 23:33:19 2017 (r324145) +++ head/sys/kern/uipc_shm.c Sat Sep 30 23:41:28 2017 (r324146) @@ -209,12 +209,10 @@ uiomove_object_page(vm_object_t obj, size_t len, struc } vm_page_lock(m); vm_page_hold(m); - if (m->queue == PQ_NONE) { - vm_page_deactivate(m); - } else { - /* Requeue to maintain LRU ordering. */ - vm_page_requeue(m); - } + if (m->queue != PQ_ACTIVE) + vm_page_activate(m); + else + vm_page_reference(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); error = uiomove_fromphys(&m, offset, tlen, uio);