From owner-svn-src-all@freebsd.org Sun Sep 10 00:32:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE981E14A37; Sun, 10 Sep 2017 00:32:04 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22f.google.com (mail-pf0-x22f.google.com [IPv6:2607:f8b0:400e:c00::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B08834FE; Sun, 10 Sep 2017 00:32:04 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22f.google.com with SMTP id e199so9301179pfh.3; Sat, 09 Sep 2017 17:32:04 -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=LXaqfvDaRXhkcqttnvvsxqMmv5yycPg9Rm6EDPk5GPg=; b=hc9Cwf9zgs4rVZ+ir9clI3Q5UwkWQ7XUKjy+vKVqnfbWI8rBnQex3tR8NgrUS5sPWT yYnPTjk7Iko0X3Lo7mFWT5mlo03r5ndG3rO3ZUlBhI83RExlcXLRNEgdES5zZnoN44jm N9KwbdtKmhF3NBiWUpQE3tJxCFhjrJi9SsieM3E1tJ+Z0/deY4JU81LEEU5xcwmlMEZe RwrGXE3YPz5oCD76yg2XOS253C6t6lFvzMIo0WAVoEjMECe4BefaWs9yUsUKakPc01KZ JmxY95h16pR9MB0qmCQcbz2bj2+KR7/R8xZBkg5YnfBuNGVN1QvcVyFAtXkn+kWjtL4x 2dEg== 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=LXaqfvDaRXhkcqttnvvsxqMmv5yycPg9Rm6EDPk5GPg=; b=HoAXtHa7O/tJnTlwzALPKqUEzgRp3AQjhjy7+JfDFm/FF+T6tya7wYZsIY0VBU/sK2 Zr3KQ6DPVDUH+QSqAgD3yJ6p+cuvRlgXXQFKu0nPmjPL67FvsquC5g/q5fIMJ8ijRp8w +42zf7jaCX2P121A3naOzlGiasgtXoUUttauORMGHufmQ6LqJMhFBVIft6T7FZmEC44V wZ812lrJd6Tdow1nUiwqWXqJ7KWGphh0uJqFfv9IMECfEmkyX51x5jF2QG4RFSTOw0jn 7tojnH8lLiVPmtdM570xItfYdQ6JOZqjFW1SC0YMaWUTFOXcvy1Ue8ATEzk1UNc4aHaO hgZA== X-Gm-Message-State: AHPjjUjn8Uy0kluOqOA4V8P0vB2lNLs1/UFi3bJb70aivJGgPIgcIUgH dzNiCFh97oVZ/w== X-Google-Smtp-Source: ADKCNb4sB8DZ8oQlDCP2Kd47HqLfVEHR9G9Z3tkpHE7e09tldn5/NfNl8VRBmbVEgA6tSbWwCJ+9zA== X-Received: by 10.98.211.200 with SMTP id z69mr7324531pfk.112.1505003524222; Sat, 09 Sep 2017 17:32:04 -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 u186sm8257358pgb.35.2017.09.09.17.32.03 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 09 Sep 2017 17:32:03 -0700 (PDT) Subject: Re: svn commit: r323365 - in head: cddl/lib/libzpool gnu/usr.bin/binutils/libbfd usr.bin/svn/lib/libsvn_client Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_2ED10681-3C76-492B-A201-F8692AEF6804"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <20170909215100.GX1700@kib.kiev.ua> Date: Sat, 9 Sep 2017 17:32:01 -0700 Cc: Jonathan Anderson , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201709091318.v89DIXDj027788@repo.freebsd.org> <20170909183518.GV1700@kib.kiev.ua> <23674A3F-E627-4873-8BB6-4F5ADD7E3EA7@gmail.com> <20170909215100.GX1700@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 00:32:05 -0000 --Apple-Mail=_2ED10681-3C76-492B-A201-F8692AEF6804 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 9, 2017, at 14:51, Konstantin Belousov = wrote: =E2=80=A6 > Then, why peigen.c was left in the SRCS ? I=E2=80=99m not sure, but you might have thought peigen.c and pepigen.c = were the same file. If so, they=E2=80=99re not =E2=80=94 they have = slightly different spelling. HTH, -Ngie --Apple-Mail=_2ED10681-3C76-492B-A201-F8692AEF6804 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 iQIcBAEBCgAGBQJZtIgCAAoJEPWDqSZpMIYVHCwP/jg1V4SY7xFLW+II1G3pPEFy 7LwQ3+d43yGVNewENeRs6zgSD60gwKKtEnBRIIxEIsWrbKOGpMPXCeGz1S2vzoBO CHyWODs8QJCVozWoGlQdGWPw1YrOCuwIHalx3xxiJmuDT+XvQgLYam5J9JklmnSd qfXDl/MjB6ezZ40LspqO4un5w81DbgLU8bgmjwgqtTwaAVt+zGxUzyxuDJ0tuX8B JcbaTbXSc8NRPd6u58Y9QQ5o4chpp2siIndP5o4PgviPYcGvdkXervFxCLXD2ojE /MezQbemIv6NXzN+BVsD8BXyaMK1prWRaIWfRH5gzniNCNlSg1pB/CTMcGeu45U6 a/1NNKg6pz+jA9tZzg5G82lF4Ee7HHAgizwJ55iU8pWr+BkOXd+cyQsQ9fhzoZOp LAJIoNDLWTBO202MUXSWtpoEL62pDJFnoUToKtCTYQImGfx/yGZgTRgIxAZoNlR4 THf4WK3T1uXYVMO1XuKJOckBDmFyGxiZjzj2nBuA/3mwmZcA4te8mfvkKIZnlAyb huh4C6RC7SsaI2YMHLI93BBd4jUlJr3bT5uBhnwYLfq0LenKP3xJTzHmnybUgzdK /1B9UB5Ms4YZpPEVHUhvrCiVfWqG4Goe6C38BEKI+BDeawRVmPtGLEPlPVxHCJi2 79IRNTSplASzurdwYq7d =E7kF -----END PGP SIGNATURE----- --Apple-Mail=_2ED10681-3C76-492B-A201-F8692AEF6804-- From owner-svn-src-all@freebsd.org Sun Sep 10 00:56:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DAADE15AEA; Sun, 10 Sep 2017 00:56:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC30083E25; Sun, 10 Sep 2017 00:56:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8A0uTsO013584; Sun, 10 Sep 2017 00:56:29 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8A0uShH013582; Sun, 10 Sep 2017 00:56:28 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709100056.v8A0uShH013582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 10 Sep 2017 00:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323381 - vendor/zlib/dist X-SVN-Group: vendor X-SVN-Commit-Author: marius X-SVN-Commit-Paths: vendor/zlib/dist X-SVN-Commit-Revision: 323381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 00:56:30 -0000 Author: marius Date: Sun Sep 10 00:56:28 2017 New Revision: 323381 URL: https://svnweb.freebsd.org/changeset/base/323381 Log: Permit a deflateParams() parameter change as soon as possible. This commit allows a parameter change even if the input data has not all been compressed and copied to the application output buffer, so long as all of the input data has been compressed to the internal pending output buffer. This also allows an immediate deflateParams change so long as there have been no deflate calls since initialization or reset. Obtained from: upstream (f9694097dd69354b03cb8af959094c7f260db0a1) Modified: vendor/zlib/dist/deflate.c vendor/zlib/dist/zlib.h Modified: vendor/zlib/dist/deflate.c ============================================================================== --- vendor/zlib/dist/deflate.c Sat Sep 9 22:02:36 2017 (r323380) +++ vendor/zlib/dist/deflate.c Sun Sep 10 00:56:28 2017 (r323381) @@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm) s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); @@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { Modified: vendor/zlib/dist/zlib.h ============================================================================== --- vendor/zlib/dist/zlib.h Sat Sep 9 22:02:36 2017 (r323380) +++ vendor/zlib/dist/zlib.h Sun Sep 10 00:56:28 2017 (r323381) @@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not From owner-svn-src-all@freebsd.org Sun Sep 10 01:25:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F766E17582; Sun, 10 Sep 2017 01:25:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF86DF68; Sun, 10 Sep 2017 01:25:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8A1PG1F025726; Sun, 10 Sep 2017 01:25:16 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8A1PG0x025724; Sun, 10 Sep 2017 01:25:16 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709100125.v8A1PG0x025724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 10 Sep 2017 01:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323382 - head/contrib/zlib X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/contrib/zlib X-SVN-Commit-Revision: 323382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 01:25:17 -0000 Author: marius Date: Sun Sep 10 01:25:15 2017 New Revision: 323382 URL: https://svnweb.freebsd.org/changeset/base/323382 Log: MFV: r323381 Permit a deflateParams() parameter change as soon as possible. This change fixes compression errors seen when the embedded Tomcat web server of a UniFi Controller zlib compresses responses. Given that Tomcat just uses Java/OpenJDK which in turn employs zlib for its compression/decompression support, this bug might very well affect other applications, too. PR: 222136 Modified: head/contrib/zlib/deflate.c head/contrib/zlib/zlib.h Directory Properties: head/contrib/zlib/ (props changed) Modified: head/contrib/zlib/deflate.c ============================================================================== --- head/contrib/zlib/deflate.c Sun Sep 10 00:56:28 2017 (r323381) +++ head/contrib/zlib/deflate.c Sun Sep 10 01:25:15 2017 (r323382) @@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm) s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); @@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { Modified: head/contrib/zlib/zlib.h ============================================================================== --- head/contrib/zlib/zlib.h Sun Sep 10 00:56:28 2017 (r323381) +++ head/contrib/zlib/zlib.h Sun Sep 10 01:25:15 2017 (r323382) @@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not From owner-svn-src-all@freebsd.org Sun Sep 10 04:09:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1E17E1F4AB; Sun, 10 Sep 2017 04:09:19 +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 CC2EE6471E; Sun, 10 Sep 2017 04:09:19 +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 v8A49Jl8091371; Sun, 10 Sep 2017 04:09:19 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8A49ITh091369; Sun, 10 Sep 2017 04:09:18 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709100409.v8A49ITh091369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 10 Sep 2017 04:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323383 - 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: 323383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 04:09:20 -0000 Author: scottl Date: Sun Sep 10 04:09:18 2017 New Revision: 323383 URL: https://svnweb.freebsd.org/changeset/base/323383 Log: More code refactoring in preparation for enabling multiqueue. 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 Sun Sep 10 01:25:15 2017 (r323382) +++ head/sys/dev/mpr/mpr.c Sun Sep 10 04:09:18 2017 (r323383) @@ -89,6 +89,7 @@ static void mpr_iocfacts_free(struct mpr_softc *sc); static void mpr_startup(void *arg); static int mpr_send_iocinit(struct mpr_softc *sc); static int mpr_alloc_queues(struct mpr_softc *sc); +static int mpr_alloc_hw_queues(struct mpr_softc *sc); static int mpr_alloc_replies(struct mpr_softc *sc); static int mpr_alloc_requests(struct mpr_softc *sc); static int mpr_alloc_nvme_prp_pages(struct mpr_softc *sc); @@ -565,22 +566,24 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at * IOC Facts are different from the previous IOC Facts after a Diag * Reset. Targets have already been allocated above if needed. */ - if (attaching || reallocating) { - if (((error = mpr_alloc_queues(sc)) != 0) || - ((error = mpr_alloc_replies(sc)) != 0) || - ((error = mpr_alloc_requests(sc)) != 0)) { - if (attaching ) { - mpr_dprint(sc, MPR_INIT|MPR_ERROR, - "Failed to alloc queues with error %d\n", - error); - mpr_free(sc); - return (error); - } else { - panic("%s failed to alloc queues with error " - "%d\n", __func__, error); - } - } + error = 0; + while (attaching || reallocating) { + if ((error = mpr_alloc_hw_queues(sc)) != 0) + break; + if ((error = mpr_alloc_replies(sc)) != 0) + break; + if ((error = mpr_alloc_requests(sc)) != 0) + break; + if ((error = mpr_alloc_queues(sc)) != 0) + break; + break; } + if (error) { + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Failed to alloc queues with error %d\n", error); + mpr_free(sc); + return (error); + } /* Always initialize the queues */ bzero(sc->free_queue, sc->fqdepth * 4); @@ -593,15 +596,10 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at */ error = mpr_transition_operational(sc); if (error != 0) { - if (attaching) { - mpr_dprint(sc, MPR_INIT|MPR_FAULT, "Failed to " - "transition to operational with error %d\n", error); - mpr_free(sc); - return (error); - } else { - panic("%s failed to transition to operational with " - "error %d\n", __func__, error); - } + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "Failed to " + "transition to operational with error %d\n", error); + mpr_free(sc); + return (error); } /* @@ -620,26 +618,31 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at /* * Attach the subsystems so they can prepare their event masks. + * XXX Should be dynamic so that IM/IR and user modules can attach */ - /* XXX Should be dynamic so that IM/IR and user modules can attach */ - if (attaching) { + error = 0; + while (attaching) { mpr_dprint(sc, MPR_INIT, "Attaching subsystems\n"); - if (((error = mpr_attach_log(sc)) != 0) || - ((error = mpr_attach_sas(sc)) != 0) || - ((error = mpr_attach_user(sc)) != 0)) { - mpr_dprint(sc, MPR_INIT|MPR_ERROR, - "Failed to attach all subsystems: error %d\n", - error); - mpr_free(sc); - return (error); - } + if ((error = mpr_attach_log(sc)) != 0) + break; + if ((error = mpr_attach_sas(sc)) != 0) + break; + if ((error = mpr_attach_user(sc)) != 0) + break; + break; + } + if (error) { + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Failed to attach all subsystems: error %d\n", error); + mpr_free(sc); + return (error); + } - if ((error = mpr_pci_setup_interrupts(sc)) != 0) { - mpr_dprint(sc, MPR_INIT|MPR_ERROR, - "Failed to setup interrupts\n"); - mpr_free(sc); - return (error); - } + if ((error = mpr_pci_setup_interrupts(sc)) != 0) { + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Failed to setup interrupts\n"); + mpr_free(sc); + return (error); } return (error); @@ -1140,10 +1143,8 @@ mpr_memaddr_cb(void *arg, bus_dma_segment_t *segs, int static int mpr_alloc_queues(struct mpr_softc *sc) { - bus_addr_t queues_busaddr; struct mpr_queue *q; - uint8_t *queues; - int qsize, fqsize, pqsize, nq, i; + int nq, i; nq = MIN(sc->msi_msgs, mp_ncpus); sc->msi_msgs = nq; @@ -1159,6 +1160,15 @@ mpr_alloc_queues(struct mpr_softc *sc) q->sc = sc; q->qnum = i; } + return (0); +} + +static int +mpr_alloc_hw_queues(struct mpr_softc *sc) +{ + bus_addr_t queues_busaddr; + uint8_t *queues; + int qsize, fqsize, pqsize; /* * The reply free queue contains 4 byte entries in multiples of 16 and Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sun Sep 10 01:25:15 2017 (r323382) +++ head/sys/dev/mps/mps.c Sun Sep 10 04:09:18 2017 (r323383) @@ -87,6 +87,7 @@ static void mps_iocfacts_free(struct mps_softc *sc); static void mps_startup(void *arg); static int mps_send_iocinit(struct mps_softc *sc); static int mps_alloc_queues(struct mps_softc *sc); +static int mps_alloc_hw_queues(struct mps_softc *sc); static int mps_alloc_replies(struct mps_softc *sc); static int mps_alloc_requests(struct mps_softc *sc); static int mps_attach_log(struct mps_softc *sc); @@ -552,22 +553,25 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at * IOC Facts are different from the previous IOC Facts after a Diag * Reset. Targets have already been allocated above if needed. */ - if (attaching || reallocating) { - if (((error = mps_alloc_queues(sc)) != 0) || - ((error = mps_alloc_replies(sc)) != 0) || - ((error = mps_alloc_requests(sc)) != 0)) { - if (attaching ) { - mps_dprint(sc, MPS_INIT|MPS_FAULT, - "Failed to alloc queues with error %d\n", - error); - mps_free(sc); - return (error); - } else { - panic("%s failed to alloc queues with error " - "%d\n", __func__, error); - } - } + error = 0; + while (attaching || reallocating) { + if ((error = mps_alloc_hw_queues(sc)) != 0) + break; + if ((error = mps_alloc_replies(sc)) != 0) + break; + if ((error = mps_alloc_requests(sc)) != 0) + break; + if ((error = mps_alloc_queues(sc)) != 0) + break; + + break; } + if (error) { + mps_dprint(sc, MPS_INIT|MPS_FAULT, + "Failed to alloc queues with error %d\n", error); + mps_free(sc); + return (error); + } /* Always initialize the queues */ bzero(sc->free_queue, sc->fqdepth * 4); @@ -580,15 +584,10 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at */ error = mps_transition_operational(sc); if (error != 0) { - if (attaching) { - mps_dprint(sc, MPS_INIT|MPS_FAULT, "Failed to " - "transition to operational with error %d\n", error); - mps_free(sc); - return (error); - } else { - panic("%s failed to transition to operational with " - "error %d\n", __func__, error); - } + mps_dprint(sc, MPS_INIT|MPS_FAULT, "Failed to " + "transition to operational with error %d\n", error); + mps_free(sc); + return (error); } /* @@ -607,25 +606,31 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at /* * Attach the subsystems so they can prepare their event masks. + * XXX Should be dynamic so that IM/IR and user modules can attach */ - /* XXX Should be dynamic so that IM/IR and user modules can attach */ - if (attaching) { + error = 0; + while (attaching) { mps_dprint(sc, MPS_INIT, "Attaching subsystems\n"); - if (((error = mps_attach_log(sc)) != 0) || - ((error = mps_attach_sas(sc)) != 0) || - ((error = mps_attach_user(sc)) != 0)) { - mps_dprint(sc, MPS_INIT|MPS_FAULT,"Failed to attach " - "all subsystems: error %d\n", error); - mps_free(sc); - return (error); - } + if ((error = mps_attach_log(sc)) != 0) + break; + if ((error = mps_attach_sas(sc)) != 0) + break; + if ((error = mps_attach_user(sc)) != 0) + break; + break; + } + if (error) { + mps_dprint(sc, MPS_INIT|MPS_FAULT, "Failed to attach all " + "subsystems: error %d\n", error); + mps_free(sc); + return (error); + } - if ((error = mps_pci_setup_interrupts(sc)) != 0) { - mps_dprint(sc, MPS_INIT|MPS_FAULT, "Failed to setup " - "interrupts\n"); - mps_free(sc); - return (error); - } + if ((error = mps_pci_setup_interrupts(sc)) != 0) { + mps_dprint(sc, MPS_INIT|MPS_FAULT, "Failed to setup " + "interrupts\n"); + mps_free(sc); + return (error); } /* @@ -1113,10 +1118,8 @@ mps_memaddr_cb(void *arg, bus_dma_segment_t *segs, int static int mps_alloc_queues(struct mps_softc *sc) { - bus_addr_t queues_busaddr; struct mps_queue *q; - uint8_t *queues; - int qsize, fqsize, pqsize, nq, i; + int nq, i; nq = MIN(sc->msi_msgs, mp_ncpus); sc->msi_msgs = nq; @@ -1132,6 +1135,16 @@ mps_alloc_queues(struct mps_softc *sc) q->sc = sc; q->qnum = i; } + + return (0); +} + +static int +mps_alloc_hw_queues(struct mps_softc *sc) +{ + bus_addr_t queues_busaddr; + uint8_t *queues; + int qsize, fqsize, pqsize; /* * The reply free queue contains 4 byte entries in multiples of 16 and From owner-svn-src-all@freebsd.org Sun Sep 10 07:10:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ABE2E016BB; Sun, 10 Sep 2017 07:10:41 +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 5773F68580; Sun, 10 Sep 2017 07:10:41 +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 v8A7AeXr064338; Sun, 10 Sep 2017 07:10:40 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8A7Ae8e064334; Sun, 10 Sep 2017 07:10:40 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709100710.v8A7Ae8e064334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 10 Sep 2017 07:10:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323384 - 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: 323384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 07:10:41 -0000 Author: scottl Date: Sun Sep 10 07:10:40 2017 New Revision: 323384 URL: https://svnweb.freebsd.org/changeset/base/323384 Log: Fix intrhook release in MPR and MPS for EARLY_AP_STARTUP. Reported by: Limelight Sponsored by: Netflix Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Sun Sep 10 04:09:18 2017 (r323383) +++ head/sys/dev/mpr/mpr.c Sun Sep 10 07:10:40 2017 (r323384) @@ -1816,6 +1816,11 @@ mpr_startup(void *arg) mpr_mapping_initialize(sc); mprsas_startup(sc); mpr_unlock(sc); + + mpr_dprint(sc, MPR_INIT, "disestablish config intrhook\n"); + config_intrhook_disestablish(&sc->mpr_ich); + sc->mpr_ich.ich_arg = NULL; + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); } Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Sun Sep 10 04:09:18 2017 (r323383) +++ head/sys/dev/mpr/mpr_sas.c Sun Sep 10 07:10:40 2017 (r323384) @@ -3829,12 +3829,6 @@ mprsas_portenable_complete(struct mpr_softc *sc, struc mpr_dprint(sc, MPR_FAULT, "Portenable failed\n"); mpr_free_command(sc, cm); - if (sc->mpr_ich.ich_arg != NULL) { - mpr_dprint(sc, MPR_XINFO, "disestablish config intrhook\n"); - config_intrhook_disestablish(&sc->mpr_ich); - sc->mpr_ich.ich_arg = NULL; - } - /* * Done waiting for port enable to complete. Decrement the refcount. * If refcount is 0, discovery is complete and a rescan of the bus can Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sun Sep 10 04:09:18 2017 (r323383) +++ head/sys/dev/mps/mps.c Sun Sep 10 07:10:40 2017 (r323384) @@ -1673,6 +1673,11 @@ mps_startup(void *arg) mps_mapping_initialize(sc); mpssas_startup(sc); mps_unlock(sc); + + mps_dprint(sc, MPS_INIT, "disestablish config intrhook\n"); + config_intrhook_disestablish(&sc->mps_ich); + sc->mps_ich.ich_arg = NULL; + mps_dprint(sc, MPS_INIT, "%s exit\n", __func__); } Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Sun Sep 10 04:09:18 2017 (r323383) +++ head/sys/dev/mps/mps_sas.c Sun Sep 10 07:10:40 2017 (r323384) @@ -3557,11 +3557,6 @@ mpssas_portenable_complete(struct mps_softc *sc, struc mps_dprint(sc, MPS_FAULT, "Portenable failed\n"); mps_free_command(sc, cm); - if (sc->mps_ich.ich_arg != NULL) { - mps_dprint(sc, MPS_XINFO, "disestablish config intrhook\n"); - config_intrhook_disestablish(&sc->mps_ich); - sc->mps_ich.ich_arg = NULL; - } /* * Get WarpDrive info after discovery is complete but before the scan From owner-svn-src-all@freebsd.org Sun Sep 10 11:17:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E1C5E0AE45; Sun, 10 Sep 2017 11:17:33 +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 59BA06F2B2; Sun, 10 Sep 2017 11:17:33 +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 v8ABHW4P067214; Sun, 10 Sep 2017 11:17:32 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ABHWDN067213; Sun, 10 Sep 2017 11:17:32 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709101117.v8ABHWDN067213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 10 Sep 2017 11:17:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323385 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 11:17:33 -0000 Author: mjg Date: Sun Sep 10 11:17:32 2017 New Revision: 323385 URL: https://svnweb.freebsd.org/changeset/base/323385 Log: namecache: clean up struct namecache_ts handling namecache_ts differs from mere namecache by few fields placed mid struct. The access to the last element (the name) is thus special-cased. The standard solution is to put new fields at the very beginning anad embedd the original struct. The pointer shuffled around points to the embedded part. If needed, access to new fields can be gained through __containerof. MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 10 07:10:40 2017 (r323384) +++ head/sys/kern/vfs_cache.c Sun Sep 10 11:17:32 2017 (r323385) @@ -117,20 +117,10 @@ struct namecache { * parent. */ struct namecache_ts { - LIST_ENTRY(namecache) nc_hash; /* hash chain */ - LIST_ENTRY(namecache) nc_src; /* source vnode list */ - TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ - struct vnode *nc_dvp; /* vnode of parent of name */ - union { - struct vnode *nu_vp; /* vnode the name refers to */ - u_int nu_neghits; /* negative entry hits */ - } n_un; - u_char nc_flag; /* flag bits */ - u_char nc_nlen; /* length of name */ struct timespec nc_time; /* timespec provided by fs */ struct timespec nc_dotdottime; /* dotdot timespec provided by fs */ int nc_ticks; /* ticks value when entry was added */ - char nc_name[0]; /* segment name + nul */ + struct namecache nc_nc; }; #define nc_vp n_un.nu_vp @@ -281,63 +271,64 @@ static uma_zone_t __read_mostly cache_zone_large_ts; static struct namecache * cache_alloc(int len, int ts) { + struct namecache_ts *ncp_ts; + struct namecache *ncp; - if (len > CACHE_PATH_CUTOFF) { - if (ts) - return (uma_zalloc(cache_zone_large_ts, M_WAITOK)); + if (__predict_false(ts)) { + if (len <= CACHE_PATH_CUTOFF) + ncp_ts = uma_zalloc(cache_zone_small_ts, M_WAITOK); else - return (uma_zalloc(cache_zone_large, M_WAITOK)); + ncp_ts = uma_zalloc(cache_zone_large_ts, M_WAITOK); + ncp = &ncp_ts->nc_nc; + } else { + if (len <= CACHE_PATH_CUTOFF) + ncp = uma_zalloc(cache_zone_small, M_WAITOK); + else + ncp = uma_zalloc(cache_zone_large, M_WAITOK); } - if (ts) - return (uma_zalloc(cache_zone_small_ts, M_WAITOK)); - else - return (uma_zalloc(cache_zone_small, M_WAITOK)); + return (ncp); } static void cache_free(struct namecache *ncp) { - int ts; + struct namecache_ts *ncp_ts; if (ncp == NULL) return; - ts = ncp->nc_flag & NCF_TS; if ((ncp->nc_flag & NCF_DVDROP) != 0) vdrop(ncp->nc_dvp); - if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { - if (ts) - uma_zfree(cache_zone_small_ts, ncp); + if (__predict_false(ncp->nc_flag & NCF_TS)) { + ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) + uma_zfree(cache_zone_small_ts, ncp_ts); else + uma_zfree(cache_zone_large_ts, ncp_ts); + } else { + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) uma_zfree(cache_zone_small, ncp); - } else if (ts) - uma_zfree(cache_zone_large_ts, ncp); - else - uma_zfree(cache_zone_large, ncp); + else + uma_zfree(cache_zone_large, ncp); + } } -static char * -nc_get_name(struct namecache *ncp) -{ - struct namecache_ts *ncp_ts; - - if ((ncp->nc_flag & NCF_TS) == 0) - return (ncp->nc_name); - ncp_ts = (struct namecache_ts *)ncp; - return (ncp_ts->nc_name); -} - static void cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp) { + struct namecache_ts *ncp_ts; KASSERT((ncp->nc_flag & NCF_TS) != 0 || (tsp == NULL && ticksp == NULL), ("No NCF_TS")); + if (tsp == NULL && ticksp == NULL) + return; + + ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); if (tsp != NULL) - *tsp = ((struct namecache_ts *)ncp)->nc_time; + *tsp = ncp_ts->nc_time; if (ticksp != NULL) - *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; + *ticksp = ncp_ts->nc_ticks; } static int __read_mostly doingcache = 1; /* 1 => enable the cache */ @@ -437,7 +428,7 @@ NCP2BUCKETLOCK(struct namecache *ncp) { uint32_t hash; - hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, ncp->nc_dvp); + hash = cache_get_hash(ncp->nc_name, ncp->nc_nlen, ncp->nc_dvp); return (HASH2BUCKETLOCK(hash)); } @@ -823,7 +814,7 @@ cache_negative_zap_one(void) goto out_unlock_all; } SDT_PROBE3(vfs, namecache, shrink_negative, done, ncp->nc_dvp, - nc_get_name(ncp), ncp->nc_neghits); + ncp->nc_name, ncp->nc_neghits); cache_zap_locked(ncp, true); out_unlock_all: @@ -854,10 +845,10 @@ cache_zap_locked(struct namecache *ncp, bool neg_locke (ncp->nc_flag & NCF_NEGATIVE) ? NULL : ncp->nc_vp); if (!(ncp->nc_flag & NCF_NEGATIVE)) { SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, - nc_get_name(ncp), ncp->nc_vp); + ncp->nc_name, ncp->nc_vp); } else { SDT_PROBE3(vfs, namecache, zap_negative, done, ncp->nc_dvp, - nc_get_name(ncp), ncp->nc_neghits); + ncp->nc_name, ncp->nc_neghits); } LIST_REMOVE(ncp, nc_hash); if (!(ncp->nc_flag & NCF_NEGATIVE)) { @@ -1130,6 +1121,7 @@ int cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp) { + struct namecache_ts *ncp_ts; struct namecache *ncp; struct rwlock *blp; struct mtx *dvlp, *dvlp2; @@ -1197,9 +1189,10 @@ retry_dotdot: *vpp); cache_out_ts(ncp, tsp, ticksp); if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == - NCF_DTS && tsp != NULL) - *tsp = ((struct namecache_ts *)ncp)-> - nc_dotdottime; + NCF_DTS && tsp != NULL) { + ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); + *tsp = ncp_ts->nc_dotdottime; + } goto success; } } @@ -1211,7 +1204,7 @@ retry_dotdot: LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { counter_u64_add(numchecks, 1); if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && - !bcmp(nc_get_name(ncp), cnp->cn_nameptr, ncp->nc_nlen)) + !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) break; } @@ -1240,7 +1233,7 @@ retry_dotdot: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE3(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ncp->nc_name, *vpp); cache_out_ts(ncp, tsp, ticksp); goto success; @@ -1258,7 +1251,7 @@ negative_success: if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, - nc_get_name(ncp)); + ncp->nc_name); cache_out_ts(ncp, tsp, ticksp); cache_lookup_unlock(blp, dvlp); return (ENOENT); @@ -1531,7 +1524,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, { struct celockstate cel; struct namecache *ncp, *n2, *ndd; - struct namecache_ts *n3; + struct namecache_ts *ncp_ts, *n2_ts; struct nchashhead *ncpp; struct neglist *neglist; uint32_t hash; @@ -1622,18 +1615,18 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, ncp->nc_flag |= NCF_NEGATIVE; ncp->nc_dvp = dvp; if (tsp != NULL) { - n3 = (struct namecache_ts *)ncp; - n3->nc_time = *tsp; - n3->nc_ticks = ticks; - n3->nc_flag |= NCF_TS; + ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); + ncp_ts->nc_time = *tsp; + ncp_ts->nc_ticks = ticks; + ncp_ts->nc_nc.nc_flag |= NCF_TS; if (dtsp != NULL) { - n3->nc_dotdottime = *dtsp; - n3->nc_flag |= NCF_DTS; + ncp_ts->nc_dotdottime = *dtsp; + ncp_ts->nc_nc.nc_flag |= NCF_DTS; } } len = ncp->nc_nlen = cnp->cn_namelen; hash = cache_get_hash(cnp->cn_nameptr, len, dvp); - strlcpy(nc_get_name(ncp), cnp->cn_nameptr, len + 1); + strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); cache_enter_lock(&cel, dvp, vp, hash); /* @@ -1645,22 +1638,18 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, LIST_FOREACH(n2, ncpp, nc_hash) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && - !bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) { + !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { if (tsp != NULL) { KASSERT((n2->nc_flag & NCF_TS) != 0, ("no NCF_TS")); - n3 = (struct namecache_ts *)n2; - n3->nc_time = - ((struct namecache_ts *)ncp)->nc_time; - n3->nc_ticks = - ((struct namecache_ts *)ncp)->nc_ticks; + n2_ts = __containerof(n2, struct namecache_ts, nc_nc); + n2_ts->nc_time = ncp_ts->nc_time; + n2_ts->nc_ticks = ncp_ts->nc_ticks; if (dtsp != NULL) { - n3->nc_dotdottime = - ((struct namecache_ts *)ncp)-> - nc_dotdottime; + n2_ts->nc_dotdottime = ncp_ts->nc_dotdottime; if (ncp->nc_flag & NCF_NEGATIVE) mtx_lock(&ncneg_hot.nl_lock); - n3->nc_flag |= NCF_DTS; + n2_ts->nc_nc.nc_flag |= NCF_DTS; if (ncp->nc_flag & NCF_NEGATIVE) mtx_unlock(&ncneg_hot.nl_lock); } @@ -1724,14 +1713,14 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, */ if (vp != NULL) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE3(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + SDT_PROBE3(vfs, namecache, enter, done, dvp, ncp->nc_name, vp); } else { if (cnp->cn_flags & ISWHITEOUT) ncp->nc_flag |= NCF_WHITE; cache_negative_insert(ncp, false); SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, - nc_get_name(ncp)); + ncp->nc_name); } cache_enter_unlock(&cel); if (numneg * ncnegfactor > numcache) @@ -1853,7 +1842,7 @@ cache_changesize(int newmaxvnodes) nchash = new_nchash; for (i = 0; i <= old_nchash; i++) { while ((ncp = LIST_FIRST(&old_nchashtbl[i])) != NULL) { - hash = cache_get_hash(nc_get_name(ncp), ncp->nc_nlen, + hash = cache_get_hash(ncp->nc_name, ncp->nc_nlen, ncp->nc_dvp); LIST_REMOVE(ncp, nc_hash); LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); @@ -2180,9 +2169,9 @@ vn_vptocnp(struct vnode **vp, struct ucred *cred, char return (error); } *buflen -= ncp->nc_nlen; - memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); + memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen); SDT_PROBE3(vfs, namecache, fullpath, hit, ncp->nc_dvp, - nc_get_name(ncp), vp); + ncp->nc_name, vp); dvp = *vp; *vp = ncp->nc_dvp; vref(*vp); @@ -2364,7 +2353,7 @@ vn_commname(struct vnode *vp, char *buf, u_int buflen) return (ENOENT); } l = min(ncp->nc_nlen, buflen - 1); - memcpy(buf, nc_get_name(ncp), l); + memcpy(buf, ncp->nc_name, l); mtx_unlock(vlp); buf[l] = '\0'; return (0); From owner-svn-src-all@freebsd.org Sun Sep 10 11:57:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86189E0C80D; Sun, 10 Sep 2017 11:57:03 +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 5085270305; Sun, 10 Sep 2017 11:57:03 +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 v8ABv2Iw083868; Sun, 10 Sep 2017 11:57:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ABv2B9083867; Sun, 10 Sep 2017 11:57:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709101157.v8ABv2B9083867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Sep 2017 11:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323386 - head/sys/dev/ichwd X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/ichwd X-SVN-Commit-Revision: 323386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 11:57:03 -0000 Author: kib Date: Sun Sep 10 11:57:02 2017 New Revision: 323386 URL: https://svnweb.freebsd.org/changeset/base/323386 Log: Style: tab after #define. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/dev/ichwd/ichwd.h Modified: head/sys/dev/ichwd/ichwd.h ============================================================================== --- head/sys/dev/ichwd/ichwd.h Sun Sep 10 11:17:32 2017 (r323385) +++ head/sys/dev/ichwd/ichwd.h Sun Sep 10 11:57:02 2017 (r323386) @@ -29,7 +29,7 @@ */ #ifndef _ICHWD_H_ -#define _ICHWD_H_ +#define _ICHWD_H_ struct ichwd_device { uint16_t device; @@ -60,279 +60,279 @@ struct ichwd_softc { eventhandler_tag ev_tag; }; -#define VENDORID_INTEL 0x8086 -#define DEVICEID_BAYTRAIL 0x0f1c -#define DEVICEID_CPT0 0x1c40 -#define DEVICEID_CPT1 0x1c41 -#define DEVICEID_CPT2 0x1c42 -#define DEVICEID_CPT3 0x1c43 -#define DEVICEID_CPT4 0x1c44 -#define DEVICEID_CPT5 0x1c45 -#define DEVICEID_CPT6 0x1c46 -#define DEVICEID_CPT7 0x1c47 -#define DEVICEID_CPT8 0x1c48 -#define DEVICEID_CPT9 0x1c49 -#define DEVICEID_CPT10 0x1c4a -#define DEVICEID_CPT11 0x1c4b -#define DEVICEID_CPT12 0x1c4c -#define DEVICEID_CPT13 0x1c4d -#define DEVICEID_CPT14 0x1c4e -#define DEVICEID_CPT15 0x1c4f -#define DEVICEID_CPT16 0x1c50 -#define DEVICEID_CPT17 0x1c51 -#define DEVICEID_CPT18 0x1c52 -#define DEVICEID_CPT19 0x1c53 -#define DEVICEID_CPT20 0x1c54 -#define DEVICEID_CPT21 0x1c55 -#define DEVICEID_CPT22 0x1c56 -#define DEVICEID_CPT23 0x1c57 -#define DEVICEID_CPT24 0x1c58 -#define DEVICEID_CPT25 0x1c59 -#define DEVICEID_CPT26 0x1c5a -#define DEVICEID_CPT27 0x1c5b -#define DEVICEID_CPT28 0x1c5c -#define DEVICEID_CPT29 0x1c5d -#define DEVICEID_CPT30 0x1c5e -#define DEVICEID_CPT31 0x1c5f -#define DEVICEID_PATSBURG_LPC1 0x1d40 -#define DEVICEID_PATSBURG_LPC2 0x1d41 -#define DEVICEID_PPT0 0x1e40 -#define DEVICEID_PPT1 0x1e41 -#define DEVICEID_PPT2 0x1e42 -#define DEVICEID_PPT3 0x1e43 -#define DEVICEID_PPT4 0x1e44 -#define DEVICEID_PPT5 0x1e45 -#define DEVICEID_PPT6 0x1e46 -#define DEVICEID_PPT7 0x1e47 -#define DEVICEID_PPT8 0x1e48 -#define DEVICEID_PPT9 0x1e49 -#define DEVICEID_PPT10 0x1e4a -#define DEVICEID_PPT11 0x1e4b -#define DEVICEID_PPT12 0x1e4c -#define DEVICEID_PPT13 0x1e4d -#define DEVICEID_PPT14 0x1e4e -#define DEVICEID_PPT15 0x1e4f -#define DEVICEID_PPT16 0x1e50 -#define DEVICEID_PPT17 0x1e51 -#define DEVICEID_PPT18 0x1e52 -#define DEVICEID_PPT19 0x1e53 -#define DEVICEID_PPT20 0x1e54 -#define DEVICEID_PPT21 0x1e55 -#define DEVICEID_PPT22 0x1e56 -#define DEVICEID_PPT23 0x1e57 -#define DEVICEID_PPT24 0x1e58 -#define DEVICEID_PPT25 0x1e59 -#define DEVICEID_PPT26 0x1e5a -#define DEVICEID_PPT27 0x1e5b -#define DEVICEID_PPT28 0x1e5c -#define DEVICEID_PPT29 0x1e5d -#define DEVICEID_PPT30 0x1e5e -#define DEVICEID_PPT31 0x1e5f -#define DEVICEID_AVN0 0x1f38 -#define DEVICEID_AVN1 0x1f39 -#define DEVICEID_AVN2 0x1f3a -#define DEVICEID_AVN3 0x1f3b -#define DEVICEID_BRASWELL 0x229c -#define DEVICEID_DH89XXCC_LPC 0x2310 -#define DEVICEID_COLETOCRK_LPC 0x2390 -#define DEVICEID_82801AA 0x2410 -#define DEVICEID_82801AB 0x2420 -#define DEVICEID_82801BA 0x2440 -#define DEVICEID_82801BAM 0x244c -#define DEVICEID_82801CA 0x2480 -#define DEVICEID_82801CAM 0x248c -#define DEVICEID_82801DB 0x24c0 -#define DEVICEID_82801DBM 0x24cc -#define DEVICEID_82801E 0x2450 -#define DEVICEID_82801EB 0x24dc -#define DEVICEID_82801EBR 0x24d0 -#define DEVICEID_6300ESB 0x25a1 -#define DEVICEID_82801FBR 0x2640 -#define DEVICEID_ICH6M 0x2641 -#define DEVICEID_ICH6W 0x2642 -#define DEVICEID_63XXESB 0x2670 -#define DEVICEID_ICH7 0x27b8 -#define DEVICEID_ICH7DH 0x27b0 -#define DEVICEID_ICH7M 0x27b9 -#define DEVICEID_NM10 0x27bc -#define DEVICEID_ICH7MDH 0x27bd -#define DEVICEID_ICH8 0x2810 -#define DEVICEID_ICH8DH 0x2812 -#define DEVICEID_ICH8DO 0x2814 -#define DEVICEID_ICH8M 0x2815 -#define DEVICEID_ICH8ME 0x2811 -#define DEVICEID_ICH9 0x2918 -#define DEVICEID_ICH9DH 0x2912 -#define DEVICEID_ICH9DO 0x2914 -#define DEVICEID_ICH9M 0x2919 -#define DEVICEID_ICH9ME 0x2917 -#define DEVICEID_ICH9R 0x2916 -#define DEVICEID_ICH10 0x3a18 -#define DEVICEID_ICH10D 0x3a1a -#define DEVICEID_ICH10DO 0x3a14 -#define DEVICEID_ICH10R 0x3a16 -#define DEVICEID_PCH 0x3b00 -#define DEVICEID_PCHM 0x3b01 -#define DEVICEID_P55 0x3b02 -#define DEVICEID_PM55 0x3b03 -#define DEVICEID_H55 0x3b06 -#define DEVICEID_QM57 0x3b07 -#define DEVICEID_H57 0x3b08 -#define DEVICEID_HM55 0x3b09 -#define DEVICEID_Q57 0x3b0a -#define DEVICEID_HM57 0x3b0b -#define DEVICEID_PCHMSFF 0x3b0d -#define DEVICEID_QS57 0x3b0f -#define DEVICEID_3400 0x3b12 -#define DEVICEID_3420 0x3b14 -#define DEVICEID_3450 0x3b16 -#define DEVICEID_LPT0 0x8c40 -#define DEVICEID_LPT1 0x8c41 -#define DEVICEID_LPT2 0x8c42 -#define DEVICEID_LPT3 0x8c43 -#define DEVICEID_LPT4 0x8c44 -#define DEVICEID_LPT5 0x8c45 -#define DEVICEID_LPT6 0x8c46 -#define DEVICEID_LPT7 0x8c47 -#define DEVICEID_LPT8 0x8c48 -#define DEVICEID_LPT9 0x8c49 -#define DEVICEID_LPT10 0x8c4a -#define DEVICEID_LPT11 0x8c4b -#define DEVICEID_LPT12 0x8c4c -#define DEVICEID_LPT13 0x8c4d -#define DEVICEID_LPT14 0x8c4e -#define DEVICEID_LPT15 0x8c4f -#define DEVICEID_LPT16 0x8c50 -#define DEVICEID_LPT17 0x8c51 -#define DEVICEID_LPT18 0x8c52 -#define DEVICEID_LPT19 0x8c53 -#define DEVICEID_LPT20 0x8c54 -#define DEVICEID_LPT21 0x8c55 -#define DEVICEID_LPT22 0x8c56 -#define DEVICEID_LPT23 0x8c57 -#define DEVICEID_LPT24 0x8c58 -#define DEVICEID_LPT25 0x8c59 -#define DEVICEID_LPT26 0x8c5a -#define DEVICEID_LPT27 0x8c5b -#define DEVICEID_LPT28 0x8c5c -#define DEVICEID_LPT29 0x8c5d -#define DEVICEID_LPT30 0x8c5e -#define DEVICEID_LPT31 0x8c5f -#define DEVICEID_WCPT1 0x8cc1 -#define DEVICEID_WCPT2 0x8cc2 -#define DEVICEID_WCPT3 0x8cc3 -#define DEVICEID_WCPT4 0x8cc4 -#define DEVICEID_WCPT6 0x8cc6 -#define DEVICEID_WBG0 0x8d40 -#define DEVICEID_WBG1 0x8d41 -#define DEVICEID_WBG2 0x8d42 -#define DEVICEID_WBG3 0x8d43 -#define DEVICEID_WBG4 0x8d44 -#define DEVICEID_WBG5 0x8d45 -#define DEVICEID_WBG6 0x8d46 -#define DEVICEID_WBG7 0x8d47 -#define DEVICEID_WBG8 0x8d48 -#define DEVICEID_WBG9 0x8d49 -#define DEVICEID_WBG10 0x8d4a -#define DEVICEID_WBG11 0x8d4b -#define DEVICEID_WBG12 0x8d4c -#define DEVICEID_WBG13 0x8d4d -#define DEVICEID_WBG14 0x8d4e -#define DEVICEID_WBG15 0x8d4f -#define DEVICEID_WBG16 0x8d50 -#define DEVICEID_WBG17 0x8d51 -#define DEVICEID_WBG18 0x8d52 -#define DEVICEID_WBG19 0x8d53 -#define DEVICEID_WBG20 0x8d54 -#define DEVICEID_WBG21 0x8d55 -#define DEVICEID_WBG22 0x8d56 -#define DEVICEID_WBG23 0x8d57 -#define DEVICEID_WBG24 0x8d58 -#define DEVICEID_WBG25 0x8d59 -#define DEVICEID_WBG26 0x8d5a -#define DEVICEID_WBG27 0x8d5b -#define DEVICEID_WBG28 0x8d5c -#define DEVICEID_WBG29 0x8d5d -#define DEVICEID_WBG30 0x8d5e -#define DEVICEID_WBG31 0x8d5f -#define DEVICEID_LPT_LP0 0x9c40 -#define DEVICEID_LPT_LP1 0x9c41 -#define DEVICEID_LPT_LP2 0x9c42 -#define DEVICEID_LPT_LP3 0x9c43 -#define DEVICEID_LPT_LP4 0x9c44 -#define DEVICEID_LPT_LP5 0x9c45 -#define DEVICEID_LPT_LP6 0x9c46 -#define DEVICEID_LPT_LP7 0x9c47 -#define DEVICEID_WCPT_LP1 0x9cc1 -#define DEVICEID_WCPT_LP2 0x9cc2 -#define DEVICEID_WCPT_LP3 0x9cc3 -#define DEVICEID_WCPT_LP5 0x9cc5 -#define DEVICEID_WCPT_LP6 0x9cc6 -#define DEVICEID_WCPT_LP7 0x9cc7 -#define DEVICEID_WCPT_LP9 0x9cc9 +#define VENDORID_INTEL 0x8086 +#define DEVICEID_BAYTRAIL 0x0f1c +#define DEVICEID_CPT0 0x1c40 +#define DEVICEID_CPT1 0x1c41 +#define DEVICEID_CPT2 0x1c42 +#define DEVICEID_CPT3 0x1c43 +#define DEVICEID_CPT4 0x1c44 +#define DEVICEID_CPT5 0x1c45 +#define DEVICEID_CPT6 0x1c46 +#define DEVICEID_CPT7 0x1c47 +#define DEVICEID_CPT8 0x1c48 +#define DEVICEID_CPT9 0x1c49 +#define DEVICEID_CPT10 0x1c4a +#define DEVICEID_CPT11 0x1c4b +#define DEVICEID_CPT12 0x1c4c +#define DEVICEID_CPT13 0x1c4d +#define DEVICEID_CPT14 0x1c4e +#define DEVICEID_CPT15 0x1c4f +#define DEVICEID_CPT16 0x1c50 +#define DEVICEID_CPT17 0x1c51 +#define DEVICEID_CPT18 0x1c52 +#define DEVICEID_CPT19 0x1c53 +#define DEVICEID_CPT20 0x1c54 +#define DEVICEID_CPT21 0x1c55 +#define DEVICEID_CPT22 0x1c56 +#define DEVICEID_CPT23 0x1c57 +#define DEVICEID_CPT24 0x1c58 +#define DEVICEID_CPT25 0x1c59 +#define DEVICEID_CPT26 0x1c5a +#define DEVICEID_CPT27 0x1c5b +#define DEVICEID_CPT28 0x1c5c +#define DEVICEID_CPT29 0x1c5d +#define DEVICEID_CPT30 0x1c5e +#define DEVICEID_CPT31 0x1c5f +#define DEVICEID_PATSBURG_LPC1 0x1d40 +#define DEVICEID_PATSBURG_LPC2 0x1d41 +#define DEVICEID_PPT0 0x1e40 +#define DEVICEID_PPT1 0x1e41 +#define DEVICEID_PPT2 0x1e42 +#define DEVICEID_PPT3 0x1e43 +#define DEVICEID_PPT4 0x1e44 +#define DEVICEID_PPT5 0x1e45 +#define DEVICEID_PPT6 0x1e46 +#define DEVICEID_PPT7 0x1e47 +#define DEVICEID_PPT8 0x1e48 +#define DEVICEID_PPT9 0x1e49 +#define DEVICEID_PPT10 0x1e4a +#define DEVICEID_PPT11 0x1e4b +#define DEVICEID_PPT12 0x1e4c +#define DEVICEID_PPT13 0x1e4d +#define DEVICEID_PPT14 0x1e4e +#define DEVICEID_PPT15 0x1e4f +#define DEVICEID_PPT16 0x1e50 +#define DEVICEID_PPT17 0x1e51 +#define DEVICEID_PPT18 0x1e52 +#define DEVICEID_PPT19 0x1e53 +#define DEVICEID_PPT20 0x1e54 +#define DEVICEID_PPT21 0x1e55 +#define DEVICEID_PPT22 0x1e56 +#define DEVICEID_PPT23 0x1e57 +#define DEVICEID_PPT24 0x1e58 +#define DEVICEID_PPT25 0x1e59 +#define DEVICEID_PPT26 0x1e5a +#define DEVICEID_PPT27 0x1e5b +#define DEVICEID_PPT28 0x1e5c +#define DEVICEID_PPT29 0x1e5d +#define DEVICEID_PPT30 0x1e5e +#define DEVICEID_PPT31 0x1e5f +#define DEVICEID_AVN0 0x1f38 +#define DEVICEID_AVN1 0x1f39 +#define DEVICEID_AVN2 0x1f3a +#define DEVICEID_AVN3 0x1f3b +#define DEVICEID_BRASWELL 0x229c +#define DEVICEID_DH89XXCC_LPC 0x2310 +#define DEVICEID_COLETOCRK_LPC 0x2390 +#define DEVICEID_82801AA 0x2410 +#define DEVICEID_82801AB 0x2420 +#define DEVICEID_82801BA 0x2440 +#define DEVICEID_82801BAM 0x244c +#define DEVICEID_82801CA 0x2480 +#define DEVICEID_82801CAM 0x248c +#define DEVICEID_82801DB 0x24c0 +#define DEVICEID_82801DBM 0x24cc +#define DEVICEID_82801E 0x2450 +#define DEVICEID_82801EB 0x24dc +#define DEVICEID_82801EBR 0x24d0 +#define DEVICEID_6300ESB 0x25a1 +#define DEVICEID_82801FBR 0x2640 +#define DEVICEID_ICH6M 0x2641 +#define DEVICEID_ICH6W 0x2642 +#define DEVICEID_63XXESB 0x2670 +#define DEVICEID_ICH7 0x27b8 +#define DEVICEID_ICH7DH 0x27b0 +#define DEVICEID_ICH7M 0x27b9 +#define DEVICEID_NM10 0x27bc +#define DEVICEID_ICH7MDH 0x27bd +#define DEVICEID_ICH8 0x2810 +#define DEVICEID_ICH8DH 0x2812 +#define DEVICEID_ICH8DO 0x2814 +#define DEVICEID_ICH8M 0x2815 +#define DEVICEID_ICH8ME 0x2811 +#define DEVICEID_ICH9 0x2918 +#define DEVICEID_ICH9DH 0x2912 +#define DEVICEID_ICH9DO 0x2914 +#define DEVICEID_ICH9M 0x2919 +#define DEVICEID_ICH9ME 0x2917 +#define DEVICEID_ICH9R 0x2916 +#define DEVICEID_ICH10 0x3a18 +#define DEVICEID_ICH10D 0x3a1a +#define DEVICEID_ICH10DO 0x3a14 +#define DEVICEID_ICH10R 0x3a16 +#define DEVICEID_PCH 0x3b00 +#define DEVICEID_PCHM 0x3b01 +#define DEVICEID_P55 0x3b02 +#define DEVICEID_PM55 0x3b03 +#define DEVICEID_H55 0x3b06 +#define DEVICEID_QM57 0x3b07 +#define DEVICEID_H57 0x3b08 +#define DEVICEID_HM55 0x3b09 +#define DEVICEID_Q57 0x3b0a +#define DEVICEID_HM57 0x3b0b +#define DEVICEID_PCHMSFF 0x3b0d +#define DEVICEID_QS57 0x3b0f +#define DEVICEID_3400 0x3b12 +#define DEVICEID_3420 0x3b14 +#define DEVICEID_3450 0x3b16 +#define DEVICEID_LPT0 0x8c40 +#define DEVICEID_LPT1 0x8c41 +#define DEVICEID_LPT2 0x8c42 +#define DEVICEID_LPT3 0x8c43 +#define DEVICEID_LPT4 0x8c44 +#define DEVICEID_LPT5 0x8c45 +#define DEVICEID_LPT6 0x8c46 +#define DEVICEID_LPT7 0x8c47 +#define DEVICEID_LPT8 0x8c48 +#define DEVICEID_LPT9 0x8c49 +#define DEVICEID_LPT10 0x8c4a +#define DEVICEID_LPT11 0x8c4b +#define DEVICEID_LPT12 0x8c4c +#define DEVICEID_LPT13 0x8c4d +#define DEVICEID_LPT14 0x8c4e +#define DEVICEID_LPT15 0x8c4f +#define DEVICEID_LPT16 0x8c50 +#define DEVICEID_LPT17 0x8c51 +#define DEVICEID_LPT18 0x8c52 +#define DEVICEID_LPT19 0x8c53 +#define DEVICEID_LPT20 0x8c54 +#define DEVICEID_LPT21 0x8c55 +#define DEVICEID_LPT22 0x8c56 +#define DEVICEID_LPT23 0x8c57 +#define DEVICEID_LPT24 0x8c58 +#define DEVICEID_LPT25 0x8c59 +#define DEVICEID_LPT26 0x8c5a +#define DEVICEID_LPT27 0x8c5b +#define DEVICEID_LPT28 0x8c5c +#define DEVICEID_LPT29 0x8c5d +#define DEVICEID_LPT30 0x8c5e +#define DEVICEID_LPT31 0x8c5f +#define DEVICEID_WCPT1 0x8cc1 +#define DEVICEID_WCPT2 0x8cc2 +#define DEVICEID_WCPT3 0x8cc3 +#define DEVICEID_WCPT4 0x8cc4 +#define DEVICEID_WCPT6 0x8cc6 +#define DEVICEID_WBG0 0x8d40 +#define DEVICEID_WBG1 0x8d41 +#define DEVICEID_WBG2 0x8d42 +#define DEVICEID_WBG3 0x8d43 +#define DEVICEID_WBG4 0x8d44 +#define DEVICEID_WBG5 0x8d45 +#define DEVICEID_WBG6 0x8d46 +#define DEVICEID_WBG7 0x8d47 +#define DEVICEID_WBG8 0x8d48 +#define DEVICEID_WBG9 0x8d49 +#define DEVICEID_WBG10 0x8d4a +#define DEVICEID_WBG11 0x8d4b +#define DEVICEID_WBG12 0x8d4c +#define DEVICEID_WBG13 0x8d4d +#define DEVICEID_WBG14 0x8d4e +#define DEVICEID_WBG15 0x8d4f +#define DEVICEID_WBG16 0x8d50 +#define DEVICEID_WBG17 0x8d51 +#define DEVICEID_WBG18 0x8d52 +#define DEVICEID_WBG19 0x8d53 +#define DEVICEID_WBG20 0x8d54 +#define DEVICEID_WBG21 0x8d55 +#define DEVICEID_WBG22 0x8d56 +#define DEVICEID_WBG23 0x8d57 +#define DEVICEID_WBG24 0x8d58 +#define DEVICEID_WBG25 0x8d59 +#define DEVICEID_WBG26 0x8d5a +#define DEVICEID_WBG27 0x8d5b +#define DEVICEID_WBG28 0x8d5c +#define DEVICEID_WBG29 0x8d5d +#define DEVICEID_WBG30 0x8d5e +#define DEVICEID_WBG31 0x8d5f +#define DEVICEID_LPT_LP0 0x9c40 +#define DEVICEID_LPT_LP1 0x9c41 +#define DEVICEID_LPT_LP2 0x9c42 +#define DEVICEID_LPT_LP3 0x9c43 +#define DEVICEID_LPT_LP4 0x9c44 +#define DEVICEID_LPT_LP5 0x9c45 +#define DEVICEID_LPT_LP6 0x9c46 +#define DEVICEID_LPT_LP7 0x9c47 +#define DEVICEID_WCPT_LP1 0x9cc1 +#define DEVICEID_WCPT_LP2 0x9cc2 +#define DEVICEID_WCPT_LP3 0x9cc3 +#define DEVICEID_WCPT_LP5 0x9cc5 +#define DEVICEID_WCPT_LP6 0x9cc6 +#define DEVICEID_WCPT_LP7 0x9cc7 +#define DEVICEID_WCPT_LP9 0x9cc9 /* ICH LPC Interface Bridge Registers (ICH5 and older) */ -#define ICH_GEN_STA 0xd4 -#define ICH_GEN_STA_NO_REBOOT 0x02 -#define ICH_PMBASE 0x40 /* ACPI base address register */ -#define ICH_PMBASE_MASK 0x7f80 /* bits 7-15 */ +#define ICH_GEN_STA 0xd4 +#define ICH_GEN_STA_NO_REBOOT 0x02 +#define ICH_PMBASE 0x40 /* ACPI base address register */ +#define ICH_PMBASE_MASK 0x7f80 /* bits 7-15 */ /* ICH Chipset Configuration Registers (ICH6 and newer) */ -#define ICH_RCBA 0xf0 -#define ICH_GCS_OFFSET 0x3410 -#define ICH_GCS_SIZE 0x4 -#define ICH_GCS_NO_REBOOT 0x20 +#define ICH_RCBA 0xf0 +#define ICH_GCS_OFFSET 0x3410 +#define ICH_GCS_SIZE 0x4 +#define ICH_GCS_NO_REBOOT 0x20 /* SoC Power Management Configuration Registers */ -#define ICH_PBASE 0x44 -#define ICH_PMC_OFFSET 0x08 -#define ICH_PMC_SIZE 0x4 -#define ICH_PMC_NO_REBOOT 0x10 +#define ICH_PBASE 0x44 +#define ICH_PMC_OFFSET 0x08 +#define ICH_PMC_SIZE 0x4 +#define ICH_PMC_NO_REBOOT 0x10 /* register names and locations (relative to PMBASE) */ -#define SMI_BASE 0x30 /* base address for SMI registers */ -#define SMI_LEN 0x08 -#define SMI_EN 0x00 /* SMI Control and Enable Register */ -#define SMI_STS 0x04 /* SMI Status Register */ -#define TCO_BASE 0x60 /* base address for TCO registers */ -#define TCO_LEN 0x20 -#define TCO_RLD 0x00 /* TCO Reload and Current Value */ -#define TCO_TMR1 0x01 /* TCO Timer Initial Value +#define SMI_BASE 0x30 /* base address for SMI registers */ +#define SMI_LEN 0x08 +#define SMI_EN 0x00 /* SMI Control and Enable Register */ +#define SMI_STS 0x04 /* SMI Status Register */ +#define TCO_BASE 0x60 /* base address for TCO registers */ +#define TCO_LEN 0x20 +#define TCO_RLD 0x00 /* TCO Reload and Current Value */ +#define TCO_TMR1 0x01 /* TCO Timer Initial Value (ICH5 and older, 8 bits) */ -#define TCO_TMR2 0x12 /* TCO Timer Initial Value +#define TCO_TMR2 0x12 /* TCO Timer Initial Value (ICH6 and newer, 16 bits) */ -#define TCO_DAT_IN 0x02 /* TCO Data In (DO NOT USE) */ -#define TCO_DAT_OUT 0x03 /* TCO Data Out (DO NOT USE) */ -#define TCO1_STS 0x04 /* TCO Status 1 */ -#define TCO2_STS 0x06 /* TCO Status 2 */ -#define TCO1_CNT 0x08 /* TCO Control 1 */ -#define TCO2_CNT 0x08 /* TCO Control 2 */ -#define TCO_MESSAGE1 0x0c /* TCO Message 1 */ -#define TCO_MESSAGE2 0x0d /* TCO Message 2 */ +#define TCO_DAT_IN 0x02 /* TCO Data In (DO NOT USE) */ +#define TCO_DAT_OUT 0x03 /* TCO Data Out (DO NOT USE) */ +#define TCO1_STS 0x04 /* TCO Status 1 */ +#define TCO2_STS 0x06 /* TCO Status 2 */ +#define TCO1_CNT 0x08 /* TCO Control 1 */ +#define TCO2_CNT 0x08 /* TCO Control 2 */ +#define TCO_MESSAGE1 0x0c /* TCO Message 1 */ +#define TCO_MESSAGE2 0x0d /* TCO Message 2 */ /* bit definitions for SMI_EN and SMI_STS */ -#define SMI_TCO_EN 0x2000 -#define SMI_TCO_STS 0x2000 -#define SMI_GBL_EN 0x0001 +#define SMI_TCO_EN 0x2000 +#define SMI_TCO_STS 0x2000 +#define SMI_GBL_EN 0x0001 /* timer value mask for TCO_RLD and TCO_TMR */ -#define TCO_TIMER_MASK 0x1f +#define TCO_TIMER_MASK 0x1f /* status bits for TCO1_STS */ -#define TCO_NEWCENTURY 0x80 /* set for RTC year roll over (99 to 00) */ -#define TCO_TIMEOUT 0x08 /* timed out */ -#define TCO_INT_STS 0x04 /* data out (DO NOT USE) */ -#define TCO_SMI_STS 0x02 /* data in (DO NOT USE) */ +#define TCO_NEWCENTURY 0x80 /* set for RTC year roll over (99 to 00) */ +#define TCO_TIMEOUT 0x08 /* timed out */ +#define TCO_INT_STS 0x04 /* data out (DO NOT USE) */ +#define TCO_SMI_STS 0x02 /* data in (DO NOT USE) */ /* status bits for TCO2_STS */ -#define TCO_BOOT_STS 0x04 /* failed to come out of reset */ -#define TCO_SECOND_TO_STS 0x02 /* ran down twice */ +#define TCO_BOOT_STS 0x04 /* failed to come out of reset */ +#define TCO_SECOND_TO_STS 0x02 /* ran down twice */ /* control bits for TCO1_CNT */ -#define TCO_TMR_HALT 0x0800 /* clear to enable WDT */ -#define TCO_NMI2SMI_EN 0x0200 /* convert NMIs to SMIs */ -#define TCO_CNT_PRESERVE TCO_NMI2SMI_EN /* preserve these bits */ -#define TCO_NMI_NOW 0x0100 /* trigger an NMI */ +#define TCO_TMR_HALT 0x0800 /* clear to enable WDT */ +#define TCO_NMI2SMI_EN 0x0200 /* convert NMIs to SMIs */ +#define TCO_CNT_PRESERVE TCO_NMI2SMI_EN /* preserve these bits */ +#define TCO_NMI_NOW 0x0100 /* trigger an NMI */ /* * Masks for the TCO timer value field in TCO_RLD. @@ -341,13 +341,13 @@ struct ichwd_softc { * I suspect this is a bug in the ICH5 datasheet and that the minimum is * uniformly 2, but I'd rather err on the side of caution. */ -#define TCO_RLD_TMR_MIN 0x0004 -#define TCO_RLD1_TMR_MAX 0x003f -#define TCO_RLD2_TMR_MAX 0x03ff +#define TCO_RLD_TMR_MIN 0x0004 +#define TCO_RLD1_TMR_MAX 0x003f +#define TCO_RLD2_TMR_MAX 0x03ff /* approximate length in nanoseconds of one WDT tick (about 0.6 sec) for TCO v1/v2 */ -#define ICHWD_TICK 600000000 +#define ICHWD_TICK 600000000 /* approximate length in nanoseconds of one WDT tick (about 1.0 sec) for TCO v3 */ -#define ICHWD_TCO_V3_TICK 1000000000 +#define ICHWD_TCO_V3_TICK 1000000000 #endif From owner-svn-src-all@freebsd.org Sun Sep 10 12:10:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6443CE0D874; Sun, 10 Sep 2017 12:10:28 +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 3D52C70B53; Sun, 10 Sep 2017 12:10:28 +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 v8ACAROH088256; Sun, 10 Sep 2017 12:10:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ACARaH088255; Sun, 10 Sep 2017 12:10:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709101210.v8ACARaH088255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Sep 2017 12:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323387 - head/sys/dev/ichwd X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/ichwd X-SVN-Commit-Revision: 323387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 12:10:28 -0000 Author: kib Date: Sun Sep 10 12:10:27 2017 New Revision: 323387 URL: https://svnweb.freebsd.org/changeset/base/323387 Log: Add definitions of (new) bits for TCO registers from the Lewisburg/Sunrise Point documentation. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/dev/ichwd/ichwd.h Modified: head/sys/dev/ichwd/ichwd.h ============================================================================== --- head/sys/dev/ichwd/ichwd.h Sun Sep 10 11:57:02 2017 (r323386) +++ head/sys/dev/ichwd/ichwd.h Sun Sep 10 12:10:27 2017 (r323387) @@ -309,6 +309,8 @@ struct ichwd_softc { #define TCO2_CNT 0x08 /* TCO Control 2 */ #define TCO_MESSAGE1 0x0c /* TCO Message 1 */ #define TCO_MESSAGE2 0x0d /* TCO Message 2 */ +#define TCO_WDSTATUS 0x0e /* TCO Watchdog status */ +#define TCO_TMR 0x12 /* TCP Reload value */ /* bit definitions for SMI_EN and SMI_STS */ #define SMI_TCO_EN 0x2000 @@ -317,23 +319,45 @@ struct ichwd_softc { /* timer value mask for TCO_RLD and TCO_TMR */ #define TCO_TIMER_MASK 0x1f +#define TCO_TIMER_MASK2 0x2f /* status bits for TCO1_STS */ -#define TCO_NEWCENTURY 0x80 /* set for RTC year roll over (99 to 00) */ -#define TCO_TIMEOUT 0x08 /* timed out */ -#define TCO_INT_STS 0x04 /* data out (DO NOT USE) */ -#define TCO_SMI_STS 0x02 /* data in (DO NOT USE) */ +#define TCO_SLVSEL 0x2000 /* TCO Slave Select Soft Strap */ +#define TCO_CPUSERR_STS 0x1000 +#define TCO_CPUSMI_STS 0x0400 +#define TCO_CPUSCI_STS 0x0200 +#define TCO_BIOSWR_STS 0x0100 +#define TCO_NEWCENTURY 0x0080 /* set for RTC year roll over + (99 to 00) */ +#define TCO_TIMEOUT 0x0008 /* timed out */ +#define TCO_INT_STS 0x0004 /* data out (DO NOT USE) */ +#define TCO_SMI_STS 0x0002 /* data in (DO NOT USE) */ +#define TCO_NMI2SMI_STS 0x0001 /* status bits for TCO2_STS */ -#define TCO_BOOT_STS 0x04 /* failed to come out of reset */ -#define TCO_SECOND_TO_STS 0x02 /* ran down twice */ +#define TCO_SMLINK_SLAVE_SMI 0x0010 +#define TCO_BOOT_STS 0x0004 /* failed to come out of reset */ +#define TCO_SECOND_TO_STS 0x0002 /* ran down twice */ +#define TCO_INTRD_DET 0x0001 /* control bits for TCO1_CNT */ +#define TCO_LOCK 0x1000 /* SMI_BASE.TCO_EN locked */ #define TCO_TMR_HALT 0x0800 /* clear to enable WDT */ #define TCO_NMI2SMI_EN 0x0200 /* convert NMIs to SMIs */ #define TCO_CNT_PRESERVE TCO_NMI2SMI_EN /* preserve these bits */ #define TCO_NMI_NOW 0x0100 /* trigger an NMI */ +/* control bits for TCO2_CNT */ +#define TCO_OS_POLICY 0x0030 /* mask */ +#define TC0_OS_POLICY_BOOT 0x0000 +#define TCO_OS_POLICY_SHUTD 0x0010 +#define TCO_OS_POLICY_NOLOAD 0x0020 +#define TCO_SMB_ALERT_DISABLE 0x0008 +#define TCO_INTRD_SEL 0x0003 /* mask */ +#define TCO_INTRD_SEL_SILENT 0x0000 +#define TCO_INTRD_SEL_INTR 0x0001 +#define TCO_INTRD_SEL_SMI 0x0002 + /* * Masks for the TCO timer value field in TCO_RLD. * If the datasheets are to be believed, the minimum value actually varies @@ -345,9 +369,15 @@ struct ichwd_softc { #define TCO_RLD1_TMR_MAX 0x003f #define TCO_RLD2_TMR_MAX 0x03ff -/* approximate length in nanoseconds of one WDT tick (about 0.6 sec) for TCO v1/v2 */ +/* + * Approximate length in nanoseconds of one WDT tick (about 0.6 sec) + * for TCO v1/v2/v4 + */ #define ICHWD_TICK 600000000 -/* approximate length in nanoseconds of one WDT tick (about 1.0 sec) for TCO v3 */ +/* + * Approximate length in nanoseconds of one WDT tick (about 1.0 sec) + * for TCO v3 + */ #define ICHWD_TCO_V3_TICK 1000000000 #endif From owner-svn-src-all@freebsd.org Sun Sep 10 13:21:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5580CE10CCF; Sun, 10 Sep 2017 13:21:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FE0574170; Sun, 10 Sep 2017 13:21:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8ADLtaP020486; Sun, 10 Sep 2017 13:21:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ADLtFm020485; Sun, 10 Sep 2017 13:21:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709101321.v8ADLtFm020485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 10 Sep 2017 13:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323388 - head/sys/dev/ichwd X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/ichwd X-SVN-Commit-Revision: 323388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 13:21:56 -0000 Author: kib Date: Sun Sep 10 13:21:54 2017 New Revision: 323388 URL: https://svnweb.freebsd.org/changeset/base/323388 Log: Fix typo, TC0->TCO. Submitted by: jhb MFC after: 1 week Modified: head/sys/dev/ichwd/ichwd.h Modified: head/sys/dev/ichwd/ichwd.h ============================================================================== --- head/sys/dev/ichwd/ichwd.h Sun Sep 10 12:10:27 2017 (r323387) +++ head/sys/dev/ichwd/ichwd.h Sun Sep 10 13:21:54 2017 (r323388) @@ -349,7 +349,7 @@ struct ichwd_softc { /* control bits for TCO2_CNT */ #define TCO_OS_POLICY 0x0030 /* mask */ -#define TC0_OS_POLICY_BOOT 0x0000 +#define TCO_OS_POLICY_BOOT 0x0000 #define TCO_OS_POLICY_SHUTD 0x0010 #define TCO_OS_POLICY_NOLOAD 0x0020 #define TCO_SMB_ALERT_DISABLE 0x0008 From owner-svn-src-all@freebsd.org Sun Sep 10 13:53:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7ED0E1242D; Sun, 10 Sep 2017 13:53:44 +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 7B42E750BC; Sun, 10 Sep 2017 13:53:44 +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 v8ADrhlO036355; Sun, 10 Sep 2017 13:53:43 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ADrhUO036350; Sun, 10 Sep 2017 13:53:43 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709101353.v8ADrhUO036350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 10 Sep 2017 13:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323389 - in head/sys/boot/efi: include libefi loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/sys/boot/efi: include libefi loader X-SVN-Commit-Revision: 323389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 13:53:44 -0000 Author: tsoome Date: Sun Sep 10 13:53:42 2017 New Revision: 323389 URL: https://svnweb.freebsd.org/changeset/base/323389 Log: loader.efi: chain loader should provide proper device handle Since the efipart rewrite, the chain command was looking for device handle using interface applicable only for net devices. Disk partitions and zfs pools need their own approach to find the proper handle. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12287 Modified: head/sys/boot/efi/include/efilib.h head/sys/boot/efi/include/efizfs.h head/sys/boot/efi/libefi/efipart.c head/sys/boot/efi/libefi/efizfs.c head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/include/efilib.h ============================================================================== --- head/sys/boot/efi/include/efilib.h Sun Sep 10 13:21:54 2017 (r323388) +++ head/sys/boot/efi/include/efilib.h Sun Sep 10 13:53:42 2017 (r323389) @@ -61,6 +61,7 @@ typedef struct pdinfo } pdinfo_t; pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev); +pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev); void *efi_get_table(EFI_GUID *tbl); Modified: head/sys/boot/efi/include/efizfs.h ============================================================================== --- head/sys/boot/efi/include/efizfs.h Sun Sep 10 13:21:54 2017 (r323388) +++ head/sys/boot/efi/include/efizfs.h Sun Sep 10 13:53:42 2017 (r323389) @@ -45,6 +45,7 @@ extern uint64_t pool_guid; extern void efi_zfs_probe(void); extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void); +extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); #endif Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Sun Sep 10 13:21:54 2017 (r323388) +++ head/sys/boot/efi/libefi/efipart.c Sun Sep 10 13:53:42 2017 (r323389) @@ -101,16 +101,33 @@ static pdinfo_list_t hdinfo; static EFI_HANDLE *efipart_handles = NULL; static UINTN efipart_nhandles = 0; -static pdinfo_t * -efiblk_get_pdinfo(pdinfo_list_t *pdi, int unit) +pdinfo_list_t * +efiblk_get_pdinfo_list(struct devsw *dev) { - pdinfo_t *pd; + if (dev->dv_type == DEVT_DISK) + return (&hdinfo); + if (dev->dv_type == DEVT_CD) + return (&cdinfo); + if (dev->dv_type == DEVT_FD) + return (&fdinfo); + return (NULL); +} +pdinfo_t * +efiblk_get_pdinfo(struct devdesc *dev) +{ + pdinfo_list_t *pdi; + pdinfo_t *pd = NULL; + + pdi = efiblk_get_pdinfo_list(dev->d_dev); + if (pdi == NULL) + return (pd); + STAILQ_FOREACH(pd, pdi, pd_link) { - if (pd->pd_unit == unit) + if (pd->pd_unit == dev->d_unit) return (pd); } - return (NULL); + return (pd); } static int @@ -671,24 +688,11 @@ efipart_printhd(int verbose) return (efipart_print_common(&efipart_hddev, &hdinfo, verbose)); } -pdinfo_list_t * -efiblk_get_pdinfo_list(struct devsw *dev) -{ - if (dev->dv_type == DEVT_DISK) - return (&hdinfo); - if (dev->dv_type == DEVT_CD) - return (&cdinfo); - if (dev->dv_type == DEVT_FD) - return (&fdinfo); - return (NULL); -} - static int efipart_open(struct open_file *f, ...) { va_list args; struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; EFI_BLOCK_IO *blkio; EFI_STATUS status; @@ -699,11 +703,7 @@ efipart_open(struct open_file *f, ...) if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EIO); @@ -734,17 +734,13 @@ static int efipart_close(struct open_file *f) { struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; dev = (struct disk_devdesc *)(f->f_devdata); if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -763,18 +759,14 @@ static int efipart_ioctl(struct open_file *f, u_long cmd, void *data) { struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; int rc; dev = (struct disk_devdesc *)(f->f_devdata); if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -847,17 +839,13 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, s { struct bcache_devdata bcd; struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; dev = (struct disk_devdesc *)devdata; if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -881,7 +869,6 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl char *buf, size_t *rsize) { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; - pdinfo_list_t *pdi; pdinfo_t *pd; EFI_BLOCK_IO *blkio; uint64_t off, disk_blocks, d_offset = 0; @@ -893,11 +880,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl if (dev == NULL || blk < 0) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); Modified: head/sys/boot/efi/libefi/efizfs.c ============================================================================== --- head/sys/boot/efi/libefi/efizfs.c Sun Sep 10 13:21:54 2017 (r323388) +++ head/sys/boot/efi/libefi/efizfs.c Sun Sep 10 13:53:42 2017 (r323389) @@ -52,6 +52,19 @@ efizfs_get_zfsinfo_list(void) return (&zfsinfo); } +EFI_HANDLE +efizfs_get_handle_by_guid(uint64_t guid) +{ + zfsinfo_t *zi; + + STAILQ_FOREACH(zi, &zfsinfo, zi_link) { + if (zi->zi_pool_guid == guid) { + return (zi->zi_handle); + } + } + return (NULL); +} + static void insert_zfs(EFI_HANDLE handle, uint64_t guid) { Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Sun Sep 10 13:21:54 2017 (r323388) +++ head/sys/boot/efi/loader/main.c Sun Sep 10 13:53:42 2017 (r323389) @@ -871,9 +871,41 @@ command_chain(int argc, char *argv[]) *(--argv) = 0; } - if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) - loaded_image->DeviceHandle = - efi_find_handle(dev->d_dev, dev->d_unit); + if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) { + struct zfs_devdesc *z_dev; + struct disk_devdesc *d_dev; + pdinfo_t *hd, *pd; + + switch (dev->d_type) { + case DEVT_ZFS: + z_dev = (struct zfs_devdesc *)dev; + loaded_image->DeviceHandle = + efizfs_get_handle_by_guid(z_dev->pool_guid); + break; + case DEVT_NET: + loaded_image->DeviceHandle = + efi_find_handle(dev->d_dev, dev->d_unit); + break; + default: + hd = efiblk_get_pdinfo(dev); + if (STAILQ_EMPTY(&hd->pd_part)) { + loaded_image->DeviceHandle = hd->pd_handle; + break; + } + d_dev = (struct disk_devdesc *)dev; + STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { + /* + * d_partition should be 255 + */ + if (pd->pd_unit == d_dev->d_slice) { + loaded_image->DeviceHandle = + pd->pd_handle; + break; + } + } + break; + } + } dev_cleanup(); status = BS->StartImage(loaderhandle, NULL, NULL); From owner-svn-src-all@freebsd.org Sun Sep 10 15:01:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0819E156AF; Sun, 10 Sep 2017 15:01:30 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5B1771BA; Sun, 10 Sep 2017 15:01:30 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8AF1T1k061706; Sun, 10 Sep 2017 15:01:29 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AF1Tr4061705; Sun, 10 Sep 2017 15:01:29 GMT (envelope-from des@FreeBSD.org) Message-Id: <201709101501.v8AF1Tr4061705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Sun, 10 Sep 2017 15:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323390 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 15:01:30 -0000 Author: des Date: Sun Sep 10 15:01:29 2017 New Revision: 323390 URL: https://svnweb.freebsd.org/changeset/base/323390 Log: If the user tries to set kern.randompid to 1 (which is meaningless), set it to a random value between 100 and 1123, rather than 0 as before. Submitted by: Marie Helene Kvello-Aune MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5336 Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sun Sep 10 13:53:42 2017 (r323389) +++ head/sys/kern/kern_fork.c Sun Sep 10 15:01:29 2017 (r323390) @@ -208,20 +208,26 @@ sysctl_kern_randompid(SYSCTL_HANDLER_ARGS) pid = randompid; error = sysctl_handle_int(oidp, &pid, 0, req); if (error == 0 && req->newptr != NULL) { - if (pid < 0 || pid > pid_max - 100) /* out of range */ - pid = pid_max - 100; - else if (pid < 2) /* NOP */ - pid = 0; - else if (pid < 100) /* Make it reasonable */ - pid = 100; - randompid = pid; + if (pid == 0) + randompid = 0; + else if (pid == 1) + /* generate a random PID modulus between 100 and 1123 */ + randompid = 100 + arc4random() % 1024; + else if (pid < 0 || pid > pid_max - 100) + /* out of range */ + randompid = pid_max - 100; + else if (pid < 100) + /* Make it reasonable */ + randompid = 100; + else + randompid = pid; } sx_xunlock(&allproc_lock); return (error); } SYSCTL_PROC(_kern, OID_AUTO, randompid, CTLTYPE_INT|CTLFLAG_RW, - 0, 0, sysctl_kern_randompid, "I", "Random PID modulus"); + 0, 0, sysctl_kern_randompid, "I", "Random PID modulus. Special values: 0: disable, 1: choose random value"); static int fork_findpid(int flags) From owner-svn-src-all@freebsd.org Sun Sep 10 15:07:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E224E15A71; Sun, 10 Sep 2017 15:07:58 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 45EFB7746C; Sun, 10 Sep 2017 15:07:57 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 35ED0D54A; Sun, 10 Sep 2017 15:07:51 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id B95AB9859; Sun, 10 Sep 2017 15:07:52 +0000 (UTC) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323390 - head/sys/kern References: <201709101501.v8AF1Tr4061705@repo.freebsd.org> Date: Sun, 10 Sep 2017 17:07:52 +0200 In-Reply-To: <201709101501.v8AF1Tr4061705@repo.freebsd.org> ("Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav=22's?= message of "Sun, 10 Sep 2017 15:01:29 +0000 (UTC)") Message-ID: <864lsa6187.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 15:07:58 -0000 Dag-Erling Sm=C3=B8rgrav writes: > Log: > If the user tries to set kern.randompid to 1 (which is meaningless), set > it to a random value between 100 and 1123, rather than 0 as before. >=20=20=20 > Submitted by: Marie Helene Kvello-Aune > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D5336 Sorry, the correct D# is https://reviews.freebsd.org/D12238 DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@freebsd.org Sun Sep 10 17:46:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16E6AE1DA7E; Sun, 10 Sep 2017 17:46:05 +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 E549580049; Sun, 10 Sep 2017 17:46:04 +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 v8AHk33f030737; Sun, 10 Sep 2017 17:46:03 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AHk3qv030733; Sun, 10 Sep 2017 17:46:03 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709101746.v8AHk3qv030733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 10 Sep 2017 17:46:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323391 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 323391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 17:46:05 -0000 Author: alc Date: Sun Sep 10 17:46:03 2017 New Revision: 323391 URL: https://svnweb.freebsd.org/changeset/base/323391 Log: To analyze the allocation of swap blocks by blist functions, add a method for analyzing the radix tree structures and reporting on the number, and sizes, of maximal intervals of free blocks. The report includes the number of maximal intervals, and also the number of them in each of several size ranges, from small (size 1, or 3 to 4) to large (28657 to 46367) with size boundaries defined by Fibonacci numbers. The report is written in the test tool with the 's' command, or in a running kernel by sysctl. The analysis of the radix tree frequently computes the position of the lone bit set in a u_daddr_t, a computation that also appears in leaf allocation. That computation has been moved into a function of its own, and optimized for cases where an inlined machine instruction can replace the usual binary search. Submitted by: Doug Moore MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11906 Modified: head/sys/kern/subr_blist.c head/sys/sys/blist.h head/sys/vm/swap_pager.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Sun Sep 10 15:01:29 2017 (r323390) +++ head/sys/kern/subr_blist.c Sun Sep 10 17:46:03 2017 (r323391) @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -101,6 +102,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -144,6 +146,7 @@ static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap space"); #endif CTASSERT(BLIST_BMAP_RADIX % BLIST_META_RADIX == 0); +#define BLIST_META_MASK (BLIST_META_RADIX - 1) /* * For a subtree that can represent the state of up to 'radix' blocks, the @@ -166,10 +169,38 @@ radix_to_skip(daddr_t radix) { return (radix / - ((BLIST_BMAP_RADIX / BLIST_META_RADIX) * (BLIST_META_RADIX - 1))); + ((BLIST_BMAP_RADIX / BLIST_META_RADIX) * BLIST_META_MASK)); } /* + * Use binary search, or a faster method, to find the 1 bit in a u_daddr_t. + * Assumes that the argument has only one bit set. + */ +static inline int +bitpos(u_daddr_t mask) +{ + int hi, lo, mid; + + switch (sizeof(mask)) { +#ifdef HAVE_INLINE_FFSLL + case sizeof(long long): + return (ffsll(mask) - 1); +#endif + default: + lo = 0; + hi = BLIST_BMAP_RADIX; + while (lo + 1 < hi) { + mid = (lo + hi) >> 1; + if ((mask >> mid) != 0) + lo = mid; + else + hi = mid; + } + return (lo); + } +} + +/* * blist_create() - create a blist capable of handling up to the specified * number of blocks * @@ -340,6 +371,192 @@ blist_print(blist_t bl) #endif +static const u_daddr_t fib[] = { + 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, + 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, + 514229, 832040, 1346269, 2178309, 3524578, +}; + +/* + * Use 'gap' to describe a maximal range of unallocated blocks/bits. + */ +struct gap_stats { + daddr_t start; /* current gap start, or SWAPBLK_NONE */ + daddr_t num; /* number of gaps observed */ + daddr_t max; /* largest gap size */ + daddr_t avg; /* average gap size */ + daddr_t err; /* sum - num * avg */ + daddr_t histo[nitems(fib)]; /* # gaps in each size range */ + int max_bucket; /* last histo elt with nonzero val */ +}; + +/* + * gap_stats_counting() - is the state 'counting 1 bits'? + * or 'skipping 0 bits'? + */ +static inline bool +gap_stats_counting(const struct gap_stats *stats) +{ + + return (stats->start != SWAPBLK_NONE); +} + +/* + * init_gap_stats() - initialize stats on gap sizes + */ +static inline void +init_gap_stats(struct gap_stats *stats) +{ + + bzero(stats, sizeof(*stats)); + stats->start = SWAPBLK_NONE; +} + +/* + * update_gap_stats() - update stats on gap sizes + */ +static void +update_gap_stats(struct gap_stats *stats, daddr_t posn) +{ + daddr_t size; + int hi, lo, mid; + + if (!gap_stats_counting(stats)) { + stats->start = posn; + return; + } + size = posn - stats->start; + stats->start = SWAPBLK_NONE; + if (size > stats->max) + stats->max = size; + + /* + * Find the fibonacci range that contains size, + * expecting to find it in an early range. + */ + lo = 0; + hi = 1; + while (hi < nitems(fib) && fib[hi] <= size) { + lo = hi; + hi *= 2; + } + if (hi >= nitems(fib)) + hi = nitems(fib); + while (lo + 1 != hi) { + mid = (lo + hi) >> 1; + if (fib[mid] <= size) + lo = mid; + else + hi = mid; + } + stats->histo[lo]++; + if (lo > stats->max_bucket) + stats->max_bucket = lo; + stats->err += size - stats->avg; + stats->num++; + stats->avg += stats->err / stats->num; + stats->err %= stats->num; +} + +/* + * dump_gap_stats() - print stats on gap sizes + */ +static inline void +dump_gap_stats(const struct gap_stats *stats, struct sbuf *s) +{ + int i; + + sbuf_printf(s, "number of maximal free ranges: %jd\n", + (intmax_t)stats->num); + sbuf_printf(s, "largest free range: %jd\n", (intmax_t)stats->max); + sbuf_printf(s, "average maximal free range size: %jd\n", + (intmax_t)stats->avg); + sbuf_printf(s, "number of maximal free ranges of different sizes:\n"); + sbuf_printf(s, " count | size range\n"); + sbuf_printf(s, " ----- | ----------\n"); + for (i = 0; i < stats->max_bucket; i++) { + if (stats->histo[i] != 0) { + sbuf_printf(s, "%20jd | ", + (intmax_t)stats->histo[i]); + if (fib[i] != fib[i + 1] - 1) + sbuf_printf(s, "%jd to %jd\n", (intmax_t)fib[i], + (intmax_t)fib[i + 1] - 1); + else + sbuf_printf(s, "%jd\n", (intmax_t)fib[i]); + } + } + sbuf_printf(s, "%20jd | ", (intmax_t)stats->histo[i]); + if (stats->histo[i] > 1) + sbuf_printf(s, "%jd to %jd\n", (intmax_t)fib[i], + (intmax_t)stats->max); + else + sbuf_printf(s, "%jd\n", (intmax_t)stats->max); +} + +/* + * blist_stats() - dump radix tree stats + */ +void +blist_stats(blist_t bl, struct sbuf *s) +{ + struct gap_stats gstats; + struct gap_stats *stats = &gstats; + daddr_t i, nodes, radix; + u_daddr_t bit, diff, mask; + + init_gap_stats(stats); + nodes = 0; + i = bl->bl_radix; + while (i < bl->bl_radix + bl->bl_blocks) { + /* + * Find max size subtree starting at i. + */ + radix = BLIST_BMAP_RADIX; + while (((i / radix) & BLIST_META_MASK) == 0) + radix *= BLIST_META_RADIX; + + /* + * Check for skippable subtrees starting at i. + */ + while (radix > BLIST_BMAP_RADIX) { + if (bl->bl_root[nodes].u.bmu_avail == 0) { + if (gap_stats_counting(stats)) + update_gap_stats(stats, i); + break; + } + if (bl->bl_root[nodes].u.bmu_avail == radix) { + if (!gap_stats_counting(stats)) + update_gap_stats(stats, i); + break; + } + + /* + * Skip subtree root. + */ + nodes++; + radix /= BLIST_META_RADIX; + } + if (radix == BLIST_BMAP_RADIX) { + /* + * Scan leaf. + */ + mask = bl->bl_root[nodes].u.bmu_bitmap; + diff = mask ^ (mask << 1); + if (gap_stats_counting(stats)) + diff ^= 1; + while (diff != 0) { + bit = diff & -diff; + update_gap_stats(stats, i + bitpos(bit)); + diff ^= bit; + } + } + nodes += radix_to_skip(radix); + i += radix; + } + update_gap_stats(stats, i); + dump_gap_stats(stats, s); +} + /************************************************************************ * ALLOCATION SUPPORT FUNCTIONS * ************************************************************************ @@ -355,13 +572,13 @@ blist_print(blist_t bl) * * This is the core of the allocator and is optimized for the * BLIST_BMAP_RADIX block allocation case. Otherwise, execution - * time is proportional to log2(count) + log2(BLIST_BMAP_RADIX). + * time is proportional to log2(count) + bitpos time. */ static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, daddr_t cursor) { u_daddr_t mask; - int count1, hi, lo, mid, num_shifts, range1, range_ext; + int count1, lo, num_shifts, range1, range_ext; if (count == BLIST_BMAP_RADIX) { /* @@ -419,17 +636,10 @@ blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count /* * The least significant set bit in mask marks the start of the first * available range of sufficient size. Clear all the bits but that one, - * and then perform a binary search to find its position. + * and then find its position. */ mask &= -mask; - hi = BLIST_BMAP_RADIX - count1; - while (lo + 1 < hi) { - mid = (lo + hi) >> 1; - if ((mask >> mid) != 0) - lo = mid; - else - hi = mid; - } + lo = bitpos(mask); /* * Set in mask exactly the bits being allocated, and clear them from @@ -980,6 +1190,7 @@ main(int ac, char **av) int size = 1024; int i; blist_t bl; + struct sbuf *s; for (i = 1; i < ac; ++i) { const char *ptr = av[i]; @@ -1014,6 +1225,13 @@ main(int ac, char **av) case 'p': blist_print(bl); break; + case 's': + s = sbuf_new_auto(); + blist_stats(bl, s); + sbuf_finish(s); + printf("%s", sbuf_data(s)); + sbuf_delete(s); + break; case 'a': if (sscanf(buf + 1, "%lld", &count) == 1) { daddr_t blk = blist_alloc(bl, count); @@ -1041,6 +1259,7 @@ main(int ac, char **av) case 'h': puts( "p -print\n" + "s -stats\n" "a %d -allocate\n" "f %x %d -free\n" "l %x %d -fill\n" Modified: head/sys/sys/blist.h ============================================================================== --- head/sys/sys/blist.h Sun Sep 10 15:01:29 2017 (r323390) +++ head/sys/sys/blist.h Sun Sep 10 17:46:03 2017 (r323391) @@ -90,6 +90,8 @@ typedef struct blist { #define BLIST_MAX_ALLOC BLIST_BMAP_RADIX +struct sbuf; + daddr_t blist_alloc(blist_t blist, daddr_t count); daddr_t blist_avail(blist_t blist); blist_t blist_create(daddr_t blocks, int flags); @@ -98,6 +100,7 @@ daddr_t blist_fill(blist_t bl, daddr_t blkno, daddr_t void blist_free(blist_t blist, daddr_t blkno, daddr_t count); void blist_print(blist_t blist); void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags); +void blist_stats(blist_t blist, struct sbuf *s); #endif /* _SYS_BLIST_H_ */ Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Sep 10 15:01:29 2017 (r323390) +++ head/sys/vm/swap_pager.c Sun Sep 10 17:46:03 2017 (r323391) @@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -323,6 +324,10 @@ static int sysctl_swap_async_max(SYSCTL_HANDLER_ARGS); SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, sysctl_swap_async_max, "I", "Maximum running async swap ops"); +static int sysctl_swap_fragmentation(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vm, OID_AUTO, swap_fragmentation, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_MPSAFE, NULL, 0, sysctl_swap_fragmentation, "A", + "Swap Fragmentation Info"); static struct sx sw_alloc_sx; @@ -777,6 +782,36 @@ swp_pager_freeswapspace(daddr_t blk, int npages) } } panic("Swapdev not found"); +} + +/* + * SYSCTL_SWAP_FRAGMENTATION() - produce raw swap space stats + */ +static int +sysctl_swap_fragmentation(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sbuf; + struct swdevt *sp; + const char *devname; + int error; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + mtx_lock(&sw_dev_mtx); + TAILQ_FOREACH(sp, &swtailq, sw_list) { + if (vn_isdisk(sp->sw_vp, NULL)) + devname = devtoname(sp->sw_vp->v_rdev); + else + devname = "[file]"; + sbuf_printf(&sbuf, "\nFree space on device %s:\n", devname); + blist_stats(sp->sw_blist, &sbuf); + } + mtx_unlock(&sw_dev_mtx); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + return (error); } /* From owner-svn-src-all@freebsd.org Sun Sep 10 18:08:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B4E6E1EB5E; Sun, 10 Sep 2017 18:08: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 EC1F480B26; Sun, 10 Sep 2017 18:08:26 +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 v8AI8Qov039100; Sun, 10 Sep 2017 18:08:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AI8Pm9039095; Sun, 10 Sep 2017 18:08:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709101808.v8AI8Pm9039095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 18:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323392 - in head/sys: arm/allwinner arm/freescale/imx dev/gpio sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/allwinner arm/freescale/imx dev/gpio sys X-SVN-Commit-Revision: 323392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 18:08:27 -0000 Author: ian Date: Sun Sep 10 18:08:25 2017 New Revision: 323392 URL: https://svnweb.freebsd.org/changeset/base/323392 Log: Add gpio methods to read/write/configure up to 32 pins simultaneously. Sometimes it is necessary to combine several gpio pins into an ad-hoc bus and manipulate the pins as a group. In such cases manipulating the pins individualy is not an option, because the value on the "bus" assumes potentially-invalid intermediate values as each pin is changed in turn. Note that the "bus" may be something as simple as a bi-color LED where changing colors requires changing both gpio pins at once, or something as complex as a bitbanged multiplexed address/data bus connected to a microcontroller. In addition to the absolute requirement of simultaneously changing the output values of driven pins, a desirable feature of these new methods is to provide a higher-performance mechanism for reading and writing multiple pins, especially from userland where pin-at-a-time access incurs a noticible syscall time penalty. These new interfaces are NOT intended to abstract away all the ugly details of how gpio is implemented on any given platform. In fact, to use these properly you absolutely must know something about how the gpio hardware is organized. Typically there are "banks" of gpio pins controlled by registers which group several pins together. A bank may be as small as 2 pins or as big as "all the pins on the device, hundreds of them." In the latter case, a driver might support this interface by allowing access to any 32 adjacent pins within the overall collection. Or, more likely, any 32 adjacent pins starting at any multiple of 32. Whatever the hardware restrictions may be, you would need to understand them to use this interface. In additional to defining the interfaces, two example implementations are included here, for imx5/6, and allwinner. These represent the two primary types of gpio hardware drivers. imx6 has multiple gpio devices, each implementing a single bank of 32 pins. Allwinner implements a single large gpio number space from 1-n pins, and the driver internally translates that linear number space to a bank+pin scheme based on how the pins are grouped into control registers. The allwinner implementation imposes the restriction that the first_pin argument to the new functions must always be pin 0 of a bank. Differential Revision: https://reviews.freebsd.org/D11810 Modified: head/sys/arm/allwinner/a10_gpio.c head/sys/arm/freescale/imx/imx_gpio.c head/sys/dev/gpio/gpio_if.m head/sys/dev/gpio/gpioc.c head/sys/sys/gpio.h Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Sun Sep 10 17:46:03 2017 (r323391) +++ head/sys/arm/allwinner/a10_gpio.c Sun Sep 10 18:08:25 2017 (r323392) @@ -195,6 +195,9 @@ struct a10_gpio_softc { #define A10_GPIO_GP_INT_STA 0x214 #define A10_GPIO_GP_INT_DEB 0x218 +static int a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value); +static int a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value); + #define A10_GPIO_WRITE(_sc, _off, _val) \ bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) #define A10_GPIO_READ(_sc, _off) \ @@ -316,29 +319,44 @@ a10_gpio_set_drv(struct a10_gpio_softc *sc, uint32_t p static int a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags) { + u_int val; int err = 0; /* Must be called with lock held. */ A10_GPIO_LOCK_ASSERT(sc); + if (pin > sc->padconf->npins) + return (EINVAL); + /* Manage input/output. */ - if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - if (flags & GPIO_PIN_OUTPUT) - err = a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT); - else + if (flags & GPIO_PIN_INPUT) { + err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT); + } else if (flags & GPIO_PIN_OUTPUT) { + if (flags & GPIO_PIN_PRESET_LOW) { + a10_gpio_pin_set(sc->sc_dev, pin, 0); + } else if (flags & GPIO_PIN_PRESET_HIGH) { + a10_gpio_pin_set(sc->sc_dev, pin, 1); + } else { + /* Read the pin and preset output to current state. */ err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT); + if (err == 0) { + a10_gpio_pin_get(sc->sc_dev, pin, &val); + a10_gpio_pin_set(sc->sc_dev, pin, val); + } + } + if (err == 0) + err = a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT); } if (err) return (err); /* Manage Pull-up/pull-down. */ - if (flags & (GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)) { - if (flags & GPIO_PIN_PULLUP) - a10_gpio_set_pud(sc, pin, A10_GPIO_PULLUP); - else - a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN); - } else + if (flags & GPIO_PIN_PULLUP) + a10_gpio_set_pud(sc, pin, A10_GPIO_PULLUP); + else if (flags & GPIO_PIN_PULLDOWN) + a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN); + else a10_gpio_set_pud(sc, pin, A10_GPIO_NONE); return (0); @@ -526,6 +544,73 @@ a10_gpio_pin_toggle(device_t dev, uint32_t pin) } static int +a10_gpio_pin_access_32(device_t dev, uint32_t first_pin, uint32_t clear_pins, + uint32_t change_pins, uint32_t *orig_pins) +{ + struct a10_gpio_softc *sc; + uint32_t bank, data, pin; + + sc = device_get_softc(dev); + if (first_pin > sc->padconf->npins) + return (EINVAL); + + /* + * We require that first_pin refers to the first pin in a bank, because + * this API is not about convenience, it's for making a set of pins + * change simultaneously (required) with reasonably high performance + * (desired); we need to do a read-modify-write on a single register. + */ + bank = sc->padconf->pins[first_pin].port; + pin = sc->padconf->pins[first_pin].pin; + if (pin != 0) + return (EINVAL); + + A10_GPIO_LOCK(sc); + data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank)); + if ((clear_pins | change_pins) != 0) + A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), + (data & ~clear_pins) ^ change_pins); + A10_GPIO_UNLOCK(sc); + + if (orig_pins != NULL) + *orig_pins = data; + + return (0); +} + +static int +a10_gpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, + uint32_t *pin_flags) +{ + struct a10_gpio_softc *sc; + uint32_t bank, pin; + int err; + + sc = device_get_softc(dev); + if (first_pin > sc->padconf->npins) + return (EINVAL); + + bank = sc->padconf->pins[first_pin].port; + if (sc->padconf->pins[first_pin].pin != 0) + return (EINVAL); + + /* + * The configuration for a bank of pins is scattered among several + * registers; we cannot g'tee to simultaneously change the state of all + * the pins in the flags array. So just loop through the array + * configuring each pin for now. If there was a strong need, it might + * be possible to support some limited simultaneous config, such as + * adjacent groups of 8 pins that line up the same as the config regs. + */ + for (err = 0, pin = first_pin; err == 0 && pin < num_pins; ++pin) { + if (pin_flags[pin] & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) + err = a10_gpio_pin_configure(sc, pin, pin_flags[pin]); + } + + return (err); +} + +static int aw_find_pinnum_by_name(struct a10_gpio_softc *sc, const char *pinname) { int i; @@ -780,6 +865,8 @@ static device_method_t a10_gpio_methods[] = { DEVMETHOD(gpio_pin_get, a10_gpio_pin_get), DEVMETHOD(gpio_pin_set, a10_gpio_pin_set), DEVMETHOD(gpio_pin_toggle, a10_gpio_pin_toggle), + DEVMETHOD(gpio_pin_access_32, a10_gpio_pin_access_32), + DEVMETHOD(gpio_pin_config_32, a10_gpio_pin_config_32), DEVMETHOD(gpio_map_gpios, a10_gpio_map_gpios), /* ofw_bus interface */ Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Sun Sep 10 17:46:03 2017 (r323391) +++ head/sys/arm/freescale/imx/imx_gpio.c Sun Sep 10 18:08:25 2017 (r323392) @@ -668,6 +668,72 @@ imx51_gpio_pin_toggle(device_t dev, uint32_t pin) } static int +imx51_gpio_pin_access_32(device_t dev, uint32_t first_pin, uint32_t clear_pins, + uint32_t change_pins, uint32_t *orig_pins) +{ + struct imx51_gpio_softc *sc; + + if (first_pin != 0) + return (EINVAL); + + sc = device_get_softc(dev); + + if (orig_pins != NULL) + *orig_pins = READ4(sc, IMX_GPIO_PSR_REG); + + if ((clear_pins | change_pins) != 0) { + mtx_lock_spin(&sc->sc_mtx); + WRITE4(sc, IMX_GPIO_DR_REG, + (READ4(sc, IMX_GPIO_DR_REG) & ~clear_pins) ^ change_pins); + mtx_unlock_spin(&sc->sc_mtx); + } + + return (0); +} + +static int +imx51_gpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, + uint32_t *pin_flags) +{ + struct imx51_gpio_softc *sc; + u_int i; + uint32_t bit, drclr, drset, flags, oeclr, oeset, pads; + + sc = device_get_softc(dev); + + if (first_pin != 0 || num_pins > sc->gpio_npins) + return (EINVAL); + + drclr = drset = oeclr = oeset = 0; + pads = READ4(sc, IMX_GPIO_PSR_REG); + + for (i = 0; i < num_pins; ++i) { + bit = 1u << i; + flags = pin_flags[i]; + if (flags & GPIO_PIN_INPUT) { + oeclr |= bit; + } else if (flags & GPIO_PIN_OUTPUT) { + oeset |= bit; + if (flags & GPIO_PIN_PRESET_LOW) + drclr |= bit; + else if (flags & GPIO_PIN_PRESET_HIGH) + drset |= bit; + else /* Drive whatever it's now pulled to. */ + drset |= pads & bit; + } + } + + mtx_lock_spin(&sc->sc_mtx); + WRITE4(sc, IMX_GPIO_DR_REG, + (READ4(sc, IMX_GPIO_DR_REG) & ~drclr) | drset); + WRITE4(sc, IMX_GPIO_OE_REG, + (READ4(sc, IMX_GPIO_OE_REG) & ~oeclr) | oeset); + mtx_unlock_spin(&sc->sc_mtx); + + return (0); +} + +static int imx51_gpio_probe(device_t dev) { @@ -790,6 +856,8 @@ static device_method_t imx51_gpio_methods[] = { DEVMETHOD(gpio_pin_get, imx51_gpio_pin_get), DEVMETHOD(gpio_pin_set, imx51_gpio_pin_set), DEVMETHOD(gpio_pin_toggle, imx51_gpio_pin_toggle), + DEVMETHOD(gpio_pin_access_32, imx51_gpio_pin_access_32), + DEVMETHOD(gpio_pin_config_32, imx51_gpio_pin_config_32), {0, 0}, }; Modified: head/sys/dev/gpio/gpio_if.m ============================================================================== --- head/sys/dev/gpio/gpio_if.m Sun Sep 10 17:46:03 2017 (r323391) +++ head/sys/dev/gpio/gpio_if.m Sun Sep 10 18:08:25 2017 (r323392) @@ -40,6 +40,13 @@ CODE { } static int + gpio_default_nosupport(void) + { + + return (EOPNOTSUPP); + } + + static int gpio_default_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, pcell_t *gpios, uint32_t *pin, uint32_t *flags) @@ -151,3 +158,31 @@ METHOD int map_gpios { uint32_t *pin; uint32_t *flags; } DEFAULT gpio_default_map_gpios; + +# +# Simultaneously read and/or change up to 32 adjacent pins. +# If the device cannot change the pins simultaneously, returns EOPNOTSUPP. +# +# More details about using this interface can be found in sys/gpio.h +# +METHOD int pin_access_32 { + device_t dev; + uint32_t first_pin; + uint32_t clear_pins; + uint32_t change_pins; + uint32_t *orig_pins; +} DEFAULT gpio_default_nosupport; + +# +# Simultaneously configure up to 32 adjacent pins. +# This is intended to change the configuration of all the pins simultaneously, +# but unlike pin_access_32, this will not fail if the hardware can't do so. +# +# More details about using this interface can be found in sys/gpio.h +# +METHOD int pin_config_32 { + device_t dev; + uint32_t first_pin; + uint32_t num_pins; + uint32_t *pin_flags; +} DEFAULT gpio_default_nosupport; Modified: head/sys/dev/gpio/gpioc.c ============================================================================== --- head/sys/dev/gpio/gpioc.c Sun Sep 10 17:46:03 2017 (r323391) +++ head/sys/dev/gpio/gpioc.c Sun Sep 10 18:08:25 2017 (r323392) @@ -125,6 +125,8 @@ gpioc_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg struct gpioc_softc *sc = cdev->si_drv1; struct gpio_pin pin; struct gpio_req req; + struct gpio_access_32 *a32; + struct gpio_config_32 *c32; uint32_t caps; bus = GPIO_GET_BUS(sc->sc_pdev); @@ -184,6 +186,16 @@ gpioc_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg dprintf("set name on pin %d\n", pin.gp_pin); res = GPIOBUS_PIN_SETNAME(bus, pin.gp_pin, pin.gp_name); + break; + case GPIOACCESS32: + a32 = (struct gpio_access_32 *)arg; + res = GPIO_PIN_ACCESS_32(sc->sc_pdev, a32->first_pin, + a32->clear_pins, a32->orig_pins, &a32->orig_pins); + break; + case GPIOCONFIG32: + c32 = (struct gpio_config_32 *)arg; + res = GPIO_PIN_CONFIG_32(sc->sc_pdev, c32->first_pin, + c32->num_pins, c32->pin_flags); break; default: return (ENOTTY); Modified: head/sys/sys/gpio.h ============================================================================== --- head/sys/sys/gpio.h Sun Sep 10 17:46:03 2017 (r323391) +++ head/sys/sys/gpio.h Sun Sep 10 18:08:25 2017 (r323392) @@ -70,6 +70,8 @@ #define GPIO_PIN_INVIN 0x00000080 /* invert input */ #define GPIO_PIN_INVOUT 0x00000100 /* invert output */ #define GPIO_PIN_PULSATE 0x00000200 /* pulsate in hardware */ +#define GPIO_PIN_PRESET_LOW 0x00000400 /* preset pin to high or */ +#define GPIO_PIN_PRESET_HIGH 0x00000800 /* low before enabling output */ /* GPIO interrupt capabilities */ #define GPIO_INTR_NONE 0x00000000 /* no interrupt support */ #define GPIO_INTR_LEVEL_LOW 0x00010000 /* level trigger, low */ @@ -95,6 +97,71 @@ struct gpio_req { }; /* + * gpio_access_32 / GPIOACCESS32 + * + * Simultaneously read and/or change up to 32 adjacent pins. + * If the device cannot change the pins simultaneously, returns EOPNOTSUPP. + * + * This accesses an adjacent set of up to 32 pins starting at first_pin within + * the device's collection of pins. How the hardware pins are mapped to the 32 + * bits in the arguments is device-specific. It is expected that lower-numbered + * pins in the device's number space map linearly to lower-ordered bits within + * the 32-bit words (i.e., bit 0 is first_pin, bit 1 is first_pin+1, etc). + * Other mappings are possible; know your device. + * + * Some devices may limit the value of first_pin to 0, or to multiples of 16 or + * 32 or some other hardware-specific number; to access pin 2 would require + * first_pin to be zero and then manipulate bit (1 << 2) in the 32-bit word. + * Invalid values in first_pin result in an EINVAL error return. + * + * The starting state of the pins is captured and stored in orig_pins, then the + * pins are set to ((starting_state & ~clear_pins) ^ change_pins). + * + * Clear Change Hardware pin after call + * 0 0 No change + * 0 1 Opposite of current value + * 1 0 Cleared + * 1 1 Set + */ +struct gpio_access_32 { + uint32_t first_pin; /* First pin in group of 32 adjacent */ + uint32_t clear_pins; /* Pins are changed using: */ + uint32_t change_pins; /* ((hwstate & ~clear_pins) ^ change_pins) */ + uint32_t orig_pins; /* Returned hwstate of pins before change. */ +}; + +/* + * gpio_config_32 / GPIOCONFIG32 + * + * Simultaneously configure up to 32 adjacent pins. This is intended to change + * the configuration of all the pins simultaneously, such that pins configured + * for output all begin to drive the configured values simultaneously, but not + * all hardware can do that, so the driver "does the best it can" in this + * regard. Notably unlike pin_access_32(), this does NOT fail if the pins + * cannot be atomically configured; it is expected that callers understand the + * hardware and have decided to live with any such limitations it may have. + * + * The pin_flags argument is an array of GPIO_PIN_xxxx flags. If the array + * contains any GPIO_PIN_OUTPUT flags, the driver will manipulate the hardware + * such that all output pins become driven with the proper initial values + * simultaneously if it can. The elements in the array map to pins in the same + * way that bits are mapped by pin_acces_32(), and the same restrictions may + * apply. For example, to configure pins 2 and 3 it may be necessary to set + * first_pin to zero and only populate pin_flags[2] and pin_flags[3]. If a + * given array entry doesn't contain GPIO_PIN_INPUT or GPIO_PIN_OUTPUT then no + * configuration is done for that pin. + * + * Some devices may limit the value of first_pin to 0, or to multiples of 16 or + * 32 or some other hardware-specific number. Invalid values in first_pin or + * num_pins result in an error return with errno set to EINVAL. + */ +struct gpio_config_32 { + uint32_t first_pin; + uint32_t num_pins; + uint32_t pin_flags[32]; +}; + +/* * ioctls */ #define GPIOMAXPIN _IOR('G', 0, int) @@ -104,5 +171,7 @@ struct gpio_req { #define GPIOSET _IOW('G', 4, struct gpio_req) #define GPIOTOGGLE _IOWR('G', 5, struct gpio_req) #define GPIOSETNAME _IOW('G', 6, struct gpio_pin) +#define GPIOACCESS32 _IOWR('G', 7, struct gpio_access_32) +#define GPIOCONFIG32 _IOW('G', 8, struct gpio_config_32) #endif /* __GPIO_H__ */ From owner-svn-src-all@freebsd.org Sun Sep 10 19:00:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C210E217EB; Sun, 10 Sep 2017 19:00:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B398826A8; Sun, 10 Sep 2017 19:00:39 +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 v8AJ0cUE059847; Sun, 10 Sep 2017 19:00:38 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AJ0c2N059845; Sun, 10 Sep 2017 19:00:38 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709101900.v8AJ0c2N059845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 10 Sep 2017 19:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323393 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 323393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 19:00:39 -0000 Author: mjg Date: Sun Sep 10 19:00:38 2017 New Revision: 323393 URL: https://svnweb.freebsd.org/changeset/base/323393 Log: Move vmmeter atomic counters into dedicated cache lines Prior to the change they were subject to extreme false sharing. In particular this change shaves about 3 seconds real time of -j 80 buildkernel. Reviewed by: alc, markj Differential Revision: https://reviews.freebsd.org/D12281 Modified: head/sys/sys/vmmeter.h head/sys/vm/vm_meter.c Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Sun Sep 10 18:08:25 2017 (r323392) +++ head/sys/sys/vmmeter.h Sun Sep 10 19:00:38 2017 (r323393) @@ -60,6 +60,12 @@ struct vmtotal { #if defined(_KERNEL) || defined(_WANT_VMMETER) #include +#ifdef _KERNEL +#define VMMETER_ALIGNED __aligned(CACHE_LINE_SIZE) +#else +#define VMMETER_ALIGNED +#endif + /* * System wide statistics counters. * Locking: @@ -126,14 +132,15 @@ struct vmmeter { u_int v_free_target; /* (c) pages desired free */ u_int v_free_min; /* (c) pages desired free */ u_int v_free_count; /* (f) pages free */ - u_int v_wire_count; /* (a) pages wired down */ - u_int v_active_count; /* (q) pages active */ u_int v_inactive_target; /* (c) pages desired inactive */ - u_int v_inactive_count; /* (q) pages inactive */ - u_int v_laundry_count; /* (q) pages eligible for laundering */ u_int v_pageout_free_min; /* (c) min pages reserved for kernel */ u_int v_interrupt_free_min; /* (c) reserved pages for int code */ u_int v_free_severe; /* (c) severe page depletion point */ + u_int v_wire_count VMMETER_ALIGNED; /* (a) pages wired down */ + u_int v_active_count VMMETER_ALIGNED; /* (a) pages active */ + u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */ + u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for + laundering */ }; #endif /* _KERNEL || _WANT_VMMETER */ Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Sun Sep 10 18:08:25 2017 (r323392) +++ head/sys/vm/vm_meter.c Sun Sep 10 19:00:38 2017 (r323393) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include -struct vmmeter vm_cnt = { +struct vmmeter __exclusive_cache_line vm_cnt = { .v_swtch = EARLY_COUNTER, .v_trap = EARLY_COUNTER, .v_syscall = EARLY_COUNTER, From owner-svn-src-all@freebsd.org Sun Sep 10 19:12:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0134E221A6; Sun, 10 Sep 2017 19:12:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E2AB83027; Sun, 10 Sep 2017 19:12:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8AJC1KN064823; Sun, 10 Sep 2017 19:12:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AJC16k064822; Sun, 10 Sep 2017 19:12:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709101912.v8AJC16k064822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 10 Sep 2017 19:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323394 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 323394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 19:12:02 -0000 Author: emaste Date: Sun Sep 10 19:12:01 2017 New Revision: 323394 URL: https://svnweb.freebsd.org/changeset/base/323394 Log: newvers.sh: accept "git-svn-id:" at the start of a line only This prevents incorrect subversion revision detection when "git svn" is not being used to get the sources but git is available. Previously old subversion revisions included in commit messages were favoured over the more recent and correct revisions in git notes. For example cf1f35574722 represents r315395 but was treated as r313908 which is referenced in the commit message. Commits following r315395/cf1f35574722 but before another commit with a git-svn-id reference in the commit message would be treated as r313908 as well. Patch from PR updated to accommodate the initial four space indent in `git log` ouptut. PR: 221848 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 2 weeks Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Sun Sep 10 19:00:38 2017 (r323393) +++ head/sys/conf/newvers.sh Sun Sep 10 19:12:01 2017 (r323394) @@ -218,7 +218,7 @@ if [ -n "$git_cmd" ] ; then svn=" r${svn}" git="=${git}" else - svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \ + svn=`$git_cmd log | grep '^ git-svn-id:' | head -1 | \ sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` if [ -z "$svn" ] ; then svn=`$git_cmd log --format='format:%N' | \ From owner-svn-src-all@freebsd.org Sun Sep 10 20:13:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1DB6E00182; Sun, 10 Sep 2017 20:13:21 +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 BEC2984DA0; Sun, 10 Sep 2017 20:13:21 +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 v8AKDKq0092364; Sun, 10 Sep 2017 20:13:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AKDKsO092362; Sun, 10 Sep 2017 20:13:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102013.v8AKDKsO092362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 20:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323395 - stable/11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/share/man/man9 X-SVN-Commit-Revision: 323395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 20:13:22 -0000 Author: ian Date: Sun Sep 10 20:13:20 2017 New Revision: 323395 URL: https://svnweb.freebsd.org/changeset/base/323395 Log: MFC r315089: Document uiomove_frombuf(9). Modified: stable/11/share/man/man9/Makefile stable/11/share/man/man9/uio.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sun Sep 10 19:12:01 2017 (r323394) +++ stable/11/share/man/man9/Makefile Sun Sep 10 20:13:20 2017 (r323395) @@ -1791,6 +1791,7 @@ MLINKS+=uidinfo.9 uifind.9 \ uidinfo.9 uihashinit.9 \ uidinfo.9 uihold.9 MLINKS+=uio.9 uiomove.9 \ + uio.9 uiomove_frombuf.9 \ uio.9 uiomove_nofault.9 .if ${MK_USB} != "no" Modified: stable/11/share/man/man9/uio.9 ============================================================================== --- stable/11/share/man/man9/uio.9 Sun Sep 10 19:12:01 2017 (r323394) +++ stable/11/share/man/man9/uio.9 Sun Sep 10 20:13:20 2017 (r323395) @@ -25,12 +25,13 @@ .\" .\" $FreeBSD$ .\" -.Dd January 19, 2012 +.Dd March 11, 2017 .Dt UIO 9 .Os .Sh NAME .Nm uio , .Nm uiomove , +.Nm uiomove_frombuf , .Nm uiomove_nofault .Nd device driver I/O routines .Sh SYNOPSIS @@ -50,10 +51,13 @@ struct uio { .Ft int .Fn uiomove "void *buf" "int howmuch" "struct uio *uiop" .Ft int +.Fn uiomove_frombuf "void *buf" "int howmuch" "struct uio *uiop" +.Ft int .Fn uiomove_nofault "void *buf" "int howmuch" "struct uio *uiop" .Sh DESCRIPTION The functions -.Fn uiomove +.Fn uiomove , +.Fn uiomove_frombuf , and .Fn uiomove_nofault are used to transfer data between buffers and I/O vectors that might @@ -129,9 +133,27 @@ Thus, the function .Fn uiomove_nofault can be called from contexts where acquiring virtual memory system locks or sleeping are prohibited. +.Pp +The +.Fn uiomove_frombuf +function is a convenience wrapper around +.Fn uiomove +for drivers that serve data which is wholly contained within an +existing buffer in memory. +It validates the +.Va uio_offset +and +.Va uio_resid +values against the size of the existing buffer, handling short +transfers when the request partially overlaps the buffer. +When +.Va uio_offset +is greater than or equal to the buffer size, the result is success +with no bytes transfered, effectively signaling EOF. .Sh RETURN VALUES On success -.Fn uiomove +.Fn uiomove , +.Fn uiomove_frombuf , and .Fn uiomove_nofault will return 0; on error they will return an appropriate error code. From owner-svn-src-all@freebsd.org Sun Sep 10 20:16:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD0F7E00449; Sun, 10 Sep 2017 20:16:36 +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 A99FF1EE; Sun, 10 Sep 2017 20:16:36 +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 v8AKGZjR092519; Sun, 10 Sep 2017 20:16:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AKGZuG092518; Sun, 10 Sep 2017 20:16:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102016.v8AKGZuG092518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 20:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323396 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 323396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 20:16:37 -0000 Author: ian Date: Sun Sep 10 20:16:35 2017 New Revision: 323396 URL: https://svnweb.freebsd.org/changeset/base/323396 Log: MFC r315165: Correct the abbreviations for microseconds (us, not ms), and for Hz (not HZ). Modified: stable/11/sys/kern/vfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Sun Sep 10 20:13:20 2017 (r323395) +++ stable/11/sys/kern/vfs_subr.c Sun Sep 10 20:16:35 2017 (r323396) @@ -763,7 +763,7 @@ enum { TSP_SEC, TSP_HZ, TSP_USEC, TSP_NSEC }; static int timestamp_precision = TSP_USEC; SYSCTL_INT(_vfs, OID_AUTO, timestamp_precision, CTLFLAG_RW, ×tamp_precision, 0, "File timestamp precision (0: seconds, " - "1: sec + ns accurate to 1/HZ, 2: sec + ns truncated to ms, " + "1: sec + ns accurate to 1/Hz, 2: sec + ns truncated to us, " "3+: sec + ns (max. precision))"); /* From owner-svn-src-all@freebsd.org Sun Sep 10 20:17:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF9B7E004F7; Sun, 10 Sep 2017 20:17:32 +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 894583EE; Sun, 10 Sep 2017 20:17:32 +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 v8AKHVFO092591; Sun, 10 Sep 2017 20:17:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AKHVrK092590; Sun, 10 Sep 2017 20:17:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102017.v8AKHVrK092590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 20:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323397 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 323397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 20:17:32 -0000 Author: ian Date: Sun Sep 10 20:17:31 2017 New Revision: 323397 URL: https://svnweb.freebsd.org/changeset/base/323397 Log: MFC r315167: Change 'Hz' back to 'HZ'... it's referring to the kernel config option Modified: stable/11/sys/kern/vfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Sun Sep 10 20:16:35 2017 (r323396) +++ stable/11/sys/kern/vfs_subr.c Sun Sep 10 20:17:31 2017 (r323397) @@ -763,7 +763,7 @@ enum { TSP_SEC, TSP_HZ, TSP_USEC, TSP_NSEC }; static int timestamp_precision = TSP_USEC; SYSCTL_INT(_vfs, OID_AUTO, timestamp_precision, CTLFLAG_RW, ×tamp_precision, 0, "File timestamp precision (0: seconds, " - "1: sec + ns accurate to 1/Hz, 2: sec + ns truncated to us, " + "1: sec + ns accurate to 1/HZ, 2: sec + ns truncated to us, " "3+: sec + ns (max. precision))"); /* From owner-svn-src-all@freebsd.org Sun Sep 10 20:33:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1926E01482; Sun, 10 Sep 2017 20:33:24 +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 97D97FFA; Sun, 10 Sep 2017 20:33:24 +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 v8AKXNEs000610; Sun, 10 Sep 2017 20:33:23 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AKXNg0000608; Sun, 10 Sep 2017 20:33:23 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201709102033.v8AKXNg0000608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Sun, 10 Sep 2017 20:33:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323398 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: in head: share/misc usr.bin/calendar/calendars X-SVN-Commit-Revision: 323398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 20:33:24 -0000 Author: kibab Date: Sun Sep 10 20:33:23 2017 New Revision: 323398 URL: https://svnweb.freebsd.org/changeset/base/323398 Log: Add information about new src committer (kibab) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D12304 Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Sun Sep 10 20:17:31 2017 (r323397) +++ head/share/misc/committers-src.dot Sun Sep 10 20:33:23 2017 (r323398) @@ -222,6 +222,7 @@ kensmith [label="Ken Smith\nkensmith@FreeBSD.org\n2004 kevans [label="Kyle Evans\nkevans@FreeBSD.org\n2017/06/20"] kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2006/07/23"] kib [label="Konstantin Belousov\nkib@FreeBSD.org\n2006/06/03"] +kibab [label="Ilya Bakulin\nkibab@FreeBSD.org\n2017/09/02"] kmacy [label="Kip Macy\nkmacy@FreeBSD.org\n2005/06/01"] kp [label="Kristof Provost\nkp@FreeBSD.org\n2015/03/22"] landonf [label="Landon Fuller\nlandonf@FreeBSD.org\n2016/05/31"] @@ -525,6 +526,7 @@ imp -> furuta imp -> joe imp -> jon imp -> keichii +imp -> kibab imp -> mb imp -> mr imp -> neel Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Sep 10 20:17:31 2017 (r323397) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Sep 10 20:33:23 2017 (r323398) @@ -307,6 +307,7 @@ 08/19 Pav Lucistnik born in Kutna Hora, Czech Republic, 1980 08/20 Michael Heffner born in Cleona, Pennsylvania, United States, 1981 08/21 Jason A. Harmening born in Fort Wayne, Indiana, United States, 1981 +08/22 Ilya Bakulin born in Tbilisi, USSR, 1986 08/24 Mark Linimon born in Houston, Texas, United States, 1955 08/24 Alexander Botero-Lowry died in San Francisco, California, United States, 2012 08/25 Beech Rintoul born in Oakland, California, United States, 1952 From owner-svn-src-all@freebsd.org Sun Sep 10 23:04:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8805AE08951; Sun, 10 Sep 2017 23:04:56 +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 568BD64A5A; Sun, 10 Sep 2017 23:04:56 +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 v8AN4tN7087272; Sun, 10 Sep 2017 23:04:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AN4t4c087271; Sun, 10 Sep 2017 23:04:55 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102304.v8AN4t4c087271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 23:04:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323399 - stable/11/sys/modules/dtb/imx6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/modules/dtb/imx6 X-SVN-Commit-Revision: 323399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 23:04:56 -0000 Author: ian Date: Sun Sep 10 23:04:55 2017 New Revision: 323399 URL: https://svnweb.freebsd.org/changeset/base/323399 Log: MFC r314723: Build the dtb files for the revb1 versions of wandboard. Modified: stable/11/sys/modules/dtb/imx6/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/dtb/imx6/Makefile ============================================================================== --- stable/11/sys/modules/dtb/imx6/Makefile Sun Sep 10 20:33:23 2017 (r323398) +++ stable/11/sys/modules/dtb/imx6/Makefile Sun Sep 10 23:04:55 2017 (r323399) @@ -10,6 +10,8 @@ DTS= \ imx6q-nitrogen6x.dts \ imx6dl-riotboard.dts \ imx6dl-wandboard.dts \ - imx6q-wandboard.dts + imx6dl-wandboard-revb1.dts \ + imx6q-wandboard.dts \ + imx6q-wandboard-revb1.dts \ .include From owner-svn-src-all@freebsd.org Sun Sep 10 23:09:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABE17E08C46; Sun, 10 Sep 2017 23:09:18 +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 84EB864BF9; Sun, 10 Sep 2017 23:09:18 +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 v8AN9HZ9087458; Sun, 10 Sep 2017 23:09:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8AN9HN5087456; Sun, 10 Sep 2017 23:09:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102309.v8AN9HN5087456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 23:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323400 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 23:09:18 -0000 Author: ian Date: Sun Sep 10 23:09:17 2017 New Revision: 323400 URL: https://svnweb.freebsd.org/changeset/base/323400 Log: MFC r315490, r315508: Make the imx5 clocks driver work with vendor-supplied dts (which does not supply the addresses for the DPLL register blocks) by hard-coding the addresses in the driver source code. Yes, this is just as bad an idea as it sounds, but we have no choice. Remove hardcoded bootverbose=1; imx53 systems boot using loader(8) and users can set verbose if they want to. Modified: stable/11/sys/arm/freescale/imx/imx51_ccm.c stable/11/sys/arm/freescale/imx/imx53_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx51_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx51_ccm.c Sun Sep 10 23:04:55 2017 (r323399) +++ stable/11/sys/arm/freescale/imx/imx51_ccm.c Sun Sep 10 23:09:17 2017 (r323400) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -96,10 +97,34 @@ __FBSDID("$FreeBSD$"); #define IMX51_CKIL_FREQ 32768 #endif +/* + * The fdt data does not provide reg properties describing the DPLL register + * blocks we need to access, presumably because the needed addresses are + * hard-coded within the linux driver. That leaves us with no choice but to do + * the same thing, if we want to run with vendor-supplied fdt data. So here we + * have tables of the physical addresses we need for each soc, and we'll use + * bus_space_map() at attach() time to get access to them. + */ +static uint32_t imx51_dpll_addrs[IMX51_N_DPLLS] = { + 0x83f80000, /* DPLL1 */ + 0x83f84000, /* DPLL2 */ + 0x83f88000, /* DPLL3 */ +}; + +static uint32_t imx53_dpll_addrs[IMX51_N_DPLLS] = { + 0x63f80000, /* DPLL1 */ + 0x63f84000, /* DPLL2 */ + 0x63f88000, /* DPLL3 */ +}; + +#define DPLL_REGS_SZ (16 * 1024) + struct imxccm_softc { device_t sc_dev; - struct resource *res[7]; + struct resource *ccmregs; u_int64_t pll_freq[IMX51_N_DPLLS]; + bus_space_tag_t pllbst; + bus_space_handle_t pllbsh[IMX51_N_DPLLS]; }; struct imxccm_softc *ccm_softc = NULL; @@ -127,16 +152,27 @@ static devclass_t imxccm_devclass; EARLY_DRIVER_MODULE(imxccm, simplebus, imxccm_driver, imxccm_devclass, 0, 0, BUS_PASS_CPU); -static struct resource_spec imxccm_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Global registers */ - { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* DPLLIP1 */ - { SYS_RES_MEMORY, 2, RF_ACTIVE }, /* DPLLIP2 */ - { SYS_RES_MEMORY, 3, RF_ACTIVE }, /* DPLLIP3 */ - { SYS_RES_IRQ, 0, RF_ACTIVE }, /* 71 */ - { SYS_RES_IRQ, 1, RF_ACTIVE }, /* 72 */ - { -1, 0 } -}; +static inline uint32_t +pll_read_4(struct imxccm_softc *sc, int pll, int reg) +{ + return (bus_space_read_4(sc->pllbst, sc->pllbsh[pll - 1], reg)); +} + +static inline uint32_t +ccm_read_4(struct imxccm_softc *sc, int reg) +{ + + return (bus_read_4(sc->ccmregs, reg)); +} + +static inline void +ccm_write_4(struct imxccm_softc *sc, int reg, uint32_t val) +{ + + bus_write_4(sc->ccmregs, reg, val); +} + static int imxccm_match(device_t dev) { @@ -156,15 +192,42 @@ static int imxccm_attach(device_t dev) { struct imxccm_softc *sc; + int idx; + u_int soc; + uint32_t *pll_addrs; sc = device_get_softc(dev); sc->sc_dev = dev; - if (bus_alloc_resources(dev, imxccm_spec, sc->res)) { + switch ((soc = imx_soc_type())) { + case IMXSOC_51: + pll_addrs = imx51_dpll_addrs; + break; + case IMXSOC_53: + pll_addrs = imx53_dpll_addrs; + break; + default: + device_printf(dev, "No support for SoC type 0x%08x\n", soc); + goto noclocks; + } + + idx = 0; + sc->ccmregs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &idx, + RF_ACTIVE); + if (sc->ccmregs == NULL) { device_printf(dev, "could not allocate resources\n"); - return (ENXIO); + goto noclocks; } + sc->pllbst = fdtbus_bs_tag; + for (idx = 0; idx < IMX51_N_DPLLS; ++idx) { + if (bus_space_map(sc->pllbst, pll_addrs[idx], DPLL_REGS_SZ, 0, + &sc->pllbsh[idx]) != 0) { + device_printf(dev, "Cannot map DPLL registers\n"); + goto noclocks; + } + } + ccm_softc = sc; imx51_get_pll_freq(1); @@ -187,6 +250,10 @@ imxccm_attach(device_t dev) return (0); + +noclocks: + + panic("Cannot continue without clock support"); } u_int @@ -211,13 +278,13 @@ imx51_get_clock(enum imx51_clock clk) case IMX51CLK_PLL3: return ccm_softc->pll_freq[clk-IMX51CLK_PLL1]; case IMX51CLK_PLL1SW: - ccsr = bus_read_4(ccm_softc->res[0], CCMC_CCSR); + ccsr = ccm_read_4(ccm_softc, CCMC_CCSR); if ((ccsr & CCSR_PLL1_SW_CLK_SEL) == 0) return ccm_softc->pll_freq[1-1]; /* step clock */ /* FALLTHROUGH */ case IMX51CLK_PLL1STEP: - ccsr = bus_read_4(ccm_softc->res[0], CCMC_CCSR); + ccsr = ccm_read_4(ccm_softc, CCMC_CCSR); switch ((ccsr & CCSR_STEP_SEL_MASK) >> CCSR_STEP_SEL_SHIFT) { case 0: return imx51_get_clock(IMX51CLK_LP_APM); @@ -234,34 +301,34 @@ imx51_get_clock(enum imx51_clock clk) } /*NOTREACHED*/ case IMX51CLK_PLL2SW: - ccsr = bus_read_4(ccm_softc->res[0], CCMC_CCSR); + ccsr = ccm_read_4(ccm_softc, CCMC_CCSR); if ((ccsr & CCSR_PLL2_SW_CLK_SEL) == 0) return imx51_get_clock(IMX51CLK_PLL2); return 0; /* XXX PLL2 bypass clk */ case IMX51CLK_PLL3SW: - ccsr = bus_read_4(ccm_softc->res[0], CCMC_CCSR); + ccsr = ccm_read_4(ccm_softc, CCMC_CCSR); if ((ccsr & CCSR_PLL3_SW_CLK_SEL) == 0) return imx51_get_clock(IMX51CLK_PLL3); return 0; /* XXX PLL3 bypass clk */ case IMX51CLK_LP_APM: - ccsr = bus_read_4(ccm_softc->res[0], CCMC_CCSR); + ccsr = ccm_read_4(ccm_softc, CCMC_CCSR); return (ccsr & CCSR_LP_APM) ? imx51_get_clock(IMX51CLK_FPM) : IMX51_OSC_FREQ; case IMX51CLK_ARM_ROOT: freq = imx51_get_clock(IMX51CLK_PLL1SW); - cacrr = bus_read_4(ccm_softc->res[0], CCMC_CACRR); + cacrr = ccm_read_4(ccm_softc, CCMC_CACRR); return freq / (cacrr + 1); /* ... */ case IMX51CLK_MAIN_BUS_CLK_SRC: - cbcdr = bus_read_4(ccm_softc->res[0], CCMC_CBCDR); + cbcdr = ccm_read_4(ccm_softc, CCMC_CBCDR); if ((cbcdr & CBCDR_PERIPH_CLK_SEL) == 0) freq = imx51_get_clock(IMX51CLK_PLL2SW); else { freq = 0; - cbcmr = bus_read_4(ccm_softc->res[0], CCMC_CBCMR); + cbcmr = ccm_read_4(ccm_softc, CCMC_CBCMR); switch ((cbcmr & CBCMR_PERIPH_APM_SEL_MASK) >> CBCMR_PERIPH_APM_SEL_SHIFT) { case 0: @@ -281,29 +348,29 @@ imx51_get_clock(enum imx51_clock clk) return freq; case IMX51CLK_MAIN_BUS_CLK: freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK_SRC); - cdcr = bus_read_4(ccm_softc->res[0], CCMC_CDCR); + cdcr = ccm_read_4(ccm_softc, CCMC_CDCR); return freq / (1 + ((cdcr & CDCR_PERIPH_CLK_DVFS_PODF_MASK) >> CDCR_PERIPH_CLK_DVFS_PODF_SHIFT)); case IMX51CLK_AHB_CLK_ROOT: freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK); - cbcdr = bus_read_4(ccm_softc->res[0], CCMC_CBCDR); + cbcdr = ccm_read_4(ccm_softc, CCMC_CBCDR); return freq / (1 + ((cbcdr & CBCDR_AHB_PODF_MASK) >> CBCDR_AHB_PODF_SHIFT)); case IMX51CLK_IPG_CLK_ROOT: freq = imx51_get_clock(IMX51CLK_AHB_CLK_ROOT); - cbcdr = bus_read_4(ccm_softc->res[0], CCMC_CBCDR); + cbcdr = ccm_read_4(ccm_softc, CCMC_CBCDR); return freq / (1 + ((cbcdr & CBCDR_IPG_PODF_MASK) >> CBCDR_IPG_PODF_SHIFT)); case IMX51CLK_PERCLK_ROOT: - cbcmr = bus_read_4(ccm_softc->res[0], CCMC_CBCMR); + cbcmr = ccm_read_4(ccm_softc, CCMC_CBCMR); if (cbcmr & CBCMR_PERCLK_IPG_SEL) return imx51_get_clock(IMX51CLK_IPG_CLK_ROOT); if (cbcmr & CBCMR_PERCLK_LP_APM_SEL) freq = imx51_get_clock(IMX51CLK_LP_APM); else freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK_SRC); - cbcdr = bus_read_4(ccm_softc->res[0], CCMC_CBCDR); + cbcdr = ccm_read_4(ccm_softc, CCMC_CBCDR); #ifdef IMXCCMDEBUG printf("cbcmr=%x cbcdr=%x\n", cbcmr, cbcdr); @@ -317,8 +384,8 @@ imx51_get_clock(enum imx51_clock clk) CBCDR_PERCLK_PODF_SHIFT); return freq; case IMX51CLK_UART_CLK_ROOT: - cscdr1 = bus_read_4(ccm_softc->res[0], CCMC_CSCDR1); - cscmr1 = bus_read_4(ccm_softc->res[0], CCMC_CSCMR1); + cscdr1 = ccm_read_4(ccm_softc, CCMC_CSCDR1); + cscmr1 = ccm_read_4(ccm_softc, CCMC_CSCMR1); #ifdef IMXCCMDEBUG printf("cscdr1=%x cscmr1=%x\n", cscdr1, cscmr1); @@ -345,7 +412,7 @@ imx51_get_clock(enum imx51_clock clk) CSCDR1_UART_CLK_PODF_SHIFT)); case IMX51CLK_IPU_HSP_CLK_ROOT: freq = 0; - cbcmr = bus_read_4(ccm_softc->res[0], CCMC_CBCMR); + cbcmr = ccm_read_4(ccm_softc, CCMC_CBCMR); switch ((cbcmr & CBCMR_IPU_HSP_CLK_SEL_MASK) >> CBCMR_IPU_HSP_CLK_SEL_SHIFT) { case 0: @@ -388,16 +455,16 @@ imx51_get_pll_freq(u_int pll_no) KASSERT(1 <= pll_no && pll_no <= IMX51_N_DPLLS, ("Wrong PLL id")); - dp_ctrl = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_CTL); + dp_ctrl = pll_read_4(ccm_softc, pll_no, DPLL_DP_CTL); if (dp_ctrl & DP_CTL_HFSM) { - dp_op = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_HFS_OP); - dp_mfd = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_HFS_MFD); - dp_mfn = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_HFS_MFN); + dp_op = pll_read_4(ccm_softc, pll_no, DPLL_DP_HFS_OP); + dp_mfd = pll_read_4(ccm_softc, pll_no, DPLL_DP_HFS_MFD); + dp_mfn = pll_read_4(ccm_softc, pll_no, DPLL_DP_HFS_MFN); } else { - dp_op = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_OP); - dp_mfd = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_MFD); - dp_mfn = bus_read_4(ccm_softc->res[pll_no], DPLL_DP_MFN); + dp_op = pll_read_4(ccm_softc, pll_no, DPLL_DP_OP); + dp_mfd = pll_read_4(ccm_softc, pll_no, DPLL_DP_MFD); + dp_mfn = pll_read_4(ccm_softc, pll_no, DPLL_DP_MFN); } pdf = dp_op & DP_OP_PDF_MASK; @@ -416,7 +483,7 @@ imx51_get_pll_freq(u_int pll_no) ref = 24000000; /* IMX51_OSC_FREQ */ break; case DP_CTL_REF_CLK_SEL_FPM: - ccr = bus_read_4(ccm_softc->res[0], CCMC_CCR); + ccr = ccm_read_4(ccm_softc, CCMC_CCR); if (ccr & CCR_FPM_MULT) /* TODO: get from FDT "fsl,imx-ckil" */ ref = 32768 * 1024; @@ -461,10 +528,10 @@ imx51_clk_gating(int clk_src, int mode) group = CCMR_CCGR_MODULE(clk_src); field = clk_src % CCMR_CCGR_NSOURCE; - reg = bus_read_4(ccm_softc->res[0], CCMC_CCGR(group)); + reg = ccm_read_4(ccm_softc, CCMC_CCGR(group)); reg &= ~(0x03 << field * 2); reg |= (mode << field * 2); - bus_write_4(ccm_softc->res[0], CCMC_CCGR(group), reg); + ccm_write_4(ccm_softc, CCMC_CCGR(group), reg); } int @@ -472,7 +539,7 @@ imx51_get_clk_gating(int clk_src) { uint32_t reg; - reg = bus_read_4(ccm_softc->res[0], + reg = ccm_read_4(ccm_softc, CCMC_CCGR(CCMR_CCGR_MODULE(clk_src))); return ((reg >> (clk_src % CCMR_CCGR_NSOURCE) * 2) & 0x03); } @@ -490,20 +557,20 @@ imx_ccm_usb_enable(device_t dev) * Select PLL2 as the source for the USB clock. * The default is PLL3, but U-boot changes it to PLL2. */ - regval = bus_read_4(ccm_softc->res[0], CCMC_CSCMR1); + regval = ccm_read_4(ccm_softc, CCMC_CSCMR1); regval &= ~CSCMR1_USBOH3_CLK_SEL_MASK; regval |= 1 << CSCMR1_USBOH3_CLK_SEL_SHIFT; - bus_write_4(ccm_softc->res[0], CCMC_CSCMR1, regval); + ccm_write_4(ccm_softc, CCMC_CSCMR1, regval); /* * Set the USB clock pre-divider to div-by-5, post-divider to div-by-2. */ - regval = bus_read_4(ccm_softc->res[0], CCMC_CSCDR1); + regval = ccm_read_4(ccm_softc, CCMC_CSCDR1); regval &= ~CSCDR1_USBOH3_CLK_PODF_MASK; regval &= ~CSCDR1_USBOH3_CLK_PRED_MASK; regval |= 4 << CSCDR1_USBOH3_CLK_PRED_SHIFT; regval |= 1 << CSCDR1_USBOH3_CLK_PODF_SHIFT; - bus_write_4(ccm_softc->res[0], CCMC_CSCDR1, regval); + ccm_write_4(ccm_softc, CCMC_CSCDR1, regval); /* * The same two clocks gates are used on imx51 and imx53. @@ -523,9 +590,9 @@ imx_ccm_usbphy_enable(device_t dev) * strange, but we'll go with it until more is known. */ if (imx_soc_type() == IMXSOC_53) { - regval = bus_read_4(ccm_softc->res[0], CCMC_CSCMR1); + regval = ccm_read_4(ccm_softc, CCMC_CSCMR1); regval |= 1 << CSCMR1_USBPHY_CLK_SEL_SHIFT; - bus_write_4(ccm_softc->res[0], CCMC_CSCMR1, regval); + ccm_write_4(ccm_softc, CCMC_CSCMR1, regval); } /* Modified: stable/11/sys/arm/freescale/imx/imx53_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx53_machdep.c Sun Sep 10 23:04:55 2017 (r323399) +++ stable/11/sys/arm/freescale/imx/imx53_machdep.c Sun Sep 10 23:09:17 2017 (r323400) @@ -56,10 +56,6 @@ static int imx53_attach(platform_t plat) { - /* XXX - Get rid of this stuff soon. */ - boothowto |= RB_VERBOSE|RB_MULTIPLE; - bootverbose = 1; - return (0); } From owner-svn-src-all@freebsd.org Sun Sep 10 23:12:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 603B7E08F2F; Sun, 10 Sep 2017 23:12:08 +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 2F46D64F46; Sun, 10 Sep 2017 23:12:08 +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 v8ANC7S4090490; Sun, 10 Sep 2017 23:12:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ANC7dG090489; Sun, 10 Sep 2017 23:12:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102312.v8ANC7dG090489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 23:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323401 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 23:12:08 -0000 Author: ian Date: Sun Sep 10 23:12:07 2017 New Revision: 323401 URL: https://svnweb.freebsd.org/changeset/base/323401 Log: MFC r315530: Remove unreferenced global function imx_gpt_get_timerfreq() and do some cleanups enabled by that. Deleted: stable/11/sys/arm/freescale/imx/imx_gptvar.h Modified: stable/11/sys/arm/freescale/imx/imx_gpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_gpt.c Sun Sep 10 23:09:17 2017 (r323400) +++ stable/11/sys/arm/freescale/imx/imx_gpt.c Sun Sep 10 23:12:07 2017 (r323401) @@ -35,13 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include -#include #include -#include #include #include @@ -49,12 +46,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include -#include -#include - #define WRITE4(_sc, _r, _v) \ bus_space_write_4((_sc)->sc_iot, (_sc)->sc_ioh, (_r), (_v)) #define READ4(_sc, _r) \ @@ -81,8 +75,20 @@ static struct timecounter imx_gpt_timecounter = { .tc_quality = 1000, }; +struct imx_gpt_softc { + device_t sc_dev; + struct resource * res[2]; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + void * sc_ih; /* interrupt handler */ + uint32_t sc_period; + uint32_t sc_clksrc; + uint32_t clkfreq; + struct eventtimer et; +}; + /* Global softc pointer for use in DELAY(). */ -struct imx_gpt_softc *imx_gpt_sc = NULL; +static struct imx_gpt_softc *imx_gpt_sc; /* * Hand-calibrated delay-loop counter. This was calibrated on an i.MX6 running @@ -107,7 +113,7 @@ static struct resource_spec imx_gpt_spec[] = { }; static struct ofw_compat_data compat_data[] = { - {"fsl,imx6dl-gpt", 1}, + {"fsl,imx6dl-gpt", 1}, {"fsl,imx6q-gpt", 1}, {"fsl,imx53-gpt", 1}, {"fsl,imx51-gpt", 1}, @@ -310,13 +316,6 @@ imx_gpt_timer_stop(struct eventtimer *et) sc->sc_period = 0; return (0); -} - -int -imx_gpt_get_timerfreq(struct imx_gpt_softc *sc) -{ - - return (sc->clkfreq); } static int From owner-svn-src-all@freebsd.org Sun Sep 10 23:31:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E32B7E09B86; Sun, 10 Sep 2017 23:31:22 +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 AD45065786; Sun, 10 Sep 2017 23:31:22 +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 v8ANVLRc098546; Sun, 10 Sep 2017 23:31:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ANVLUb098545; Sun, 10 Sep 2017 23:31:21 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102331.v8ANVLUb098545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 23:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323402 - in stable/11/sys: arm/conf modules/dtb/imx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/conf modules/dtb/imx5 X-SVN-Commit-Revision: 323402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 23:31:23 -0000 Author: ian Date: Sun Sep 10 23:31:21 2017 New Revision: 323402 URL: https://svnweb.freebsd.org/changeset/base/323402 Log: MFC r315572, r315573, r315575, r315578: Add a module to build imx5 dtb files. Add dtb/imx5 module build to the IMX53 kernel config. Remove configs for IMX53-QSB and DIGI-CCWMX53. They were just standard IMX53 with static dtb added, and now that imx53 can use vendor- supplied dts files and ubldr, there is no need for a static-dtb variant. Added: stable/11/sys/modules/dtb/imx5/ - copied from r315578, head/sys/modules/dtb/imx5/ Deleted: stable/11/sys/arm/conf/DIGI-CCWMX53 stable/11/sys/arm/conf/IMX53-QSB Modified: stable/11/sys/arm/conf/IMX53 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/IMX53 ============================================================================== --- stable/11/sys/arm/conf/IMX53 Sun Sep 10 23:12:07 2017 (r323401) +++ stable/11/sys/arm/conf/IMX53 Sun Sep 10 23:31:21 2017 (r323402) @@ -117,3 +117,4 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree options FDT # Configure using FDT/DTB data +makeoptions MODULES_EXTRA=dtb/imx5 From owner-svn-src-all@freebsd.org Sun Sep 10 23:41:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA8ADE0A74B; Sun, 10 Sep 2017 23:41:24 +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 C4EEF65CC0; Sun, 10 Sep 2017 23:41:24 +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 v8ANfNZc000767; Sun, 10 Sep 2017 23:41:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ANfN56000764; Sun, 10 Sep 2017 23:41:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102341.v8ANfN56000764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 23:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323403 - in stable/11/sys: arm/conf arm/freescale/imx boot/fdt/dts/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/conf arm/freescale/imx boot/fdt/dts/arm X-SVN-Commit-Revision: 323403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 23:41:25 -0000 Author: ian Date: Sun Sep 10 23:41:23 2017 New Revision: 323403 URL: https://svnweb.freebsd.org/changeset/base/323403 Log: MFC r315574, r315576, r315577: Convert the imx5 interrupt controller driver to INTRNG. Add INTRNG option to EFIKA_MX config, it is an imx5-based platform. Delete our local imx53-qsb.dts file; the code now runs fine using the standard vendor-supplied file in sys/gnu/dts/arm. Deleted: stable/11/sys/boot/fdt/dts/arm/imx53-qsb.dts Modified: stable/11/sys/arm/conf/EFIKA_MX stable/11/sys/arm/conf/IMX53 stable/11/sys/arm/freescale/imx/tzic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/EFIKA_MX ============================================================================== --- stable/11/sys/arm/conf/EFIKA_MX Sun Sep 10 23:31:21 2017 (r323402) +++ stable/11/sys/arm/conf/EFIKA_MX Sun Sep 10 23:41:23 2017 (r323403) @@ -130,3 +130,5 @@ options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp437 device ukbd # Allow keyboard like HIDs to control console device ums + +options INTRNG Modified: stable/11/sys/arm/conf/IMX53 ============================================================================== --- stable/11/sys/arm/conf/IMX53 Sun Sep 10 23:31:21 2017 (r323402) +++ stable/11/sys/arm/conf/IMX53 Sun Sep 10 23:41:23 2017 (r323403) @@ -118,3 +118,5 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree options FDT # Configure using FDT/DTB data makeoptions MODULES_EXTRA=dtb/imx5 + +options INTRNG Modified: stable/11/sys/arm/freescale/imx/tzic.c ============================================================================== --- stable/11/sys/arm/freescale/imx/tzic.c Sun Sep 10 23:31:21 2017 (r323402) +++ stable/11/sys/arm/freescale/imx/tzic.c Sun Sep 10 23:41:23 2017 (r323403) @@ -34,14 +34,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include #include -#include #include #include + #include #include @@ -52,28 +50,180 @@ __FBSDID("$FreeBSD$"); #include -struct tzic_softc { - struct resource * tzic_res[3]; - bus_space_tag_t tzic_bst; - bus_space_handle_t tzic_bsh; - uint8_t ver; +#include "pic_if.h" + +#define TZIC_NIRQS 128 + +struct tzic_irqsrc { + struct intr_irqsrc isrc; + u_int irq; }; -static struct resource_spec tzic_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { -1, 0 } +struct tzic_softc { + device_t dev; + struct resource *tzicregs; + struct tzic_irqsrc isrcs[TZIC_NIRQS]; }; -static struct tzic_softc *tzic_sc = NULL; +static struct tzic_softc *tzic_sc; -#define tzic_read_4(reg) \ - bus_space_read_4(tzic_sc->tzic_bst, tzic_sc->tzic_bsh, reg) -#define tzic_write_4(reg, val) \ - bus_space_write_4(tzic_sc->tzic_bst, tzic_sc->tzic_bsh, reg, val) +static inline uint32_t +tzic_read_4(struct tzic_softc *sc, int reg) +{ -static void tzic_post_filter(void *); + return (bus_read_4(sc->tzicregs, reg)); +} +static inline void +tzic_write_4(struct tzic_softc *sc, int reg, uint32_t val) +{ + + bus_write_4(sc->tzicregs, reg, val); +} + +static inline void +tzic_irq_eoi(struct tzic_softc *sc) +{ + + tzic_write_4(sc, TZIC_PRIOMASK, 0xff); +} + +static inline void +tzic_irq_mask(struct tzic_softc *sc, u_int irq) +{ + + tzic_write_4(sc, TZIC_ENCLEAR(irq >> 5), (1u << (irq & 0x1f))); +} + +static inline void +tzic_irq_unmask(struct tzic_softc *sc, u_int irq) +{ + + tzic_write_4(sc, TZIC_ENSET(irq >> 5), (1u << (irq & 0x1f))); +} + static int +tzic_intr(void *arg) +{ + struct tzic_softc *sc = arg; + int b, i, irq; + uint32_t pending; + + /* Get active interrupt */ + for (i = 0; i < TZIC_NIRQS / 32; ++i) { + pending = tzic_read_4(sc, TZIC_PND(i)); + if ((b = 31 - __builtin_clz(pending)) < 0) + continue; + irq = i * 32 + b; + tzic_write_4(sc, TZIC_PRIOMASK, 0); + if (intr_isrc_dispatch(&sc->isrcs[irq].isrc, + curthread->td_intr_frame) != 0) { + tzic_irq_mask(sc, irq); + tzic_irq_eoi(sc); + arm_irq_memory_barrier(irq); + if (bootverbose) { + device_printf(sc->dev, + "Stray irq %u disabled\n", irq); + } + } + return (FILTER_HANDLED); + } + + if (bootverbose) + device_printf(sc->dev, "Spurious interrupt detected\n"); + + return (FILTER_HANDLED); +} + +static void +tzic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq = ((struct tzic_irqsrc *)isrc)->irq; + struct tzic_softc *sc = device_get_softc(dev); + + arm_irq_memory_barrier(irq); + tzic_irq_unmask(sc, irq); +} + +static void +tzic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq = ((struct tzic_irqsrc *)isrc)->irq; + struct tzic_softc *sc = device_get_softc(dev); + + tzic_irq_mask(sc, irq); +} + +static int +tzic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct intr_map_data_fdt *daf; + struct tzic_softc *sc; + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 1 || daf->cells[0] >= TZIC_NIRQS) + return (EINVAL); + + sc = device_get_softc(dev); + *isrcp = &sc->isrcs[daf->cells[0]].isrc; + + return (0); +} + +static void +tzic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct tzic_softc *sc = device_get_softc(dev); + + tzic_irq_mask(sc, ((struct tzic_irqsrc *)isrc)->irq); + tzic_irq_eoi(sc); +} + +static void +tzic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + tzic_enable_intr(dev, isrc); +} + +static void +tzic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + + tzic_irq_eoi(device_get_softc(dev)); +} + +static int +tzic_pic_attach(struct tzic_softc *sc) +{ + struct intr_pic *pic; + const char *name; + intptr_t xref; + int error; + u_int irq; + + name = device_get_nameunit(sc->dev); + for (irq = 0; irq < TZIC_NIRQS; irq++) { + sc->isrcs[irq].irq = irq; + error = intr_isrc_register(&sc->isrcs[irq].isrc, + sc->dev, 0, "%s,%u", name, irq); + if (error != 0) + return (error); + } + + xref = OF_xref_from_node(ofw_bus_get_node(sc->dev)); + pic = intr_pic_register(sc->dev, xref); + if (pic == NULL) + return (ENXIO); + + return (intr_pic_claim_root(sc->dev, xref, tzic_intr, sc, 0)); +} + +static int tzic_probe(device_t dev) { @@ -90,50 +240,63 @@ tzic_probe(device_t dev) static int tzic_attach(device_t dev) { - struct tzic_softc *sc = device_get_softc(dev); - int i; - uint32_t reg; + struct tzic_softc *sc = device_get_softc(dev); + int i; if (tzic_sc) return (ENXIO); + tzic_sc = sc; + sc->dev = dev; - if (bus_alloc_resources(dev, tzic_spec, sc->tzic_res)) { + i = 0; + sc->tzicregs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, + RF_ACTIVE); + if (sc->tzicregs == NULL) { device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - arm_post_filter = tzic_post_filter; - - /* Distributor Interface */ - sc->tzic_bst = rman_get_bustag(sc->tzic_res[0]); - sc->tzic_bsh = rman_get_bushandle(sc->tzic_res[0]); - - tzic_sc = sc; - - reg = tzic_read_4(TZIC_INTCNTL); - tzic_write_4(TZIC_INTCNTL, INTCNTL_NSEN_MASK|INTCNTL_NSEN|INTCNTL_EN); - reg = tzic_read_4(TZIC_INTCNTL); - tzic_write_4(TZIC_PRIOMASK, 0x1f); - reg = tzic_read_4(TZIC_PRIOMASK); - - tzic_write_4(TZIC_SYNCCTRL, 0x02); - reg = tzic_read_4(TZIC_SYNCCTRL); - /* route all interrupts to IRQ. secure interrupts are for FIQ */ for (i = 0; i < 4; i++) - tzic_write_4(TZIC_INTSEC(i), 0xffffffff); + tzic_write_4(sc, TZIC_INTSEC(i), 0xffffffff); /* disable all interrupts */ for (i = 0; i < 4; i++) - tzic_write_4(TZIC_ENCLEAR(i), 0xffffffff); + tzic_write_4(sc, TZIC_ENCLEAR(i), 0xffffffff); + /* Set all interrupts to priority 0 (max). */ + for (i = 0; i < 128 / 4; ++i) + tzic_write_4(sc, TZIC_PRIORITY(i), 0); + + /* + * Set priority mask to lowest (unmasked) prio, set synchronizer to + * low-latency mode (as opposed to low-power), enable the controller. + */ + tzic_write_4(sc, TZIC_PRIOMASK, 0xff); + tzic_write_4(sc, TZIC_SYNCCTRL, 0); + tzic_write_4(sc, TZIC_INTCNTL, INTCNTL_NSEN_MASK|INTCNTL_NSEN|INTCNTL_EN); + + /* Register as a root pic. */ + if (tzic_pic_attach(sc) != 0) { + device_printf(dev, "could not attach PIC\n"); + return (ENXIO); + } + return (0); } static device_method_t tzic_methods[] = { DEVMETHOD(device_probe, tzic_probe), DEVMETHOD(device_attach, tzic_attach), - { 0, 0 } + + DEVMETHOD(pic_disable_intr, tzic_disable_intr), + DEVMETHOD(pic_enable_intr, tzic_enable_intr), + DEVMETHOD(pic_map_intr, tzic_map_intr), + DEVMETHOD(pic_post_filter, tzic_post_filter), + DEVMETHOD(pic_post_ithread, tzic_post_ithread), + DEVMETHOD(pic_pre_ithread, tzic_pre_ithread), + + DEVMETHOD_END }; static driver_t tzic_driver = { @@ -144,48 +307,5 @@ static driver_t tzic_driver = { static devclass_t tzic_devclass; -/* - * Memory space of controller located outside of device range, so let him to - * attach not only to simplebus, but ofwbus also. - */ EARLY_DRIVER_MODULE(tzic, ofwbus, tzic_driver, tzic_devclass, 0, 0, BUS_PASS_INTERRUPT); -EARLY_DRIVER_MODULE(tzic, simplebus, tzic_driver, tzic_devclass, 0, 0, - BUS_PASS_INTERRUPT); - -static void -tzic_post_filter(void *arg) -{ - -} - -int -arm_get_next_irq(int last_irq) -{ - uint32_t pending; - int i, b; - - for (i = 0; i < 4; i++) { - pending = tzic_read_4(TZIC_PND(i)); - for (b = 0; pending != 0 && b < 32; b++) - if (pending & (1 << b)) { - return (i * 32 + b); - } - } - - return (-1); -} - -void -arm_mask_irq(uintptr_t nb) -{ - - tzic_write_4(TZIC_ENCLEAR(nb / 32), (1UL <<(nb % 32))); -} - -void -arm_unmask_irq(uintptr_t nb) -{ - - tzic_write_4(TZIC_ENSET(nb / 32), (1UL <<(nb % 32))); -} From owner-svn-src-all@freebsd.org Sun Sep 10 23:48:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83053E0ACB1; Sun, 10 Sep 2017 23:48:21 +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 5F1446609D; Sun, 10 Sep 2017 23:48:21 +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 v8ANmKBK003866; Sun, 10 Sep 2017 23:48:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ANmKpZ003864; Sun, 10 Sep 2017 23:48:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709102348.v8ANmKpZ003864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 10 Sep 2017 23:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323404 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Sep 2017 23:48:21 -0000 Author: ian Date: Sun Sep 10 23:48:20 2017 New Revision: 323404 URL: https://svnweb.freebsd.org/changeset/base/323404 Log: MFC r315589, r315591, r316659, r316661: Eliminate unnecessary read/modify/write sequences during eventtimer setup. Replace the hard-coded way-too-small minimum event timer period with a value calculated at runtime based on how long it takes to set up an event in hardware. This fixes the intermittant 1-minute hang at boot on imx5 systems, and also the occasional oversleeping while running. It doesn't affect imx6 systems, which use different hardware for eventtimers. Remove some old interrupt handling workaround code from the pre-INTRNG days. At this point, INTRNG is not going away (the option may go away, but the code is not), so we no longer need code to support workarounds that handled the lack of INTRNG functionality. Update the code that compensates for the lack of a GPC interrupt controller driver for imx6. Some newer dts source puts the GIC node at the root instead of under /soc, so look in both places. Also, sometimes the GIC node doesn't list itself as its own interrupt-parent, allow that too. Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/freescale/imx/imx_gpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Sun Sep 10 23:41:23 2017 (r323403) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Sun Sep 10 23:48:20 2017 (r323404) @@ -52,45 +52,7 @@ __FBSDID("$FreeBSD$"); #include "platform_if.h" -static uint32_t gpio1_node; - -#ifndef INTRNG /* - * Work around the linux workaround for imx6 erratum 006687, in which some - * ethernet interrupts don't go to the GPC and thus won't wake the system from - * Wait mode. We don't use Wait mode (which halts the GIC, leaving only GPC - * interrupts able to wake the system), so we don't experience the bug at all. - * The linux workaround is to reconfigure GPIO1_6 as the ENET interrupt by - * writing magic values to an undocumented IOMUX register, then letting the gpio - * interrupt driver notify the ethernet driver. We'll be able to do all that - * (even though we don't need to) once the INTRNG project is committed and the - * imx_gpio driver becomes an interrupt driver. Until then, this crazy little - * workaround watches for requests to map an interrupt 6 with the interrupt - * controller node referring to gpio1, and it substitutes the proper ffec - * interrupt number. - */ -static int -imx6_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt, - int *trig, int *pol) -{ - - if (fdt32_to_cpu(intr[0]) == 6 && - OF_node_from_xref(iparent) == gpio1_node) { - *interrupt = 150; - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - return (0); - } - return (gic_decode_fdt(iparent, intr, interrupt, trig, pol)); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &imx6_decode_fdt, - NULL -}; -#endif - -/* * Fix FDT data related to interrupts. * * Driven by the needs of linux and its drivers (as always), the published FDT @@ -109,7 +71,7 @@ fdt_pic_decode_t fdt_pic_table[] = { * We validate that we have data that looks like we expect before changing it: * - SOC node exists and has GPC as its interrupt parent. * - GPC node exists and has GIC as its interrupt parent. - * - GIC node exists and is its own interrupt parent. + * - GIC node exists and is its own interrupt parent or has no parent. * * This applies to all models of imx6. Luckily all of them have the devices * involved at the same addresses on the same busses, so we don't need any @@ -133,14 +95,20 @@ fix_fdt_interrupt_data(void) if (result <= 0) return; + /* GIC node may be child of soc node, or appear directly at root. */ gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); + if (gicnode == -1) { + gicnode = OF_finddevice("/interrupt-controller@00a01000"); if (gicnode == -1) return; + } + gicxref = OF_xref_from_node(gicnode); + + /* If gic node has no parent, pretend it is its own parent. */ result = OF_getencprop(gicnode, "interrupt-parent", &gicipar, sizeof(gicipar)); if (result <= 0) - return; - gicxref = OF_xref_from_node(gicnode); + gicipar = gicxref; gpcnode = OF_finddevice("/soc/aips-bus@02000000/gpc@020dc000"); if (gpcnode == -1) @@ -184,10 +152,6 @@ imx6_late_init(platform_t plat) const uint32_t IMX6_WDOG_SR_PHYS = 0x020bc004; imx_wdog_init_last_reset(IMX6_WDOG_SR_PHYS); - - /* Cache the gpio1 node handle for imx6_decode_fdt() workaround code. */ - gpio1_node = OF_node_from_xref( - OF_finddevice("/soc/aips-bus@02000000/gpio@0209c000")); } /* Modified: stable/11/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_gpt.c Sun Sep 10 23:41:23 2017 (r323403) +++ stable/11/sys/arm/freescale/imx/imx_gpt.c Sun Sep 10 23:48:20 2017 (r323404) @@ -84,6 +84,7 @@ struct imx_gpt_softc { uint32_t sc_period; uint32_t sc_clksrc; uint32_t clkfreq; + uint32_t ir_reg; struct eventtimer et; }; @@ -102,10 +103,6 @@ static const int imx_gpt_delay_count = 78; /* Try to divide down an available fast clock to this frequency. */ #define TARGET_FREQUENCY 1000000000 -/* Don't try to set an event timer period smaller than this. */ -#define MIN_ET_PERIOD 10LLU - - static struct resource_spec imx_gpt_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, @@ -143,7 +140,7 @@ imx_gpt_attach(device_t dev) { struct imx_gpt_softc *sc; int ctlreg, err; - uint32_t basefreq, prescale; + uint32_t basefreq, prescale, setup_ticks, t1, t2; sc = device_get_softc(dev); @@ -249,13 +246,25 @@ imx_gpt_attach(device_t dev) return (ENXIO); } + /* + * Measure how many clock ticks it takes to setup a one-shot event (it's + * longer than you might think, due to wait states in accessing gpt + * registers). Scale up the result by a factor of 1.5 to be safe, + * and use that to set the minimum eventtimer period we can schedule. In + * the real world, the value works out to about 750ns on imx5 hardware. + */ + t1 = READ4(sc, IMX_GPT_CNT); + WRITE4(sc, IMX_GPT_OCR3, 0); + t2 = READ4(sc, IMX_GPT_CNT); + setup_ticks = ((t2 - t1 + 1) * 3) / 2; + /* Register as an eventtimer. */ sc->et.et_name = "iMXGPT"; sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC; sc->et.et_quality = 800; sc->et.et_frequency = sc->clkfreq; - sc->et.et_min_period = (MIN_ET_PERIOD << 32) / sc->et.et_frequency; - sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency; + sc->et.et_min_period = ((uint64_t)setup_ticks << 32) / sc->clkfreq; + sc->et.et_max_period = ((uint64_t)0xfffffffe << 32) / sc->clkfreq; sc->et.et_start = imx_gpt_timer_start; sc->et.et_stop = imx_gpt_timer_stop; sc->et.et_priv = sc; @@ -285,16 +294,20 @@ imx_gpt_timer_start(struct eventtimer *et, sbintime_t /* Set expected value */ WRITE4(sc, IMX_GPT_OCR2, READ4(sc, IMX_GPT_CNT) + sc->sc_period); /* Enable compare register 2 Interrupt */ - SET4(sc, IMX_GPT_IR, GPT_IR_OF2); + sc->ir_reg |= GPT_IR_OF2; + WRITE4(sc, IMX_GPT_IR, sc->ir_reg); return (0); } else if (first != 0) { + /* Enable compare register 3 interrupt if not already on. */ + if ((sc->ir_reg & GPT_IR_OF3) == 0) { + sc->ir_reg |= GPT_IR_OF3; + WRITE4(sc, IMX_GPT_IR, sc->ir_reg); + } ticks = ((uint32_t)et->et_frequency * first) >> 32; /* Do not disturb, otherwise event will be lost */ spinlock_enter(); /* Set expected value */ WRITE4(sc, IMX_GPT_OCR3, READ4(sc, IMX_GPT_CNT) + ticks); - /* Enable compare register 1 Interrupt */ - SET4(sc, IMX_GPT_IR, GPT_IR_OF3); /* Now everybody can relax */ spinlock_exit(); return (0); @@ -310,9 +323,10 @@ imx_gpt_timer_stop(struct eventtimer *et) sc = (struct imx_gpt_softc *)et->et_priv; - /* Disable OF2 Interrupt */ - CLEAR4(sc, IMX_GPT_IR, GPT_IR_OF2); - WRITE4(sc, IMX_GPT_SR, GPT_IR_OF2); + /* Disable interrupts and clear any pending status. */ + sc->ir_reg &= ~(GPT_IR_OF2 | GPT_IR_OF3); + WRITE4(sc, IMX_GPT_IR, sc->ir_reg); + WRITE4(sc, IMX_GPT_SR, GPT_IR_OF2 | GPT_IR_OF3); sc->sc_period = 0; return (0); From owner-svn-src-all@freebsd.org Mon Sep 11 00:14:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49B30E0C3B5; Mon, 11 Sep 2017 00:14:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 174E066C20; Mon, 11 Sep 2017 00:14:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8B0E4W9015978; Mon, 11 Sep 2017 00:14:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B0E4JA015977; Mon, 11 Sep 2017 00:14:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709110014.v8B0E4JA015977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 11 Sep 2017 00:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323405 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 323405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 00:14:05 -0000 Author: emaste Date: Mon Sep 11 00:14:04 2017 New Revision: 323405 URL: https://svnweb.freebsd.org/changeset/base/323405 Log: newvers.sh: speed up failing git-svn revision search In the case of running newvers.sh on a git tree w/o git-svn-id notes we previously piped the entire 'git log' to grep. Add --grep to the log invocation to avoid processing log entries of no interest. This saves about 2-3 seconds of newvers.sh run time on my SSD laptop. Later changes will bring further speedups. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Sun Sep 10 23:48:20 2017 (r323404) +++ head/sys/conf/newvers.sh Mon Sep 11 00:14:04 2017 (r323405) @@ -218,8 +218,9 @@ if [ -n "$git_cmd" ] ; then svn=" r${svn}" git="=${git}" else - svn=`$git_cmd log | grep '^ git-svn-id:' | head -1 | \ - sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` + svn=`$git_cmd log --grep '^git-svn-id:' | \ + grep '^ git-svn-id:' | head -1 | \ + sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` if [ -z "$svn" ] ; then svn=`$git_cmd log --format='format:%N' | \ grep '^svn ' | head -1 | \ From owner-svn-src-all@freebsd.org Mon Sep 11 00:19:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08C8BE0C6C7; Mon, 11 Sep 2017 00:19: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 CB7E966DF7; Mon, 11 Sep 2017 00:19:10 +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 v8B0J9hj016174; Mon, 11 Sep 2017 00:19:09 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B0J97u016173; Mon, 11 Sep 2017 00:19:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110019.v8B0J97u016173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 00:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323406 - stable/11/tools/test/ppsapi X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/tools/test/ppsapi X-SVN-Commit-Revision: 323406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 00:19:11 -0000 Author: ian Date: Mon Sep 11 00:19:09 2017 New Revision: 323406 URL: https://svnweb.freebsd.org/changeset/base/323406 Log: MFC r315692: Eliminate a "format string is not a string literal" warning. Modified: stable/11/tools/test/ppsapi/ppsapitest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/test/ppsapi/ppsapitest.c ============================================================================== --- stable/11/tools/test/ppsapi/ppsapitest.c Mon Sep 11 00:14:04 2017 (r323405) +++ stable/11/tools/test/ppsapi/ppsapitest.c Mon Sep 11 00:19:09 2017 (r323406) @@ -72,7 +72,7 @@ main(int argc, char **argv) if (argc > 0) { fd = open(argv[0], O_RDONLY); if (fd < 0) - err(1, argv[0]); + err(1, "%s", argv[0]); } else { fd = 0; } From owner-svn-src-all@freebsd.org Mon Sep 11 00:37:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBAA4E0D50C; Mon, 11 Sep 2017 00:37:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95C98675ED; Mon, 11 Sep 2017 00:37:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8B0b0L9024082; Mon, 11 Sep 2017 00:37:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B0b0Ks024081; Mon, 11 Sep 2017 00:37:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709110037.v8B0b0Ks024081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 11 Sep 2017 00:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323407 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 323407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 00:37:01 -0000 Author: emaste Date: Mon Sep 11 00:37:00 2017 New Revision: 323407 URL: https://svnweb.freebsd.org/changeset/base/323407 Log: boot1 generate-fat: generate all templates at once In advance of other changes to the fat template generation process, have generate-fat.sh create all template files at the same time so that they cannot get out of sync. Also correct a longstanding but where BOOT1_OFFSET was overwritten on each invocation. A previous version of this patch stored a per-arch offset (e.g. BOOT1_arm64_OFFSET) but that was deemed unnecessary. Instead just hardcode the known offset that applies to all archs (0x2d) and fail if the offset happens to be different. Ongiong work (using newfs_msdos in bsdinstall and adding msdosfs support to makefs) will eventually allow us to do away with this fat template hack altogether, but in the near term we have a few improvements that will build on this. Reviewed by: allanjude, imp, Eric McCorkle MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10931 Modified: head/sys/boot/efi/boot1/generate-fat.sh Modified: head/sys/boot/efi/boot1/generate-fat.sh ============================================================================== --- head/sys/boot/efi/boot1/generate-fat.sh Mon Sep 11 00:19:09 2017 (r323406) +++ head/sys/boot/efi/boot1/generate-fat.sh Mon Sep 11 00:37:00 2017 (r323407) @@ -13,50 +13,14 @@ FAT_SIZE=1600 #Size in 512-byte blocks of the produced image +BOOT1_OFFSET=2d BOOT1_SIZE=128k -# -# Known filenames -# amd64: BOOTx64.efi -# arm64: BOOTaa64.efi -# arm: BOOTarm.efi -# i386: BOOTia32.efi -# -if [ -z "$2" ]; then - echo "Usage: $0 arch boot-filename" +if [ $(id -u) != 0 ]; then + echo "${0##*/}: must run as root" >&2 exit 1 fi -ARCH=$1 -FILENAME=$2 - -# Generate 800K FAT image -OUTPUT_FILE=fat-${ARCH}.tmpl - -dd if=/dev/zero of=$OUTPUT_FILE bs=512 count=$FAT_SIZE -DEVICE=`mdconfig -a -f $OUTPUT_FILE` -newfs_msdos -F 12 -L EFI $DEVICE -mkdir stub -mount -t msdosfs /dev/$DEVICE stub - -# Create and bless a directory for the boot loader -mkdir -p stub/efi/boot - -# Make a dummy file for boot1 -echo 'Boot1 START' | dd of=stub/efi/boot/$FILENAME cbs=$BOOT1_SIZE count=1 conv=block -# Provide a fallback startup.nsh -echo $FILENAME > stub/efi/boot/startup.nsh - -umount stub -mdconfig -d -u $DEVICE -rmdir stub - -# Locate the offset of the fake file -BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ') - -# Convert to number of blocks -BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}') - # Record maximum boot1 size in bytes case $BOOT1_SIZE in *k) @@ -72,11 +36,50 @@ echo "# \$FreeBSD\$" >> Makefile.fat echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.fat echo "BOOT1_MAXSIZE=$BOOT1_MAXSIZE" >> Makefile.fat -bzip2 $OUTPUT_FILE -echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu -echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu -echo "\$FreeBSD\$" >> $OUTPUT_FILE.bz2.uu +while read ARCH FILENAME; do + # Generate 800K FAT image + OUTPUT_FILE=fat-${ARCH}.tmpl -uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu -rm $OUTPUT_FILE.bz2 + dd if=/dev/zero of=$OUTPUT_FILE bs=512 count=$FAT_SIZE + DEVICE=`mdconfig -a -f $OUTPUT_FILE` + newfs_msdos -F 12 -L EFI $DEVICE + mkdir stub + mount -t msdosfs /dev/$DEVICE stub + # Create and bless a directory for the boot loader + mkdir -p stub/efi/boot + + # Make a dummy file for boot1 + echo 'Boot1 START' | dd of=stub/efi/boot/$FILENAME cbs=$BOOT1_SIZE count=1 conv=block + # Provide a fallback startup.nsh + echo $FILENAME > stub/efi/boot/startup.nsh + + umount stub + mdconfig -d -u $DEVICE + rmdir stub + + # Locate the offset of the fake file + OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ') + + # Convert to number of blocks + OFFSET=$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}') + + # Validate the offset + if [ $OFFSET != $BOOT1_OFFSET ]; then + echo "Incorrect offset $OFFSET != $BOOT1_OFFSET" >&2 + exit 1 + fi + + bzip2 $OUTPUT_FILE + echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu + echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu + echo "\$FreeBSD\$" >> $OUTPUT_FILE.bz2.uu + + uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu + rm $OUTPUT_FILE.bz2 +done < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B277E0DFE8; Mon, 11 Sep 2017 00:51:48 +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 3002067CC7; Mon, 11 Sep 2017 00:51:48 +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 v8B0plI4028364; Mon, 11 Sep 2017 00:51:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B0plFa028362; Mon, 11 Sep 2017 00:51:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110051.v8B0plFa028362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 00:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323408 - stable/11/sys/dev/mii X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/mii X-SVN-Commit-Revision: 323408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 00:51:48 -0000 Author: ian Date: Mon Sep 11 00:51:47 2017 New Revision: 323408 URL: https://svnweb.freebsd.org/changeset/base/323408 Log: MFC r316995: Add support for the Micrel KSZ8081 ethernet PHY. Modified: stable/11/sys/dev/mii/micphy.c stable/11/sys/dev/mii/miidevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mii/micphy.c ============================================================================== --- stable/11/sys/dev/mii/micphy.c Mon Sep 11 00:37:00 2017 (r323407) +++ stable/11/sys/dev/mii/micphy.c Mon Sep 11 00:51:47 2017 (r323408) @@ -76,10 +76,13 @@ __FBSDID("$FreeBSD$"); #define MII_KSZ9031_TX_DATA_PAD_SKEW 0x6 #define MII_KSZ9031_CLOCK_PAD_SKEW 0x8 +#define MII_KSZ8081_PHYCTL2 0x1f + #define PS_TO_REG(p) ((p) / 200) static int micphy_probe(device_t); static int micphy_attach(device_t); +static void micphy_reset(struct mii_softc *); static int micphy_service(struct mii_softc *, struct mii_data *, int); static device_method_t micphy_methods[] = { @@ -102,6 +105,7 @@ static driver_t micphy_driver = { DRIVER_MODULE(micphy, miibus, micphy_driver, micphy_devclass, 0, 0); static const struct mii_phydesc micphys[] = { + MII_PHY_DESC(MICREL, KSZ8081), MII_PHY_DESC(MICREL, KSZ9021), MII_PHY_DESC(MICREL, KSZ9031), MII_PHY_END @@ -110,7 +114,7 @@ static const struct mii_phydesc micphys[] = { static const struct mii_phy_funcs micphy_funcs = { micphy_service, ukphy_status, - mii_phy_reset + micphy_reset }; static uint32_t @@ -257,6 +261,10 @@ micphy_attach(device_t dev) mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &micphy_funcs, 1); mii_phy_setmedia(sc); + /* Nothing further to configure for 8081 model. */ + if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ8081) + return (0); + miibus = device_get_parent(dev); parent = device_get_parent(miibus); @@ -269,6 +277,24 @@ micphy_attach(device_t dev) ksz9021_load_values(sc, node); return (0); +} + +static void +micphy_reset(struct mii_softc *sc) +{ + int reg; + + /* + * The 8081 has no "sticky bits" that survive a soft reset; several bits + * in the Phy Control Register 2 must be preserved across the reset. + * These bits are set up by the bootloader; they control how the phy + * interfaces to the board (such as clock frequency and LED behavior). + */ + if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ8081) + reg = PHY_READ(sc, MII_KSZ8081_PHYCTL2); + mii_phy_reset(sc); + if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ8081) + PHY_WRITE(sc, MII_KSZ8081_PHYCTL2, reg); } static int Modified: stable/11/sys/dev/mii/miidevs ============================================================================== --- stable/11/sys/dev/mii/miidevs Mon Sep 11 00:37:00 2017 (r323407) +++ stable/11/sys/dev/mii/miidevs Mon Sep 11 00:51:47 2017 (r323408) @@ -282,6 +282,7 @@ model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY /* Micrel PHYs */ +model MICREL KSZ8081 0x0016 Micrel KSZ8081 10/100 PHY model MICREL KSZ9021 0x0021 Micrel KSZ9021 10/100/1000 PHY model MICREL KSZ9031 0x0022 Micrel KSZ9031 10/100/1000 PHY From owner-svn-src-all@freebsd.org Mon Sep 11 00:55:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AE71E0E34F; Mon, 11 Sep 2017 00:55:20 +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 EB9F967EBA; Mon, 11 Sep 2017 00:55:19 +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 v8B0tJnk032178; Mon, 11 Sep 2017 00:55:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B0tISa032176; Mon, 11 Sep 2017 00:55:18 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110055.v8B0tISa032176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 00:55:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323409 - in stable/11/sys/boot: arm/uboot uboot/common X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys/boot: arm/uboot uboot/common X-SVN-Commit-Revision: 323409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 00:55:20 -0000 Author: ian Date: Mon Sep 11 00:55:18 2017 New Revision: 323409 URL: https://svnweb.freebsd.org/changeset/base/323409 Log: MFC r316374, r316377: Preserve the registers containing argc, argv, and return address values passed in from u-boot across the call to self_reloc and any other early-init code, and restore them before calling main(). Correct a comment... the stack used by ubldr is the same stack u-boot was running on when it jumped to the ubldr entry point. None of the arches that use this code set up a different stack in their start.S routines. Modified: stable/11/sys/boot/arm/uboot/start.S stable/11/sys/boot/uboot/common/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/arm/uboot/start.S ============================================================================== --- stable/11/sys/boot/arm/uboot/start.S Mon Sep 11 00:51:47 2017 (r323408) +++ stable/11/sys/boot/arm/uboot/start.S Mon Sep 11 00:55:18 2017 (r323409) @@ -45,6 +45,13 @@ _start: orr ip, ip, #(CPU_CONTROL_AFLT_ENABLE) mcr p15, 0, ip, c1, c0, 0 #endif + + /* + * Save r0 and r1 (argc and argv passed from u-boot), and lr (trashed + * by the call to self_reloc below) until we're ready to call main(). + */ + push {r0, r1, lr} + /* * Do self-relocation when the weak external symbol _DYNAMIC is non-NULL. * When linked as a dynamic relocatable file, the linker automatically @@ -71,9 +78,11 @@ _start: str r9, [ip, #4] /* + * First restore argc, argv, and the u-boot return address, then * Start loader. This is basically a tail-recursion call; if main() * returns, it returns to u-boot (which reports the value returned r0). */ + pop {r0, r1, lr} b main /* Modified: stable/11/sys/boot/uboot/common/main.c ============================================================================== --- stable/11/sys/boot/uboot/common/main.c Mon Sep 11 00:51:47 2017 (r323408) +++ stable/11/sys/boot/uboot/common/main.c Mon Sep 11 00:55:18 2017 (r323409) @@ -416,7 +416,9 @@ main(int argc, char **argv) /* * Initialise the heap as early as possible. Once this is done, - * alloc() is usable. The stack is buried inside us, so this is safe. + * alloc() is usable. We are using the stack u-boot set up near the top + * of physical ram; hopefully there is sufficient space between the end + * of our bss and the bottom of the u-boot stack to avoid overlap. */ uboot_heap_start = round_page((uintptr_t)end); uboot_heap_end = uboot_heap_start + 512 * 1024; From owner-svn-src-all@freebsd.org Mon Sep 11 01:01:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE75EE0E7EE; Mon, 11 Sep 2017 01:01:02 +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 99313681FA; Mon, 11 Sep 2017 01:01:02 +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 v8B111tx033190; Mon, 11 Sep 2017 01:01:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B111bg033184; Mon, 11 Sep 2017 01:01:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110101.v8B111bg033184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 01:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323410 - in stable/11/sys: arm/freescale/imx dev/ffec X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/freescale/imx dev/ffec X-SVN-Commit-Revision: 323410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 01:01:02 -0000 Author: ian Date: Mon Sep 11 01:01:00 2017 New Revision: 323410 URL: https://svnweb.freebsd.org/changeset/base/323410 Log: MFC r316664, r316670, r316972, r316996, r317033: Add imx6ul support (applies to all files). Add code/constants for detecting imx6ul (ultralite) chips, a species of imx6 based on a single cortex-a7 core. Other changes to imx6 drivers and support code are needed to fully support the imx6ul. if_ffec: Add imx6ul SoC support, and get the PHY number from the FDT data. If there is no phy-handle property, fall back to using MII_PHY_ANY. This still doesn't support an mdio bus with multiple PHYs on it, or the possibility that the PHY being used by this instance of ffec is on the mdio bus of some other instance (which is now a possibility with imx6ul). Adding that support will require changes in fdt_get_phyaddr(), which is currently making some assumptions that don't work with modern fdt data. Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/freescale/imx/imx6_usbphy.c stable/11/sys/arm/freescale/imx/imx_gpt.c stable/11/sys/arm/freescale/imx/imx_iomux.c stable/11/sys/arm/freescale/imx/imx_machdep.h stable/11/sys/dev/ffec/if_ffec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Sep 11 01:01:00 2017 (r323410) @@ -99,8 +99,8 @@ fix_fdt_interrupt_data(void) gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); if (gicnode == -1) { gicnode = OF_finddevice("/interrupt-controller@00a01000"); - if (gicnode == -1) - return; + if (gicnode == -1) + return; } gicxref = OF_xref_from_node(gicnode); @@ -233,6 +233,7 @@ u_int imx_soc_type() #define HWSOC_MX6DL 0x61 #define HWSOC_MX6SOLO 0x62 #define HWSOC_MX6Q 0x63 +#define HWSOC_MX6UL 0x64 if (soctype != 0) return (soctype); @@ -271,6 +272,9 @@ u_int imx_soc_type() case HWSOC_MX6Q : soctype = IMXSOC_6Q; break; + case HWSOC_MX6UL: + soctype = IMXSOC_6UL; + break; default: printf("imx_soc_type: Don't understand hwsoc 0x%02x, " "digprog 0x%08x; assuming IMXSOC_6Q\n", hwsoc, digprog); @@ -317,3 +321,4 @@ static platform_method_t imx6_methods[] = { FDT_PLATFORM_DEF2(imx6, imx6s, "i.MX6 Solo", 0, "fsl,imx6s", 0); FDT_PLATFORM_DEF2(imx6, imx6d, "i.MX6 Dual", 0, "fsl,imx6dl", 0); FDT_PLATFORM_DEF2(imx6, imx6q, "i.MX6 Quad", 0, "fsl,imx6q", 0); +FDT_PLATFORM_DEF2(imx6, imx6ul, "i.MX6 UltraLite", 0, "fsl,imx6ul", 0); Modified: stable/11/sys/arm/freescale/imx/imx6_usbphy.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_usbphy.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx6_usbphy.c Mon Sep 11 01:01:00 2017 (r323410) @@ -68,6 +68,12 @@ struct usbphy_softc { u_int phy_num; }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-usbphy", true}, + {"fsl,imx6ul-usbphy", true}, + {NULL, false} +}; + static int usbphy_detach(device_t dev) { @@ -167,7 +173,7 @@ usbphy_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "fsl,imx6q-usbphy") == 0) + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) return (ENXIO); device_set_desc(dev, "Freescale i.MX6 USB PHY"); Modified: stable/11/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_gpt.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx_gpt.c Mon Sep 11 01:01:00 2017 (r323410) @@ -112,6 +112,7 @@ static struct resource_spec imx_gpt_spec[] = { static struct ofw_compat_data compat_data[] = { {"fsl,imx6dl-gpt", 1}, {"fsl,imx6q-gpt", 1}, + {"fsl,imx6ul-gpt", 1}, {"fsl,imx53-gpt", 1}, {"fsl,imx51-gpt", 1}, {"fsl,imx31-gpt", 1}, @@ -125,6 +126,15 @@ imx_gpt_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + /* + * We only support a single unit, because the only thing this driver + * does with the complex timer hardware is supply the system + * timecounter and eventtimer. There is nothing useful we can do with + * the additional device instances that exist in some chips. + */ + if (device_get_unit(dev) > 0) return (ENXIO); if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { Modified: stable/11/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_iomux.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx_iomux.c Mon Sep 11 01:01:00 2017 (r323410) @@ -80,6 +80,7 @@ static struct ofw_compat_data compat_data[] = { {"fsl,imx6dl-iomuxc", true}, {"fsl,imx6q-iomuxc", true}, {"fsl,imx6sl-iomuxc", true}, + {"fsl,imx6ul-iomuxc", true}, {"fsl,imx6sx-iomuxc", true}, {"fsl,imx53-iomuxc", true}, {"fsl,imx51-iomuxc", true}, @@ -223,6 +224,9 @@ iomux_attach(device_t dev) case IMXSOC_6SL: case IMXSOC_6Q: sc->last_gpreg = 13; + break; + case IMXSOC_6UL: + sc->last_gpreg = 14; break; default: device_printf(dev, "Unknown SoC type\n"); Modified: stable/11/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_machdep.h Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx_machdep.h Mon Sep 11 01:01:00 2017 (r323410) @@ -55,6 +55,7 @@ void imx_wdog_init_last_reset(vm_offset_t _wdsr_phys); #define IMXSOC_6DL 0x61000000 #define IMXSOC_6S 0x62000000 #define IMXSOC_6Q 0x63000000 +#define IMXSOC_6UL 0x64000000 #define IMXSOC_FAMSHIFT 28 u_int imx_soc_type(void); Modified: stable/11/sys/dev/ffec/if_ffec.c ============================================================================== --- stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 01:01:00 2017 (r323410) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -113,6 +114,7 @@ static struct ofw_compat_data compat_data[] = { {"fsl,imx51-fec", FECTYPE_GENERIC}, {"fsl,imx53-fec", FECTYPE_IMX53}, {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, + {"fsl,imx6ul-fec", FECTYPE_IMX6}, {"fsl,mvf600-fec", FECTYPE_MVF}, {"fsl,mvf-fec", FECTYPE_MVF}, {NULL, FECTYPE_NONE}, @@ -1424,8 +1426,9 @@ ffec_attach(device_t dev) struct ffec_softc *sc; struct ifnet *ifp = NULL; struct mbuf *m; + void *dummy; phandle_t ofw_node; - int error, rid; + int error, phynum, rid; uint8_t eaddr[ETHER_ADDR_LEN]; char phy_conn_name[32]; uint32_t idx, mscr; @@ -1695,8 +1698,11 @@ ffec_attach(device_t dev) ffec_miigasket_setup(sc); /* Attach the mii driver. */ + if (fdt_get_phyaddr(ofw_node, dev, &phynum, &dummy) != 0) { + phynum = MII_PHY_ANY; + } error = mii_attach(dev, &sc->miibus, ifp, ffec_media_change, - ffec_media_status, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + ffec_media_status, BMSR_DEFCAPMASK, phynum, MII_OFFSET_ANY, (sc->fectype & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); if (error != 0) { device_printf(dev, "PHY attach failed\n"); From owner-svn-src-all@freebsd.org Mon Sep 11 01:26:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3AF1E0FE54; Mon, 11 Sep 2017 01:26: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 7F6276933B; Mon, 11 Sep 2017 01:26: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 v8B1QQhu044461; Mon, 11 Sep 2017 01:26:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B1QQxF044459; Mon, 11 Sep 2017 01:26:26 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110126.v8B1QQxF044459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 01:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323411 - in stable/11/sys: dev/ffec modules modules/ffec X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: dev/ffec modules modules/ffec X-SVN-Commit-Revision: 323411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 01:26:27 -0000 Author: ian Date: Mon Sep 11 01:26:26 2017 New Revision: 323411 URL: https://svnweb.freebsd.org/changeset/base/323411 Log: MFC r319811, r319813: Allow building if_ffec as a module. if_ffec bugfixes related to harvesting of hardware-maintained statistics... After harvesting the hardware statistics counters and summing them into the interface stats, properly clear the hardware counters back to zero. On imx5 and earlier hardware it is necessary to disable collection of stats while writing zeroes to all the registers. On imx6 and newer it turns out it's not even possible to write zeroes, instead you have to toggle a special "zero everything" control bit in a register. Count incoming packets with a bad start frame delim as input errors, and incoming packets dropped due to no fifo space as input drops. Remove all code related to harvesting the hardware stats less often than once per second. It turns out the 32-bit stats registers are backed by 16-bit counters under the hood, and they can easily roll over if you only harvest them once every 3 seconds like the old code was doing. Now we just read all the regs once a second. The combination of not properly zeroing the stats registers and 16-bit counters sometimes wrapping between harvest calls resulted in basically unusable statistics before these changes. Added: stable/11/sys/modules/ffec/ - copied from r319813, head/sys/modules/ffec/ Modified: stable/11/sys/dev/ffec/if_ffec.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ffec/if_ffec.c ============================================================================== --- stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 01:01:00 2017 (r323410) +++ stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 01:26:26 2017 (r323411) @@ -129,7 +129,6 @@ static struct ofw_compat_data compat_data[] = { #define TX_DESC_SIZE (sizeof(struct ffec_hwdesc) * TX_DESC_COUNT) #define WATCHDOG_TIMEOUT_SECS 5 -#define STATS_HARVEST_INTERVAL 3 struct ffec_bufmap { struct mbuf *mbuf; @@ -160,7 +159,6 @@ struct ffec_softc { boolean_t is_attached; boolean_t is_detaching; int tx_watchdog_count; - int stats_harvest_count; bus_dma_tag_t rxdesc_tag; bus_dmamap_t rxdesc_map; @@ -462,22 +460,41 @@ ffec_media_change(struct ifnet * ifp) static void ffec_clear_stats(struct ffec_softc *sc) { + uint32_t mibc; - WR4(sc, FEC_RMON_R_PACKETS, 0); - WR4(sc, FEC_RMON_R_MC_PKT, 0); - WR4(sc, FEC_RMON_R_CRC_ALIGN, 0); - WR4(sc, FEC_RMON_R_UNDERSIZE, 0); - WR4(sc, FEC_RMON_R_OVERSIZE, 0); - WR4(sc, FEC_RMON_R_FRAG, 0); - WR4(sc, FEC_RMON_R_JAB, 0); - WR4(sc, FEC_RMON_T_PACKETS, 0); - WR4(sc, FEC_RMON_T_MC_PKT, 0); - WR4(sc, FEC_RMON_T_CRC_ALIGN, 0); - WR4(sc, FEC_RMON_T_UNDERSIZE, 0); - WR4(sc, FEC_RMON_T_OVERSIZE , 0); - WR4(sc, FEC_RMON_T_FRAG, 0); - WR4(sc, FEC_RMON_T_JAB, 0); - WR4(sc, FEC_RMON_T_COL, 0); + mibc = RD4(sc, FEC_MIBC_REG); + + /* + * On newer hardware the statistic regs are cleared by toggling a bit in + * the mib control register. On older hardware the clear procedure is + * to disable statistics collection, zero the regs, then re-enable. + */ + if (sc->fectype == FECTYPE_IMX6 || sc->fectype == FECTYPE_MVF) { + WR4(sc, FEC_MIBC_REG, mibc | FEC_MIBC_CLEAR); + WR4(sc, FEC_MIBC_REG, mibc & ~FEC_MIBC_CLEAR); + } else { + WR4(sc, FEC_MIBC_REG, mibc | FEC_MIBC_DIS); + + WR4(sc, FEC_IEEE_R_DROP, 0); + WR4(sc, FEC_IEEE_R_MACERR, 0); + WR4(sc, FEC_RMON_R_CRC_ALIGN, 0); + WR4(sc, FEC_RMON_R_FRAG, 0); + WR4(sc, FEC_RMON_R_JAB, 0); + WR4(sc, FEC_RMON_R_MC_PKT, 0); + WR4(sc, FEC_RMON_R_OVERSIZE, 0); + WR4(sc, FEC_RMON_R_PACKETS, 0); + WR4(sc, FEC_RMON_R_UNDERSIZE, 0); + WR4(sc, FEC_RMON_T_COL, 0); + WR4(sc, FEC_RMON_T_CRC_ALIGN, 0); + WR4(sc, FEC_RMON_T_FRAG, 0); + WR4(sc, FEC_RMON_T_JAB, 0); + WR4(sc, FEC_RMON_T_MC_PKT, 0); + WR4(sc, FEC_RMON_T_OVERSIZE , 0); + WR4(sc, FEC_RMON_T_PACKETS, 0); + WR4(sc, FEC_RMON_T_UNDERSIZE, 0); + + WR4(sc, FEC_MIBC_REG, mibc); + } } static void @@ -485,29 +502,22 @@ ffec_harvest_stats(struct ffec_softc *sc) { struct ifnet *ifp; - /* We don't need to harvest too often. */ - if (++sc->stats_harvest_count < STATS_HARVEST_INTERVAL) - return; + ifp = sc->ifp; /* - * Try to avoid harvesting unless the IDLE flag is on, but if it has - * been too long just go ahead and do it anyway, the worst that'll - * happen is we'll lose a packet count or two as we clear at the end. + * - FEC_IEEE_R_DROP is "dropped due to invalid start frame delimiter" + * so it's really just another type of input error. + * - FEC_IEEE_R_MACERR is "no receive fifo space"; count as input drops. */ - if (sc->stats_harvest_count < (2 * STATS_HARVEST_INTERVAL) && - ((RD4(sc, FEC_MIBC_REG) & FEC_MIBC_IDLE) == 0)) - return; - - sc->stats_harvest_count = 0; - ifp = sc->ifp; - if_inc_counter(ifp, IFCOUNTER_IPACKETS, RD4(sc, FEC_RMON_R_PACKETS)); if_inc_counter(ifp, IFCOUNTER_IMCASTS, RD4(sc, FEC_RMON_R_MC_PKT)); if_inc_counter(ifp, IFCOUNTER_IERRORS, RD4(sc, FEC_RMON_R_CRC_ALIGN) + RD4(sc, FEC_RMON_R_UNDERSIZE) + RD4(sc, FEC_RMON_R_OVERSIZE) + RD4(sc, FEC_RMON_R_FRAG) + - RD4(sc, FEC_RMON_R_JAB)); + RD4(sc, FEC_RMON_R_JAB) + RD4(sc, FEC_IEEE_R_DROP)); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, RD4(sc, FEC_IEEE_R_MACERR)); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, RD4(sc, FEC_RMON_T_PACKETS)); if_inc_counter(ifp, IFCOUNTER_OMCASTS, RD4(sc, FEC_RMON_T_MC_PKT)); if_inc_counter(ifp, IFCOUNTER_OERRORS, @@ -1016,7 +1026,6 @@ ffec_stop_locked(struct ffec_softc *sc) ifp = sc->ifp; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->tx_watchdog_count = 0; - sc->stats_harvest_count = 0; /* * Stop the hardware, mask all interrupts, and clear all current @@ -1194,7 +1203,8 @@ ffec_init_locked(struct ffec_softc *sc) WR4(sc, FEC_IEM_REG, FEC_IER_TXF | FEC_IER_RXF | FEC_IER_EBERR); /* - * MIBC - MIB control (hardware stats). + * MIBC - MIB control (hardware stats); clear all statistics regs, then + * enable collection of statistics. */ regval = RD4(sc, FEC_MIBC_REG); WR4(sc, FEC_MIBC_REG, regval | FEC_MIBC_DIS); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Mon Sep 11 01:01:00 2017 (r323410) +++ stable/11/sys/modules/Makefile Mon Sep 11 01:26:26 2017 (r323411) @@ -123,6 +123,7 @@ SUBDIR= \ fdc \ fdescfs \ ${_fe} \ + ${_ffec} \ filemon \ firewire \ firmware \ @@ -790,6 +791,7 @@ _cpufreq= cpufreq _drm= drm _exca= exca _nvram= powermac_nvram +_ffec= ffec _pccard= pccard _wi= wi .endif @@ -813,6 +815,10 @@ _cloudabi32= cloudabi32 _cloudabi64= cloudabi64 .endif +.endif + +.if ${MACHINE_ARCH} == "armv6" +_ffec= ffec .endif SUBDIR+=${MODULES_EXTRA} From owner-svn-src-all@freebsd.org Mon Sep 11 01:51:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96869E113F4; Mon, 11 Sep 2017 01:51:29 +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 6203F69FA2; Mon, 11 Sep 2017 01:51:29 +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 v8B1pSqt053956; Mon, 11 Sep 2017 01:51:28 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B1pRQR053947; Mon, 11 Sep 2017 01:51:27 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709110151.v8B1pRQR053947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 11 Sep 2017 01:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323412 - 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: 323412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 01:51:29 -0000 Author: scottl Date: Mon Sep 11 01:51:27 2017 New Revision: 323412 URL: https://svnweb.freebsd.org/changeset/base/323412 Log: Add infrastructure for allocating multiple MSI-X interrupts. Also add more fine-tuned controls for allocating requests and replies. Sponsored by: Netflix Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_pci.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_pci.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mpr/mpr.c Mon Sep 11 01:51:27 2017 (r323412) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); static int mpr_diag_reset(struct mpr_softc *sc, int sleep_flag); static int mpr_init_queues(struct mpr_softc *sc); +static void mpr_resize_queues(struct mpr_softc *sc); static int mpr_message_unit_reset(struct mpr_softc *sc, int sleep_flag); static int mpr_transition_operational(struct mpr_softc *sc); static int mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t attaching); @@ -374,6 +375,46 @@ mpr_transition_operational(struct mpr_softc *sc) return (error); } +static void +mpr_resize_queues(struct mpr_softc *sc) +{ + int reqcr, prireqcr; + + /* + * Size the queues. Since the reply queues always need one free + * entry, we'll deduct one reply message here. The LSI documents + * suggest instead to add a count to the request queue, but I think + * that it's better to deduct from reply queue. + */ + prireqcr = MAX(1, sc->max_prireqframes); + prireqcr = MIN(prireqcr, sc->facts->HighPriorityCredit); + + reqcr = MAX(2, sc->max_reqframes); + reqcr = MIN(reqcr, sc->facts->RequestCredit); + + sc->num_reqs = prireqcr + reqcr; + sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes, + sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; + + /* + * Figure out the number of MSIx-based queues. If the firmware or + * user has done something crazy and not allowed enough credit for + * the queues to be useful then don't enable multi-queue. + */ + if (sc->facts->MaxMSIxVectors < 2) + sc->msi_msgs = 1; + + if (sc->msi_msgs > 1) { + sc->msi_msgs = MIN(sc->msi_msgs, mp_ncpus); + sc->msi_msgs = MIN(sc->msi_msgs, sc->facts->MaxMSIxVectors); + if (sc->num_reqs / sc->msi_msgs < 2) + sc->msi_msgs = 1; + } + + mpr_dprint(sc, MPR_INIT, "Sized queues to q=%d reqs=%d replies=%d\n", + sc->msi_msgs, sc->num_reqs, sc->num_replies); +} + /* * This is called during attach and when re-initializing due to a Diag Reset. * IOC Facts is used to allocate many of the structures needed by the driver. @@ -530,13 +571,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at MPI26_IOCFACTS_CAPABILITY_ATOMIC_REQ) sc->atomic_desc_capable = TRUE; - /* - * Size the queues. Since the reply queues always need one free - * entry, we'll just deduct one reply message here. - */ - sc->num_reqs = MIN(MPR_REQ_FRAMES, sc->facts->RequestCredit); - sc->num_replies = MIN(MPR_REPLY_FRAMES + MPR_EVT_REPLY_FRAMES, - sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; + mpr_resize_queues(sc); /* * Initialize all Tail Queues @@ -1146,11 +1181,11 @@ mpr_alloc_queues(struct mpr_softc *sc) struct mpr_queue *q; int nq, i; - nq = MIN(sc->msi_msgs, mp_ncpus); - sc->msi_msgs = nq; + nq = sc->msi_msgs; mpr_dprint(sc, MPR_INIT|MPR_XINFO, "Allocating %d I/O queues\n", nq); - sc->queues = malloc(sizeof(struct mpr_queue) * nq, M_MPR, M_NOWAIT|M_ZERO); + sc->queues = malloc(sizeof(struct mpr_queue) * nq, M_MPR, + M_NOWAIT|M_ZERO); if (sc->queues == NULL) return (ENOMEM); @@ -1562,11 +1597,16 @@ mpr_get_tunables(struct mpr_softc *sc) sc->mpr_debug = MPR_INFO | MPR_FAULT; sc->disable_msix = 0; sc->disable_msi = 0; + sc->max_msix = MPR_MSIX_MAX; sc->max_chains = MPR_CHAIN_FRAMES; sc->max_io_pages = MPR_MAXIO_PAGES; sc->enable_ssu = MPR_SSU_ENABLE_SSD_DISABLE_HDD; sc->spinup_wait_time = DEFAULT_SPINUP_WAIT; sc->use_phynum = 1; + sc->max_reqframes = MPR_REQ_FRAMES; + sc->max_prireqframes = MPR_PRI_REQ_FRAMES; + sc->max_replyframes = MPR_REPLY_FRAMES; + sc->max_evtframes = MPR_EVT_REPLY_FRAMES; /* * Grab the global variables. @@ -1574,11 +1614,16 @@ mpr_get_tunables(struct mpr_softc *sc) TUNABLE_INT_FETCH("hw.mpr.debug_level", &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); TUNABLE_INT_FETCH("hw.mpr.max_chains", &sc->max_chains); TUNABLE_INT_FETCH("hw.mpr.max_io_pages", &sc->max_io_pages); TUNABLE_INT_FETCH("hw.mpr.enable_ssu", &sc->enable_ssu); TUNABLE_INT_FETCH("hw.mpr.spinup_wait_time", &sc->spinup_wait_time); TUNABLE_INT_FETCH("hw.mpr.use_phy_num", &sc->use_phynum); + TUNABLE_INT_FETCH("hw.mpr.max_reqframes", &sc->max_reqframes); + TUNABLE_INT_FETCH("hw.mpr.max_prireqframes", &sc->max_prireqframes); + TUNABLE_INT_FETCH("hw.mpr.max_replyframes", &sc->max_replyframes); + TUNABLE_INT_FETCH("hw.mpr.max_evtframes", &sc->max_evtframes); /* Grab the unit-instance variables */ snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.debug_level", @@ -1593,6 +1638,10 @@ mpr_get_tunables(struct mpr_softc *sc) device_get_unit(sc->mpr_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->disable_msi); + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_msix", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_msix); + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_chains", device_get_unit(sc->mpr_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->max_chains); @@ -1617,6 +1666,22 @@ mpr_get_tunables(struct mpr_softc *sc) snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.use_phy_num", device_get_unit(sc->mpr_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->use_phynum); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_reqframes", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_reqframes); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_prireqframes", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_prireqframes); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_replyframes", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_replyframes); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_evtframes", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_evtframes); } static void @@ -1658,8 +1723,28 @@ mpr_setup_sysctl(struct mpr_softc *sc) "Disable the use of MSI-X interrupts"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "disable_msi", CTLFLAG_RD, &sc->disable_msi, 0, - "Disable the use of MSI interrupts"); + OID_AUTO, "max_msix", CTLFLAG_RD, &sc->max_msix, 0, + "User-defined maximum number of MSIX queues"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "msix_msgs", CTLFLAG_RD, &sc->msi_msgs, 0, + "Negotiated number of MSIX queues"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_reqframes", CTLFLAG_RD, &sc->max_reqframes, 0, + "Total number of allocated request frames"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_prireqframes", CTLFLAG_RD, &sc->max_prireqframes, 0, + "Total number of allocated high priority request frames"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_replyframes", CTLFLAG_RD, &sc->max_replyframes, 0, + "Total number of allocated reply frames"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_evtframes", CTLFLAG_RD, &sc->max_evtframes, 0, + "Total number of event frames allocated"); SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "firmware_version", CTLFLAG_RW, sc->fw_version, Modified: head/sys/dev/mpr/mpr_pci.c ============================================================================== --- head/sys/dev/mpr/mpr_pci.c Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mpr/mpr_pci.c Mon Sep 11 01:51:27 2017 (r323412) @@ -262,23 +262,38 @@ mpr_pci_alloc_interrupts(struct mpr_softc *sc) error = 0; msgs = 0; - if ((sc->disable_msix == 0) && - ((msgs = pci_msix_count(dev)) >= MPR_MSI_COUNT)) - error = mpr_alloc_msix(sc, MPR_MSI_COUNT); - if ((error != 0) && (sc->disable_msi == 0) && - ((msgs = pci_msi_count(dev)) >= MPR_MSI_COUNT)) - error = mpr_alloc_msi(sc, MPR_MSI_COUNT); - if (error != 0) { + if (sc->disable_msix == 0) { + msgs = pci_msix_count(dev); + mpr_dprint(sc, MPR_INIT, "Counted %d MSI-X messages\n", msgs); + msgs = min(msgs, sc->max_msix); + msgs = min(msgs, MPR_MSIX_MAX); + msgs = min(msgs, 1); /* XXX */ + if (msgs != 0) { + mpr_dprint(sc, MPR_INIT, "Attempting to allocate %d MSI-X " + "messages\n", msgs); + error = mpr_alloc_msix(sc, msgs); + } + } + if (((error != 0) || (msgs == 0)) && (sc->disable_msi == 0)) { + msgs = pci_msi_count(dev); + mpr_dprint(sc, MPR_INIT, "Counted %d MSI messages\n", msgs); + msgs = min(msgs, MPR_MSI_MAX); + if (msgs != 0) { + mpr_dprint(sc, MPR_INIT, "Attempting to allocated %d MSI " + "messages\n", MPR_MSI_MAX); + error = mpr_alloc_msi(sc, MPR_MSI_MAX); + } + } + if ((error != 0) || (msgs == 0)) { /* * If neither MSI or MSI-X are available, assume legacy INTx. * This also implies that there will be only 1 queue. */ + mpr_dprint(sc, MPR_INIT, "Falling back to legacy INTx\n"); sc->mpr_flags |= MPR_FLAGS_INTX; msgs = 1; - } else { + } else sc->mpr_flags |= MPR_FLAGS_MSI; - msgs = MPR_MSI_COUNT; /* XXX */ - } sc->msi_msgs = msgs; mpr_dprint(sc, MPR_INIT, "Allocated %d interrupts\n", msgs); @@ -318,6 +333,7 @@ mpr_pci_setup_interrupts(struct mpr_softc *sc) if (q->irq == NULL) { mpr_dprint(sc, MPR_ERROR|MPR_INIT, "Cannot allocate interrupt RID %d\n", rid); + sc->msi_msgs = i; break; } error = bus_setup_intr(dev, q->irq, @@ -326,6 +342,7 @@ mpr_pci_setup_interrupts(struct mpr_softc *sc) if (error) { mpr_dprint(sc, MPR_ERROR|MPR_INIT, "Cannot setup interrupt RID %d\n", rid); + sc->msi_msgs = i; break; } } Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mpr/mpr_sas.c Mon Sep 11 01:51:27 2017 (r323412) @@ -924,6 +924,9 @@ mpr_detach_sas(struct mpr_softc *sc) /* Make sure CAM doesn't wedge if we had to bail out early. */ mpr_lock(sc); + while (sassc->startup_refcount != 0) + mprsas_startup_decrement(sassc); + /* Deregister our async handler */ if (sassc->path != NULL) { xpt_register_async(0, mprsas_async, sc, sassc->path); Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mpr/mprvar.h Mon Sep 11 01:51:27 2017 (r323412) @@ -37,13 +37,15 @@ #define MPR_DB_MAX_WAIT 2500 -#define MPR_REQ_FRAMES 1024 +#define MPR_REQ_FRAMES 2048 +#define MPR_PRI_REQ_FRAMES 128 #define MPR_EVT_REPLY_FRAMES 32 #define MPR_REPLY_FRAMES MPR_REQ_FRAMES #define MPR_CHAIN_FRAMES 2048 #define MPR_MAXIO_PAGES (-1) #define MPR_SENSE_LEN SSD_FULL_SIZE -#define MPR_MSI_COUNT 1 +#define MPR_MSI_MAX 1 +#define MPR_MSIX_MAX 96 #define MPR_SGE64_SIZE 12 #define MPR_SGE32_SIZE 8 #define MPR_SGC_SIZE 8 @@ -296,8 +298,6 @@ struct mpr_softc { #define MPR_FLAGS_GEN35_IOC (1 << 6) #define MPR_FLAGS_REALLOCATED (1 << 7) u_int mpr_debug; - u_int disable_msix; - u_int disable_msi; int msi_msgs; u_int atomic_desc_capable; int tm_cmds_active; @@ -446,7 +446,16 @@ struct mpr_softc { uint32_t SSU_refcount; uint8_t SSU_started; + /* Configuration tunables */ + u_int disable_msix; + u_int disable_msi; + u_int max_msix; + u_int max_reqframes; + u_int max_prireqframes; + u_int max_replyframes; + u_int max_evtframes; char exclude_ids[80]; + struct timeval lastfail; }; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mps/mps.c Mon Sep 11 01:51:27 2017 (r323412) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); static int mps_diag_reset(struct mps_softc *sc, int sleep_flag); static int mps_init_queues(struct mps_softc *sc); +static void mps_resize_queues(struct mps_softc *sc); static int mps_message_unit_reset(struct mps_softc *sc, int sleep_flag); static int mps_transition_operational(struct mps_softc *sc); static int mps_iocfacts_allocate(struct mps_softc *sc, uint8_t attaching); @@ -368,6 +369,46 @@ mps_transition_operational(struct mps_softc *sc) return (error); } +static void +mps_resize_queues(struct mps_softc *sc) +{ + int reqcr, prireqcr; + + /* + * Size the queues. Since the reply queues always need one free + * entry, we'll deduct one reply message here. The LSI documents + * suggest instead to add a count to the request queue, but I think + * that it's better to deduct from reply queue. + */ + prireqcr = MAX(1, sc->max_prireqframes); + prireqcr = MIN(prireqcr, sc->facts->HighPriorityCredit); + + reqcr = MAX(2, sc->max_reqframes); + reqcr = MIN(reqcr, sc->facts->RequestCredit); + + sc->num_reqs = prireqcr + reqcr; + sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes, + sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; + + /* + * Figure out the number of MSIx-based queues. If the firmware or + * user has done something crazy and not allowed enough credit for + * the queues to be useful then don't enable multi-queue. + */ + if (sc->facts->MaxMSIxVectors < 2) + sc->msi_msgs = 1; + + if (sc->msi_msgs > 1) { + sc->msi_msgs = MIN(sc->msi_msgs, mp_ncpus); + sc->msi_msgs = MIN(sc->msi_msgs, sc->facts->MaxMSIxVectors); + if (sc->num_reqs / sc->msi_msgs < 2) + sc->msi_msgs = 1; + } + + mps_dprint(sc, MPS_INIT, "Sized queues to q=%d reqs=%d replies=%d\n", + sc->msi_msgs, sc->num_reqs, sc->num_replies); +} + /* * This is called during attach and when re-initializing due to a Diag Reset. * IOC Facts is used to allocate many of the structures needed by the driver. @@ -518,13 +559,7 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at if (sc->facts->IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) sc->control_TLR = TRUE; - /* - * Size the queues. Since the reply queues always need one free - * entry, we'll just deduct one reply message here. - */ - sc->num_reqs = MIN(MPS_REQ_FRAMES, sc->facts->RequestCredit); - sc->num_replies = MIN(MPS_REPLY_FRAMES + MPS_EVT_REPLY_FRAMES, - sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; + mps_resize_queues(sc); /* * Initialize all Tail Queues @@ -1121,11 +1156,11 @@ mps_alloc_queues(struct mps_softc *sc) struct mps_queue *q; int nq, i; - nq = MIN(sc->msi_msgs, mp_ncpus); - sc->msi_msgs = nq; + nq = sc->msi_msgs; mps_dprint(sc, MPS_INIT|MPS_XINFO, "Allocating %d I/O queues\n", nq); - sc->queues = malloc(sizeof(struct mps_queue) * nq, M_MPT2, M_NOWAIT|M_ZERO); + sc->queues = malloc(sizeof(struct mps_queue) * nq, M_MPT2, + M_NOWAIT|M_ZERO); if (sc->queues == NULL) return (ENOMEM); @@ -1423,11 +1458,16 @@ mps_get_tunables(struct mps_softc *sc) sc->mps_debug = MPS_INFO|MPS_FAULT; sc->disable_msix = 0; sc->disable_msi = 0; + sc->max_msix = MPS_MSIX_MAX; sc->max_chains = MPS_CHAIN_FRAMES; sc->max_io_pages = MPS_MAXIO_PAGES; sc->enable_ssu = MPS_SSU_ENABLE_SSD_DISABLE_HDD; sc->spinup_wait_time = DEFAULT_SPINUP_WAIT; sc->use_phynum = 1; + sc->max_reqframes = MPS_REQ_FRAMES; + sc->max_prireqframes = MPS_PRI_REQ_FRAMES; + sc->max_replyframes = MPS_REPLY_FRAMES; + sc->max_evtframes = MPS_EVT_REPLY_FRAMES; /* * Grab the global variables. @@ -1435,11 +1475,16 @@ mps_get_tunables(struct mps_softc *sc) TUNABLE_INT_FETCH("hw.mps.debug_level", &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); TUNABLE_INT_FETCH("hw.mps.max_chains", &sc->max_chains); TUNABLE_INT_FETCH("hw.mps.max_io_pages", &sc->max_io_pages); TUNABLE_INT_FETCH("hw.mps.enable_ssu", &sc->enable_ssu); TUNABLE_INT_FETCH("hw.mps.spinup_wait_time", &sc->spinup_wait_time); TUNABLE_INT_FETCH("hw.mps.use_phy_num", &sc->use_phynum); + TUNABLE_INT_FETCH("hw.mps.max_reqframes", &sc->max_reqframes); + TUNABLE_INT_FETCH("hw.mps.max_prireqframes", &sc->max_prireqframes); + TUNABLE_INT_FETCH("hw.mps.max_replyframes", &sc->max_replyframes); + TUNABLE_INT_FETCH("hw.mps.max_evtframes", &sc->max_evtframes); /* Grab the unit-instance variables */ snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.debug_level", @@ -1454,6 +1499,10 @@ mps_get_tunables(struct mps_softc *sc) device_get_unit(sc->mps_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->disable_msi); + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_msix", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_msix); + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_chains", device_get_unit(sc->mps_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->max_chains); @@ -1478,6 +1527,23 @@ mps_get_tunables(struct mps_softc *sc) snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.use_phy_num", device_get_unit(sc->mps_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->use_phynum); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_reqframes", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_reqframes); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_prireqframes", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_prireqframes); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_replyframes", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_replyframes); + + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_evtframes", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_evtframes); + } static void @@ -1521,6 +1587,30 @@ mps_setup_sysctl(struct mps_softc *sc) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "disable_msi", CTLFLAG_RD, &sc->disable_msi, 0, "Disable the use of MSI interrupts"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_msix", CTLFLAG_RD, &sc->max_msix, 0, + "User-defined maximum number of MSIX queues"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "msix_msgs", CTLFLAG_RD, &sc->msi_msgs, 0, + "Negotiated number of MSIX queues"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_reqframes", CTLFLAG_RD, &sc->max_reqframes, 0, + "Total number of allocated request frames"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_prireqframes", CTLFLAG_RD, &sc->max_prireqframes, 0, + "Total number of allocated high priority request frames"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_replyframes", CTLFLAG_RD, &sc->max_replyframes, 0, + "Total number of allocated reply frames"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_evtframes", CTLFLAG_RD, &sc->max_evtframes, 0, + "Total number of event frames allocated"); SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "firmware_version", CTLFLAG_RW, sc->fw_version, Modified: head/sys/dev/mps/mps_pci.c ============================================================================== --- head/sys/dev/mps/mps_pci.c Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mps/mps_pci.c Mon Sep 11 01:51:27 2017 (r323412) @@ -247,23 +247,38 @@ mps_pci_alloc_interrupts(struct mps_softc *sc) error = 0; msgs = 0; - if ((sc->disable_msix == 0) && - ((msgs = pci_msix_count(dev)) >= MPS_MSI_COUNT)) - error = mps_alloc_msix(sc, MPS_MSI_COUNT); - if ((error != 0) && (sc->disable_msi == 0) && - ((msgs = pci_msi_count(dev)) >= MPS_MSI_COUNT)) - error = mps_alloc_msi(sc, MPS_MSI_COUNT); - if (error != 0) { + if (sc->disable_msix == 0) { + msgs = pci_msix_count(dev); + mps_dprint(sc, MPS_INIT, "Counted %d MSI-X messages\n", msgs); + msgs = min(msgs, sc->max_msix); + msgs = min(msgs, MPS_MSIX_MAX); + msgs = min(msgs, 1); /* XXX */ + if (msgs != 0) { + mps_dprint(sc, MPS_INIT, "Attempting to allocate %d MSI-X " + "messages\n", msgs); + error = mps_alloc_msix(sc, msgs); + } + } + if (((error != 0) || (msgs == 0)) && (sc->disable_msi == 0)) { + msgs = pci_msi_count(dev); + mps_dprint(sc, MPS_INIT, "Counted %d MSI messages\n", msgs); + msgs = min(msgs, MPS_MSI_MAX); + if (msgs != 0) { + mps_dprint(sc, MPS_INIT, "Attempting to allocate %d MSI " + "messages\n", MPS_MSI_MAX); + error = mps_alloc_msi(sc, MPS_MSI_MAX); + } + } + if ((error != 0) || (msgs == 0)) { /* * If neither MSI or MSI-X are avaiable, assume legacy INTx. * This also implies that there will be only 1 queue. */ + mps_dprint(sc, MPS_INIT, "Falling back to legacy INTx\n"); sc->mps_flags |= MPS_FLAGS_INTX; msgs = 1; - } else { + } else sc->mps_flags |= MPS_FLAGS_MSI; - msgs = 1; /* XXX */ - } sc->msi_msgs = msgs; mps_dprint(sc, MPS_INIT, "Allocated %d interrupts\n", msgs); @@ -302,7 +317,8 @@ mps_pci_setup_interrupts(struct mps_softc *sc) &q->irq_rid, RF_ACTIVE); if (q->irq == NULL) { mps_dprint(sc, MPS_ERROR|MPS_INIT, - "Cannot allocate interrupt RID%d\n", rid); + "Cannot allocate interrupt RID %d\n", rid); + sc->msi_msgs = i; break; } error = bus_setup_intr(dev, q->irq, @@ -311,6 +327,7 @@ mps_pci_setup_interrupts(struct mps_softc *sc) if (error) { mps_dprint(sc, MPS_ERROR|MPS_INIT, "Cannot setup interrupt RID %d\n", rid); + sc->msi_msgs = i; break; } } Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mps/mps_sas.c Mon Sep 11 01:51:27 2017 (r323412) @@ -871,6 +871,9 @@ mps_detach_sas(struct mps_softc *sc) /* Make sure CAM doesn't wedge if we had to bail out early. */ mps_lock(sc); + while (sassc->startup_refcount != 0) + mpssas_startup_decrement(sassc); + /* Deregister our async handler */ if (sassc->path != NULL) { xpt_register_async(0, mpssas_async, sc, sassc->path); Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Mon Sep 11 01:26:26 2017 (r323411) +++ head/sys/dev/mps/mpsvar.h Mon Sep 11 01:51:27 2017 (r323412) @@ -37,13 +37,15 @@ #define MPS_DB_MAX_WAIT 2500 -#define MPS_REQ_FRAMES 1024 +#define MPS_REQ_FRAMES 2048 +#define MPS_PRI_REQ_FRAMES 128 #define MPS_EVT_REPLY_FRAMES 32 #define MPS_REPLY_FRAMES MPS_REQ_FRAMES #define MPS_CHAIN_FRAMES 2048 #define MPS_MAXIO_PAGES (-1) #define MPS_SENSE_LEN SSD_FULL_SIZE -#define MPS_MSI_COUNT 1 +#define MPS_MSI_MAX 1 +#define MPS_MSIX_MAX 16 #define MPS_SGE64_SIZE 12 #define MPS_SGE32_SIZE 8 #define MPS_SGC_SIZE 8 @@ -292,8 +294,6 @@ struct mps_softc { #define MPS_FLAGS_WD_AVAILABLE (1 << 6) #define MPS_FLAGS_REALLOCATED (1 << 7) u_int mps_debug; - u_int disable_msix; - u_int disable_msi; u_int msi_msgs; int tm_cmds_active; int io_cmds_active; @@ -437,12 +437,21 @@ struct mps_softc { uint64_t DD_max_lba; struct mps_column_map DD_column_map[MPS_MAX_DISKS_IN_VOL]; - char exclude_ids[80]; - struct timeval lastfail; - /* StartStopUnit command handling at shutdown */ uint32_t SSU_refcount; uint8_t SSU_started; + + /* Configuration tunables */ + u_int disable_msix; + u_int disable_msi; + u_int max_msix; + u_int max_reqframes; + u_int max_prireqframes; + u_int max_replyframes; + u_int max_evtframes; + char exclude_ids[80]; + + struct timeval lastfail; }; struct mps_config_params { From owner-svn-src-all@freebsd.org Mon Sep 11 01:53:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C69A8E1153A; Mon, 11 Sep 2017 01:53:23 +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 9363A6A1C3; Mon, 11 Sep 2017 01:53:23 +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 v8B1rMXI056378; Mon, 11 Sep 2017 01:53:22 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B1rMe4056377; Mon, 11 Sep 2017 01:53:22 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110153.v8B1rMe4056377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 01:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323413 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 323413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 01:53:23 -0000 Author: ian Date: Mon Sep 11 01:53:22 2017 New Revision: 323413 URL: https://svnweb.freebsd.org/changeset/base/323413 Log: MFC r319859, r319888: Add support for "make universe_kernels -DMAKE_GENERIC_KERNELS" to build just the GENERIC kernels for each arch (including variations such as GENERIC-NODEBUG, GENERIC64, etc). This helps with quickly doing a test build for all[*] arches without building dozens of variant kernels for the arches that have lots of hardware/board/system variations. [*] Not all arches have a generic kernel (but they probably should for test-building purposes, even if it can't boot on any real hardware). By popular demand: change MAKE_GENERIC_KERNELS to MAKE_LINT_KERNELS. It appears that the same arches that lack GENERIC kernel configs also lack LINT. But enough different arches get built to ensure a kernel change should build everywhere (32 and 64 bit, clang and old gcc, little and big endian). Modified: stable/11/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile ============================================================================== --- stable/11/Makefile Mon Sep 11 01:51:27 2017 (r323412) +++ stable/11/Makefile Mon Sep 11 01:53:22 2017 (r323413) @@ -521,6 +521,8 @@ TARGET!= uname -m .endif .if defined(MAKE_ALL_KERNELS) _THINNER=cat +.elif defined(MAKE_LINT_KERNELS) +_THINNER=grep 'LINT' || true .else _THINNER=xargs grep -L "^.NO_UNIVERSE" || true .endif From owner-svn-src-all@freebsd.org Mon Sep 11 01:56:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00D89E117C4; Mon, 11 Sep 2017 01:56:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 275CB6A374; Mon, 11 Sep 2017 01:56:30 +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 mail108.syd.optusnet.com.au (Postfix) with ESMTPS id F048D1A28D8; Mon, 11 Sep 2017 11:56:21 +1000 (AEST) Date: Mon, 11 Sep 2017 11:56:21 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323393 - in head/sys: sys vm In-Reply-To: <201709101900.v8AJ0c2N059845@repo.freebsd.org> Message-ID: <20170911111127.B870@besplex.bde.org> References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=bc8baKHB c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=pGeDZM4jIChbch_9Z3sA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 01:56:31 -0000 On Sun, 10 Sep 2017, Mateusz Guzik wrote: > Log: > Move vmmeter atomic counters into dedicated cache lines > > Prior to the change they were subject to extreme false sharing. > In particular this change shaves about 3 seconds real time of -j 80 buildkernel. Changes that small are hard to measure. Kernel builds take about 3 seconds real time altogether (cheating slightly -- this is for a FreeBSD-4 kernel where the sources are held constant to provide a benchmark and a bloatometer for newer kernels and userlands which take 10-20 times longer). > Modified: head/sys/sys/vmmeter.h > ============================================================================== > --- head/sys/sys/vmmeter.h Sun Sep 10 18:08:25 2017 (r323392) > +++ head/sys/sys/vmmeter.h Sun Sep 10 19:00:38 2017 (r323393) > @@ -60,6 +60,12 @@ struct vmtotal { > #if defined(_KERNEL) || defined(_WANT_VMMETER) > #include > > +#ifdef _KERNEL > +#define VMMETER_ALIGNED __aligned(CACHE_LINE_SIZE) > +#else > +#define VMMETER_ALIGNED > +#endif > + Using this breaks the "ABI" which is used by at least vmstat(1). This has some style bugs: - verbose macro name. Using this unimproves the formatting later. - space instead of tab after #define. This vfile is vaguely KNF-conformant and had only 1 instance of this style bug before (for the idempotency ifndef, which has 3 other style bugs: - missing blank line before its #endif - tab instead of space before the comment on its #endif - backwards comment on its #endif). > /* > * System wide statistics counters. > * Locking: > @@ -126,14 +132,15 @@ struct vmmeter { > u_int v_free_target; /* (c) pages desired free */ > u_int v_free_min; /* (c) pages desired free */ > u_int v_free_count; /* (f) pages free */ > - u_int v_wire_count; /* (a) pages wired down */ > - u_int v_active_count; /* (q) pages active */ > u_int v_inactive_target; /* (c) pages desired inactive */ > - u_int v_inactive_count; /* (q) pages inactive */ > - u_int v_laundry_count; /* (q) pages eligible for laundering */ Moving these also breaks the "ABI". > u_int v_pageout_free_min; /* (c) min pages reserved for kernel */ > u_int v_interrupt_free_min; /* (c) reserved pages for int code */ > u_int v_free_severe; /* (c) severe page depletion point */ > + u_int v_wire_count VMMETER_ALIGNED; /* (a) pages wired down */ The more complicated declaration unimproves the formatting, especially since the macro name is so long. Is there a technical reason to move to the end? style(9) requires sorting on alignment, with the most aligned fields first, not last (it says to sort on size, but means alignment). Is there a reason to reverse this here. > + u_int v_active_count VMMETER_ALIGNED; /* (a) pages active */ > + u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */ > + u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for > + laundering */ This does more than move the other fields and unimprove their formatting. It also changes the lock annotations from (q) to (a). The formatting is ugliest for the last field. Naming the macro something like VMMA would things fit better. It is stupid to abbreviate VIRTUAL_MEMORY to VM but spell out ALIGNED, especially when the former is global and the latter is local. If the namespace were documented, then the documentation would say that vm, v_ and VM* are reserved, perhaps without underscores, so it would not be namespace pollution to use VMMA. The full undocumented namespace in this file seems to be: - MAXSLP - vm* (used without an underscore for struct vmtotal - t_* - unknown nested pollution in - v_* - VM_* But no VM* without an underscore before VMMETER_ALIGNED. I don't know of any man page where this is undocumented. The only man pages that refers to vmmeter.h is vm_set_page_size(9). The only other man page that refers to vm_cnt is memguard(9). Bruce From owner-svn-src-all@freebsd.org Mon Sep 11 01:59:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62314E119A4; Mon, 11 Sep 2017 01:59:26 +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 2FE566A531; Mon, 11 Sep 2017 01:59:26 +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 v8B1xP6p056651; Mon, 11 Sep 2017 01:59:25 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B1xP3J056646; Mon, 11 Sep 2017 01:59:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110159.v8B1xP3J056646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 01:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323414 - in stable/11/sys: conf dev/ffec dev/mii X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: conf dev/ffec dev/mii X-SVN-Commit-Revision: 323414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 01:59:26 -0000 Author: ian Date: Mon Sep 11 01:59:24 2017 New Revision: 323414 URL: https://svnweb.freebsd.org/changeset/base/323414 Log: MFC r319814, r319815, r319818: Add a set of constants describing the ways a MAC and PHY can be connected. While the initial need for this is to help support phy drivers which are configured with FDT data, there is nothing devicetree-specific about the concept or the names, so they are available for use even on non-FDT systems. Add some utility functions to help a PHY driver on an FDT-configured system retrieve its config data from the fdt data. Convert if_ffec from local code and constants for mac<->phy connection type to new common fdt helper code. Added: stable/11/sys/dev/mii/mii_fdt.c - copied unchanged from r319815, head/sys/dev/mii/mii_fdt.c stable/11/sys/dev/mii/mii_fdt.h - copied unchanged from r319815, head/sys/dev/mii/mii_fdt.h Modified: stable/11/sys/conf/files stable/11/sys/dev/ffec/if_ffec.c stable/11/sys/dev/mii/miivar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Sep 11 01:53:22 2017 (r323413) +++ stable/11/sys/conf/files Mon Sep 11 01:59:24 2017 (r323414) @@ -2166,6 +2166,7 @@ dev/mii/micphy.c optional miibus fdt | micphy fdt dev/mii/mii.c optional miibus | mii dev/mii/mii_bitbang.c optional miibus | mii_bitbang dev/mii/mii_physubr.c optional miibus | mii +dev/mii/mii_fdt.c optional miibus fdt | mii fdt dev/mii/miibus_if.m optional miibus | mii dev/mii/mlphy.c optional miibus | mlphy dev/mii/nsgphy.c optional miibus | nsgphy Modified: stable/11/sys/dev/ffec/if_ffec.c ============================================================================== --- stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 01:53:22 2017 (r323413) +++ stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 01:59:24 2017 (r323414) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "miibus_if.h" /* @@ -135,13 +136,6 @@ struct ffec_bufmap { bus_dmamap_t map; }; -enum { - PHY_CONN_UNKNOWN, - PHY_CONN_MII, - PHY_CONN_RMII, - PHY_CONN_RGMII -}; - struct ffec_softc { device_t dev; device_t miibus; @@ -153,7 +147,7 @@ struct ffec_softc { struct resource *mem_res; void * intr_cookie; struct callout ffec_callout; - uint8_t phy_conn_type; + mii_contype_t phy_conn_type; uint8_t fectype; boolean_t link_is_up; boolean_t is_attached; @@ -262,10 +256,10 @@ ffec_miigasket_setup(struct ffec_softc *sc) switch (sc->phy_conn_type) { - case PHY_CONN_MII: + case MII_CONTYPE_MII: ifmode = 0; break; - case PHY_CONN_RMII: + case MII_CONTYPE_RMII: ifmode = FEC_MIIGSK_CFGR_IF_MODE_RMII; break; default: @@ -377,14 +371,17 @@ ffec_miibus_statchg(device_t dev) rcr |= FEC_RCR_MII_MODE; /* Must always be on even for R[G]MII. */ switch (sc->phy_conn_type) { - case PHY_CONN_MII: - break; - case PHY_CONN_RMII: + case MII_CONTYPE_RMII: rcr |= FEC_RCR_RMII_MODE; break; - case PHY_CONN_RGMII: + case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: + case MII_CONTYPE_RGMII_RXID: + case MII_CONTYPE_RGMII_TXID: rcr |= FEC_RCR_RGMII_EN; break; + default: + break; } switch (IFM_SUBTYPE(mii->mii_media_active)) { @@ -1440,7 +1437,6 @@ ffec_attach(device_t dev) phandle_t ofw_node; int error, phynum, rid; uint8_t eaddr[ETHER_ADDR_LEN]; - char phy_conn_name[32]; uint32_t idx, mscr; sc = device_get_softc(dev); @@ -1463,16 +1459,8 @@ ffec_attach(device_t dev) error = ENXIO; goto out; } - if (OF_searchprop(ofw_node, "phy-mode", - phy_conn_name, sizeof(phy_conn_name)) != -1) { - if (strcasecmp(phy_conn_name, "mii") == 0) - sc->phy_conn_type = PHY_CONN_MII; - else if (strcasecmp(phy_conn_name, "rmii") == 0) - sc->phy_conn_type = PHY_CONN_RMII; - else if (strcasecmp(phy_conn_name, "rgmii") == 0) - sc->phy_conn_type = PHY_CONN_RGMII; - } - if (sc->phy_conn_type == PHY_CONN_UNKNOWN) { + sc->phy_conn_type = mii_fdt_get_contype(ofw_node); + if (sc->phy_conn_type == MII_CONTYPE_UNKNOWN) { device_printf(sc->dev, "No valid 'phy-mode' " "property found in FDT data for device.\n"); error = ENOATTR; Copied: stable/11/sys/dev/mii/mii_fdt.c (from r319815, head/sys/dev/mii/mii_fdt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mii/mii_fdt.c Mon Sep 11 01:59:24 2017 (r323414, copy of r319815, head/sys/dev/mii/mii_fdt.c) @@ -0,0 +1,200 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Development sponsored by Microsemi, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Utility functions for PHY drivers on systems configured using FDT data. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +/* + * Table to translate MII_CONTYPE_xxxx constants to/from devicetree strings. + * We explicitly associate the enum values with the strings in a table to avoid + * relying on this list being sorted in the same order as the enum in miivar.h, + * and to avoid problems if the enum gains new types that aren't in the FDT + * data. However, the "unknown" entry must be first because it is referenced + * using subscript 0 in mii_fdt_contype_to_name(). + */ +static struct contype_names { + mii_contype_t type; + const char *name; +} fdt_contype_names[] = { + {MII_CONTYPE_UNKNOWN, "unknown"}, + {MII_CONTYPE_MII, "mii"}, + {MII_CONTYPE_GMII, "gmii"}, + {MII_CONTYPE_SGMII, "sgmii"}, + {MII_CONTYPE_QSGMII, "qsgmii"}, + {MII_CONTYPE_TBI, "tbi"}, + {MII_CONTYPE_REVMII, "rev-mii"}, + {MII_CONTYPE_RMII, "rmii"}, + {MII_CONTYPE_RGMII, "rgmii"}, + {MII_CONTYPE_RGMII_ID, "rgmii-id"}, + {MII_CONTYPE_RGMII_RXID, "rgmii-rxid"}, + {MII_CONTYPE_RGMII_TXID, "rgmii-txid"}, + {MII_CONTYPE_RTBI, "rtbi"}, + {MII_CONTYPE_SMII, "smii"}, + {MII_CONTYPE_XGMII, "xgmii"}, + {MII_CONTYPE_TRGMII, "trgmii"}, + {MII_CONTYPE_2000BX, "2000base-x"}, + {MII_CONTYPE_2500BX, "2500base-x"}, + {MII_CONTYPE_RXAUI, "rxaui"}, +}; + +static phandle_t +mii_fdt_get_phynode(phandle_t macnode) +{ + static const char *props[] = { + "phy-handle", "phy", "phy-device" + }; + pcell_t xref; + u_int i; + + for (i = 0; i < nitems(props); ++i) { + if (OF_getencprop(macnode, props[i], &xref, sizeof(xref)) > 0) + return (OF_node_from_xref(xref)); + } + return (-1); +} + +mii_contype_t +mii_fdt_contype_from_name(const char *name) +{ + u_int i; + + for (i = 0; i < nitems(fdt_contype_names); ++i) { + if (strcmp(name, fdt_contype_names[i].name) == 0) + return (fdt_contype_names[i].type); + } + return (MII_CONTYPE_UNKNOWN); +} + +const char * +mii_fdt_contype_to_name(mii_contype_t contype) +{ + u_int i; + + for (i = 0; i < nitems(fdt_contype_names); ++i) { + if (contype == fdt_contype_names[i].type) + return (fdt_contype_names[i].name); + } + return (fdt_contype_names[0].name); +} + +mii_contype_t +mii_fdt_get_contype(phandle_t macnode) +{ + char val[32]; + + if (OF_getprop(macnode, "phy-mode", val, sizeof(val)) <= 0 && + OF_getprop(macnode, "phy-connection-type", val, sizeof(val)) <= 0) { + return (MII_CONTYPE_UNKNOWN); + } + return (mii_fdt_contype_from_name(val)); +} + +void +mii_fdt_free_config(struct mii_fdt_phy_config *cfg) +{ + + free(cfg, M_OFWPROP); +} + +mii_fdt_phy_config_t * +mii_fdt_get_config(device_t phydev) +{ + mii_fdt_phy_config_t *cfg; + device_t miibus, macdev; + pcell_t val; + + miibus = device_get_parent(phydev); + macdev = device_get_parent(miibus); + + cfg = malloc(sizeof(*cfg), M_OFWPROP, M_ZERO | M_WAITOK); + + /* + * If we can't find our parent MAC's node, there's nothing more we can + * fill in; cfg is already full of zero/default values, return it. + */ + if ((cfg->macnode = ofw_bus_get_node(macdev)) == -1) + return (cfg); + + cfg->con_type = mii_fdt_get_contype(cfg->macnode); + + /* + * If we can't find our own PHY node, there's nothing more we can fill + * in, just return what we've got. + */ + if ((cfg->phynode = mii_fdt_get_phynode(cfg->macnode)) == -1) + return (cfg); + + if (OF_getencprop(cfg->phynode, "max-speed", &val, sizeof(val)) > 0) + cfg->max_speed = val; + + if (ofw_bus_node_is_compatible(cfg->phynode, + "ethernet-phy-ieee802.3-c45")) + cfg->flags |= MIIF_FDT_COMPAT_CLAUSE45; + + if (OF_hasprop(cfg->phynode, "broken-turn-around")) + cfg->flags |= MIIF_FDT_BROKEN_TURNAROUND; + if (OF_hasprop(cfg->phynode, "enet-phy-lane-swap")) + cfg->flags |= MIIF_FDT_LANE_SWAP; + if (OF_hasprop(cfg->phynode, "enet-phy-lane-no-swap")) + cfg->flags |= MIIF_FDT_NO_LANE_SWAP; + if (OF_hasprop(cfg->phynode, "eee-broken-100tx")) + cfg->flags |= MIIF_FDT_EEE_BROKEN_100TX; + if (OF_hasprop(cfg->phynode, "eee-broken-1000t")) + cfg->flags |= MIIF_FDT_EEE_BROKEN_1000T; + if (OF_hasprop(cfg->phynode, "eee-broken-10gt")) + cfg->flags |= MIIF_FDT_EEE_BROKEN_10GT; + if (OF_hasprop(cfg->phynode, "eee-broken-1000kx")) + cfg->flags |= MIIF_FDT_EEE_BROKEN_1000KX; + if (OF_hasprop(cfg->phynode, "eee-broken-10gkx4")) + cfg->flags |= MIIF_FDT_EEE_BROKEN_10GKX4; + if (OF_hasprop(cfg->phynode, "eee-broken-10gkr")) + cfg->flags |= MIIF_FDT_EEE_BROKEN_10GKR; + + return (cfg); +} Copied: stable/11/sys/dev/mii/mii_fdt.h (from r319815, head/sys/dev/mii/mii_fdt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mii/mii_fdt.h Mon Sep 11 01:59:24 2017 (r323414, copy of r319815, head/sys/dev/mii/mii_fdt.h) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Development sponsored by Microsemi, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_MII_FDT_H_ +#define _DEV_MII_FDT_H_ + +/* + * Common FDT config for a PHY, as documented in the devicetree bindings + * documents ethernet.txt and phy.txt. Boolean properties are represented as + * bits in the flags member. + */ +struct mii_fdt_phy_config { + phandle_t macnode; /* Node (not xref) of parent MAC */ + phandle_t phynode; /* Node (not xref) of PHY */ + mii_contype_t con_type; /* MAC<->PHY connection type */ + u_int max_speed; /* Mbits/sec, 0 = not specified */ + uint32_t flags; /* MIIF_FDT_xxx boolean properties */ +}; +typedef struct mii_fdt_phy_config mii_fdt_phy_config_t; + +/* PHY config flags. */ +#define MIIF_FDT_COMPAT_CLAUSE45 0x0001 +#define MIIF_FDT_BROKEN_TURNAROUND 0x0002 +#define MIIF_FDT_LANE_SWAP 0x0004 +#define MIIF_FDT_NO_LANE_SWAP 0x0008 +#define MIIF_FDT_EEE_BROKEN_100TX 0x0010 +#define MIIF_FDT_EEE_BROKEN_1000T 0x0020 +#define MIIF_FDT_EEE_BROKEN_10GT 0x0040 +#define MIIF_FDT_EEE_BROKEN_1000KX 0x0080 +#define MIIF_FDT_EEE_BROKEN_10GKX4 0x0100 +#define MIIF_FDT_EEE_BROKEN_10GKR 0x0200 + +/* + * Convert between mii_contype enums and devicetree property strings. + */ +const char *mii_fdt_contype_to_name(mii_contype_t contype); +mii_contype_t mii_fdt_contype_from_name(const char *name); + +/* Get the connection type from the given MAC node. */ +mii_contype_t mii_fdt_get_contype(phandle_t macnode); + +/* + * Get/free the config for the given PHY device. + */ +void mii_fdt_free_config(struct mii_fdt_phy_config *cfg); +mii_fdt_phy_config_t *mii_fdt_get_config(device_t phydev); + +#endif Modified: stable/11/sys/dev/mii/miivar.h ============================================================================== --- stable/11/sys/dev/mii/miivar.h Mon Sep 11 01:53:22 2017 (r323413) +++ stable/11/sys/dev/mii/miivar.h Mon Sep 11 01:59:24 2017 (r323414) @@ -156,6 +156,42 @@ typedef struct mii_softc mii_softc_t; #define MII_PHY_ANY -1 /* + * Constants used to describe the type of attachment between MAC and PHY. + */ +enum mii_contype { + MII_CONTYPE_UNKNOWN, /* Must be have value 0. */ + + MII_CONTYPE_MII, + MII_CONTYPE_GMII, + MII_CONTYPE_SGMII, + MII_CONTYPE_QSGMII, + MII_CONTYPE_TBI, + MII_CONTYPE_REVMII, /* Reverse MII */ + MII_CONTYPE_RMII, + MII_CONTYPE_RGMII, /* Delays provided by MAC or PCB */ + MII_CONTYPE_RGMII_ID, /* Rx and tx delays provided by PHY */ + MII_CONTYPE_RGMII_RXID, /* Only rx delay provided by PHY */ + MII_CONTYPE_RGMII_TXID, /* Only tx delay provided by PHY */ + MII_CONTYPE_RTBI, + MII_CONTYPE_SMII, + MII_CONTYPE_XGMII, + MII_CONTYPE_TRGMII, + MII_CONTYPE_2000BX, + MII_CONTYPE_2500BX, + MII_CONTYPE_RXAUI, + + MII_CONTYPE_COUNT /* Add new types before this line. */ +}; +typedef enum mii_contype mii_contype_t; + +static inline bool +mii_contype_is_rgmii(mii_contype_t con) +{ + + return (con >= MII_CONTYPE_RGMII && con <= MII_CONTYPE_RGMII_TXID); +} + +/* * Used to attach a PHY to a parent. */ struct mii_attach_args { From owner-svn-src-all@freebsd.org Mon Sep 11 02:13:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFBB9E12452; Mon, 11 Sep 2017 02:13:52 +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 CB96C6AC69; Mon, 11 Sep 2017 02:13:52 +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 v8B2DpxX064602; Mon, 11 Sep 2017 02:13:51 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2DpZg064599; Mon, 11 Sep 2017 02:13:51 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110213.v8B2DpZg064599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:13:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323415 - in stable/11/sys: conf dev/mii X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: conf dev/mii X-SVN-Commit-Revision: 323415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:13:53 -0000 Author: ian Date: Mon Sep 11 02:13:51 2017 New Revision: 323415 URL: https://svnweb.freebsd.org/changeset/base/323415 Log: MFC r319817: Add a driver for the Vitesse/Microsemi VSC8501 PHY. Added: stable/11/sys/dev/mii/vscphy.c - copied unchanged from r319817, head/sys/dev/mii/vscphy.c Modified: stable/11/sys/conf/files stable/11/sys/dev/mii/miidevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Sep 11 01:59:24 2017 (r323414) +++ stable/11/sys/conf/files Mon Sep 11 02:13:51 2017 (r323415) @@ -2185,6 +2185,7 @@ dev/mii/tlphy.c optional miibus | tlphy dev/mii/truephy.c optional miibus | truephy dev/mii/ukphy.c optional miibus | mii dev/mii/ukphy_subr.c optional miibus | mii +dev/mii/vscphy.c optional miibus | vscphy dev/mii/xmphy.c optional miibus | xmphy dev/mk48txx/mk48txx.c optional mk48txx dev/mlx/mlx.c optional mlx Modified: stable/11/sys/dev/mii/miidevs ============================================================================== --- stable/11/sys/dev/mii/miidevs Mon Sep 11 01:59:24 2017 (r323414) +++ stable/11/sys/dev/mii/miidevs Mon Sep 11 02:13:51 2017 (r323415) @@ -337,7 +337,8 @@ model TI TNETE2101 0x0003 TNETE2101 media interface model xxTSC 78Q2120 0x0014 78Q2120 10/100 media interface model xxTSC 78Q2121 0x0015 78Q2121 100BASE-TX media interface -/* Vitesse Semiconductor */ +/* Vitesse Semiconductor (now Microsemi) */ +model xxVITESSE VSC8501 0x0013 Vitesse VSC8501 10/100/1000TX PHY model xxVITESSE VSC8641 0x0003 Vitesse VSC8641 10/100/1000TX PHY /* XaQti Corp. PHYs */ Copied: stable/11/sys/dev/mii/vscphy.c (from r319817, head/sys/dev/mii/vscphy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mii/vscphy.c Mon Sep 11 02:13:51 2017 (r323415, copy of r319817, head/sys/dev/mii/vscphy.c) @@ -0,0 +1,272 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Development sponsored by Microsemi, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Microsemi / Vitesse VSC8501 (and similar). + */ + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "miidevs.h" +#include "miibus_if.h" + +#ifdef FDT +#include +#include +#include +#include +#endif + +/* Vitesse VSC8501 */ +#define VSC8501_EXTPAGE_REG 0x001f + +#define VSC8501_EXTCTL1_REG 0x0017 +#define VSC8501_EXTCTL1_RGMII_MODE (1u << 12) + +#define VSC8501_RGMII_CTRL_PAGE 0x02 +#define VSC8501_RGMII_CTRL_REG 0x14 +#define VSC8501_RGMII_DELAY_MASK 0x07 +#define VSC8501_RGMII_DELAY_TXSHIFT 0 +#define VSC8501_RGMII_DELAY_RXSHIFT 4 +#define VSC8501_RGMII_RXCLOCK_DISABLE (1u << 11) +#define VSC8501_RGMII_RXSWAP (1u << 7) +#define VSC8501_RGMII_TXSWAP (1u << 3) +#define VSC8501_RGMII_LANESWAP (VSC8501_RGMII_RXSWAP | \ + VSC8501_RGMII_TXSWAP) + +struct vscphy_softc { + mii_softc_t mii_sc; + device_t dev; + mii_contype_t contype; + int rxdelay; + int txdelay; + bool laneswap; +}; + +static void vscphy_reset(struct mii_softc *); +static int vscphy_service(struct mii_softc *, struct mii_data *, int); + +static const struct mii_phydesc vscphys[] = { + MII_PHY_DESC(xxVITESSE, VSC8501), + MII_PHY_END +}; + +static const struct mii_phy_funcs vscphy_funcs = { + vscphy_service, + ukphy_status, + vscphy_reset +}; + +#ifdef FDT +static void +vscphy_fdt_get_config(struct vscphy_softc *vsc) +{ + mii_fdt_phy_config_t *cfg; + pcell_t val; + + cfg = mii_fdt_get_config(vsc->dev); + vsc->contype = cfg->con_type; + vsc->laneswap = (cfg->flags & MIIF_FDT_LANE_SWAP) && + !(cfg->flags & MIIF_FDT_NO_LANE_SWAP); + if (OF_getencprop(cfg->phynode, "rx-delay", &val, sizeof(val)) > 0) + vsc->rxdelay = val; + if (OF_getencprop(cfg->phynode, "tx-delay", &val, sizeof(val)) > 0) + vsc->txdelay = val; + mii_fdt_free_config(cfg); +} +#endif + +static inline int +vscphy_read(struct vscphy_softc *sc, u_int reg) +{ + u_int val; + + val = PHY_READ(&sc->mii_sc, reg); + return (val); +} + +static inline void +vscphy_write(struct vscphy_softc *sc, u_int reg, u_int val) +{ + + PHY_WRITE(&sc->mii_sc, reg, val); +} + +static void +vsc8501_setup_rgmii(struct vscphy_softc *vsc) +{ + int reg; + + vscphy_write(vsc, VSC8501_EXTPAGE_REG, VSC8501_RGMII_CTRL_PAGE); + + reg = vscphy_read(vsc, VSC8501_RGMII_CTRL_REG); + reg &= ~VSC8501_RGMII_RXCLOCK_DISABLE; + reg &= ~VSC8501_RGMII_LANESWAP; + reg &= ~(VSC8501_RGMII_DELAY_MASK << VSC8501_RGMII_DELAY_TXSHIFT); + reg &= ~(VSC8501_RGMII_DELAY_MASK << VSC8501_RGMII_DELAY_RXSHIFT); + if (vsc->laneswap) + reg |= VSC8501_RGMII_LANESWAP; + if (vsc->contype == MII_CONTYPE_RGMII_ID || + vsc->contype == MII_CONTYPE_RGMII_TXID) { + reg |= vsc->txdelay << VSC8501_RGMII_DELAY_TXSHIFT; + } + if (vsc->contype == MII_CONTYPE_RGMII_ID || + vsc->contype == MII_CONTYPE_RGMII_RXID) { + reg |= vsc->rxdelay << VSC8501_RGMII_DELAY_RXSHIFT; + } + vscphy_write(vsc, VSC8501_RGMII_CTRL_REG, reg); + + vscphy_write(vsc, VSC8501_EXTPAGE_REG, 0); +} + +static void +vsc8501_reset(struct vscphy_softc *vsc) +{ + int reg; + + /* + * Must set whether the mac<->phy connection is RGMII first; changes to + * that bit take effect only after a softreset. + */ + reg = vscphy_read(vsc, VSC8501_EXTCTL1_REG); + if (mii_contype_is_rgmii(vsc->contype)) + reg |= VSC8501_EXTCTL1_RGMII_MODE; + else + reg &= ~VSC8501_EXTCTL1_RGMII_MODE; + vscphy_write(vsc, VSC8501_EXTCTL1_REG, reg); + + mii_phy_reset(&vsc->mii_sc); + + /* + * Setup rgmii control register if necessary, after softreset. + */ + if (mii_contype_is_rgmii(vsc->contype)) + vsc8501_setup_rgmii(vsc); +} + +static void +vscphy_reset(struct mii_softc *sc) +{ + struct vscphy_softc *vsc = (struct vscphy_softc *)sc; + + switch (sc->mii_mpd_model) { + case MII_MODEL_xxVITESSE_VSC8501: + vsc8501_reset(vsc); + break; + default: + mii_phy_reset(sc); + break; + } +} + +static int +vscphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + mii_phy_setmedia(sc); + break; + + case MII_TICK: + if (mii_phy_tick(sc) == EJUSTRETURN) + return (0); + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} + +static int +vscphy_probe(device_t dev) +{ + + return (mii_phy_dev_probe(dev, vscphys, BUS_PROBE_DEFAULT)); +} + +static int +vscphy_attach(device_t dev) +{ + struct vscphy_softc *vsc; + + vsc = device_get_softc(dev); + vsc->dev = dev; + +#ifdef FDT + vscphy_fdt_get_config(vsc); +#endif + + mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &vscphy_funcs, 1); + mii_phy_setmedia(&vsc->mii_sc); + + return (0); +} + +static device_method_t vscphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, vscphy_probe), + DEVMETHOD(device_attach, vscphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD_END +}; + +static devclass_t vscphy_devclass; + +static driver_t vscphy_driver = { + "vscphy", + vscphy_methods, + sizeof(struct vscphy_softc) +}; + +DRIVER_MODULE(vscphy, miibus, vscphy_driver, vscphy_devclass, 0, 0); From owner-svn-src-all@freebsd.org Mon Sep 11 02:14:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59A43E12554; Mon, 11 Sep 2017 02:14:30 +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 283E06ADB2; Mon, 11 Sep 2017 02:14:30 +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 v8B2ETXk064670; Mon, 11 Sep 2017 02:14:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2ETla064669; Mon, 11 Sep 2017 02:14:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110214.v8B2ETla064669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323416 - stable/11/sys/modules/ffec X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/modules/ffec X-SVN-Commit-Revision: 323416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:14:30 -0000 Author: ian Date: Mon Sep 11 02:14:28 2017 New Revision: 323416 URL: https://svnweb.freebsd.org/changeset/base/323416 Log: MFC r319899: Add missing header dependencies. Modified: stable/11/sys/modules/ffec/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/ffec/Makefile ============================================================================== --- stable/11/sys/modules/ffec/Makefile Mon Sep 11 02:13:51 2017 (r323415) +++ stable/11/sys/modules/ffec/Makefile Mon Sep 11 02:14:28 2017 (r323416) @@ -3,6 +3,6 @@ .PATH: ${SRCTOP}/sys/dev/ffec KMOD= if_ffec -SRCS= if_ffec.c miibus_if.h device_if.h bus_if.h pci_if.h +SRCS= if_ffec.c miibus_if.h device_if.h bus_if.h pci_if.h ofw_bus_if.h opt_global.h .include From owner-svn-src-all@freebsd.org Mon Sep 11 02:26:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB095E12EA8; Mon, 11 Sep 2017 02:26:02 +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 99EAA6B2F6; Mon, 11 Sep 2017 02:26:02 +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 v8B2Q1X3068631; Mon, 11 Sep 2017 02:26:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2Q12G068630; Mon, 11 Sep 2017 02:26:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110226.v8B2Q12G068630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323417 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:26:02 -0000 Author: ian Date: Mon Sep 11 02:26:01 2017 New Revision: 323417 URL: https://svnweb.freebsd.org/changeset/base/323417 Log: MFC r320456: Implement gpio input by reading the pad state register, not the data register. Modified: stable/11/sys/arm/freescale/imx/imx_gpio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_gpio.c Mon Sep 11 02:14:28 2017 (r323416) +++ stable/11/sys/arm/freescale/imx/imx_gpio.c Mon Sep 11 02:26:01 2017 (r323417) @@ -645,7 +645,7 @@ imx51_gpio_pin_get(device_t dev, uint32_t pin, unsigne if (pin >= sc->gpio_npins) return (EINVAL); - *val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1; + *val = (READ4(sc, IMX_GPIO_PSR_REG) >> pin) & 1; return (0); } From owner-svn-src-all@freebsd.org Mon Sep 11 02:38:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72B3DE139D7; Mon, 11 Sep 2017 02:38:59 +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 229FF6B82F; Mon, 11 Sep 2017 02:38:59 +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 v8B2cwOU073138; Mon, 11 Sep 2017 02:38:58 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2cw4M073133; Mon, 11 Sep 2017 02:38:58 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110238.v8B2cw4M073133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323418 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:38:59 -0000 Author: ian Date: Mon Sep 11 02:38:57 2017 New Revision: 323418 URL: https://svnweb.freebsd.org/changeset/base/323418 Log: MFC r320076: Add a driver for the imx6 EPIT timer that can be used as the system timecounter instead of the GPT timer, freeing up the more flexible GPT hardware for other uses. The EPIT driver is a standard (always in the kernel) driver, and the existing GPT driver is now optional and included only if you ask for device imx_gpt. Added: stable/11/sys/arm/freescale/imx/imx_epit.c - copied unchanged from r320076, head/sys/arm/freescale/imx/imx_epit.c Modified: stable/11/sys/arm/freescale/imx/files.imx6 stable/11/sys/arm/freescale/imx/imx6_ccm.c stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/files.imx6 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx6 Mon Sep 11 02:26:01 2017 (r323417) +++ stable/11/sys/arm/freescale/imx/files.imx6 Mon Sep 11 02:38:57 2017 (r323418) @@ -15,9 +15,10 @@ arm/freescale/imx/imx6_machdep.c standard arm/freescale/imx/imx6_mp.c optional smp arm/freescale/imx/imx6_pl310.c standard arm/freescale/imx/imx6_src.c standard +arm/freescale/imx/imx_epit.c standard arm/freescale/imx/imx_iomux.c standard arm/freescale/imx/imx_machdep.c standard -arm/freescale/imx/imx_gpt.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 Modified: stable/11/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccm.c Mon Sep 11 02:26:01 2017 (r323417) +++ stable/11/sys/arm/freescale/imx/imx6_ccm.c Mon Sep 11 02:38:57 2017 (r323418) @@ -94,8 +94,8 @@ ccm_init_gates(struct ccm_softc *sc) reg = CCGR0_AIPS_TZ1 | CCGR0_AIPS_TZ2 | CCGR0_ABPHDMA; WR4(sc, CCM_CCGR0, reg); - /* gpt, enet */ - reg = CCGR1_ENET | CCGR1_GPT; + /* enet, epit, gpt */ + reg = CCGR1_ENET | CCGR1_EPIT1 | CCGR1_GPT; WR4(sc, CCM_CCGR1, reg); /* ipmux & ipsync (bridges), iomux, i2c */ Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Mon Sep 11 02:26:01 2017 (r323417) +++ stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Mon Sep 11 02:38:57 2017 (r323418) @@ -79,7 +79,10 @@ #define CCGR0_ABPHDMA (0x3 << 4) #define CCM_CCGR1 0x06C #define CCGR1_ENET (0x3 << 10) +#define CCGR1_EPIT1 (0x3 << 12) +#define CCGR1_EPIT2 (0x3 << 14) #define CCGR1_GPT (0x3 << 20) +#define CCGR1_GPT_SERIAL (0x3 << 22) #define CCM_CCGR2 0x070 #define CCGR2_HDMI_TX (0x3 << 0) #define CCGR2_HDMI_TX_ISFR (0x3 << 4) Copied: stable/11/sys/arm/freescale/imx/imx_epit.c (from r320076, head/sys/arm/freescale/imx/imx_epit.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/freescale/imx/imx_epit.c Mon Sep 11 02:38:57 2017 (r323418, copy of r320076, head/sys/arm/freescale/imx/imx_epit.c) @@ -0,0 +1,528 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for imx Enhanced Programmable Interval Timer, a simple free-running + * counter device that can be used as the system timecounter. On imx5 a second + * instance of the device is used as the system eventtimer. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#define EPIT_CR 0x00 /* Control register */ +#define EPIT_CR_CLKSRC_SHIFT 24 +#define EPIT_CR_CLKSRC_OFF 0 +#define EPIT_CR_CLKSRC_IPG 1 +#define EPIT_CR_CLKSRC_HFCLK 2 +#define EPIT_CR_CLKSRC_LFCLK 3 +#define EPIT_CR_STOPEN (1u << 21) +#define EPIT_CR_WAITEN (1u << 19) +#define EPIT_CR_DBGEN (1u << 18) +#define EPIT_CR_IOVW (1u << 17) +#define EPIT_CR_SWR (1u << 16) +#define EPIT_CR_RLD (1u << 3) +#define EPIT_CR_OCIEN (1u << 2) +#define EPIT_CR_ENMOD (1u << 1) +#define EPIT_CR_EN (1u << 0) + +#define EPIT_SR 0x04 /* Status register */ +#define EPIT_SR_OCIF (1u << 0) + +#define EPIT_LR 0x08 /* Load register */ +#define EPIT_CMPR 0x0c /* Compare register */ +#define EPIT_CNR 0x10 /* Counter register */ + +/* + * Define event timer limits. + * + * In theory our minimum period is 1 tick, because to setup a oneshot we don't + * need a read-modify-write sequence to calculate and set a compare register + * value while the counter is running. In practice the waveform diagrams in the + * manual make it appear that a setting of 1 might cause it to miss the event, + * so I'm setting the lower limit to 2 ticks. + */ +#define ET_MIN_TICKS 2 +#define ET_MAX_TICKS 0xfffffffe + +static u_int epit_tc_get_timecount(struct timecounter *tc); + +struct epit_softc { + device_t dev; + struct resource * memres; + struct resource * intres; + void * inthandle; + uint32_t clkfreq; + uint32_t ctlreg; + uint32_t period; + struct timecounter tc; + struct eventtimer et; + bool oneshot; +}; + +#ifndef MULTIDELAY +/* Global softc pointer for use in DELAY(). */ +static struct epit_softc *epit_sc; +#endif + +/* + * Probe data. For some reason, the standard linux dts files don't have + * compatible properties on the epit devices (other properties are missing too, + * like clocks, but we don't care as much about that). So our probe routine + * uses the name of the node (must contain "epit") and the address of the + * registers as identifying marks. + */ +static const uint32_t imx51_epit_ioaddr[2] = {0x73fac000, 0x73fb0000}; +static const uint32_t imx53_epit_ioaddr[2] = {0x53fac000, 0x53fb0000}; +static const uint32_t imx6_epit_ioaddr[2] = {0x020d0000, 0x020d4000}; + +/* ocd_data is number of units to instantiate on the platform */ +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6ul-epit", 1}, + {"fsl,imx6sx-epit", 1}, + {"fsl,imx6q-epit", 1}, + {"fsl,imx6dl-epit", 1}, + {"fsl,imx53-epit", 2}, + {"fsl,imx51-epit", 2}, + {"fsl,imx31-epit", 2}, + {"fsl,imx27-epit", 2}, + {"fsl,imx25-epit", 2}, + {NULL, 0} +}; + +static inline uint32_t +RD4(struct epit_softc *sc, bus_size_t offset) +{ + + return (bus_read_4(sc->memres, offset)); +} + +static inline void +WR4(struct epit_softc *sc, bus_size_t offset, uint32_t value) +{ + + bus_write_4(sc->memres, offset, value); +} + +static inline void +WR4B(struct epit_softc *sc, bus_size_t offset, uint32_t value) +{ + + bus_write_4(sc->memres, offset, value); + bus_barrier(sc->memres, offset, 4, BUS_SPACE_BARRIER_WRITE); +} + +static u_int +epit_read_counter(struct epit_softc *sc) +{ + + /* + * Hardware is a downcounter, adjust to look like it counts up for use + * with timecounter and DELAY. + */ + return (0xffffffff - RD4(sc, EPIT_CNR)); +} + +static void +epit_do_delay(int usec, void *arg) +{ + struct epit_softc *sc = arg; + uint64_t curcnt, endcnt, startcnt, ticks; + + /* + * Calculate the tick count with 64-bit values so that it works for any + * clock frequency. Loop until the hardware count reaches start+ticks. + * If the 32-bit hardware count rolls over while we're looping, just + * manually do a carry into the high bits after each read; don't worry + * that doing this on each loop iteration is inefficient -- we're trying + * to waste time here. + */ + ticks = 1 + ((uint64_t)usec * sc->clkfreq) / 1000000; + curcnt = startcnt = epit_read_counter(sc); + endcnt = startcnt + ticks; + while (curcnt < endcnt) { + curcnt = epit_read_counter(sc); + if (curcnt < startcnt) + curcnt += 1ULL << 32; + } +} + +static u_int +epit_tc_get_timecount(struct timecounter *tc) +{ + + return (epit_read_counter(tc->tc_priv)); +} + +static int +epit_tc_attach(struct epit_softc *sc) +{ + + /* When the counter hits zero, reload with 0xffffffff. Start it. */ + WR4(sc, EPIT_LR, 0xffffffff); + WR4(sc, EPIT_CR, sc->ctlreg | EPIT_CR_EN); + + /* Register as a timecounter. */ + sc->tc.tc_name = "EPIT"; + sc->tc.tc_quality = 1000; + sc->tc.tc_frequency = sc->clkfreq; + sc->tc.tc_counter_mask = 0xffffffff; + sc->tc.tc_get_timecount = epit_tc_get_timecount; + sc->tc.tc_priv = sc; + tc_init(&sc->tc); + + /* We are the DELAY() implementation. */ +#ifdef MULTIDELAY + arm_set_delay(epit_do_delay, sc); +#else + epit_sc = sc; +#endif + return (0); +} + +static int +epit_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period) +{ + struct epit_softc *sc; + uint32_t ticks; + + sc = (struct epit_softc *)et->et_priv; + + /* + * Disable the timer and clear any pending status. The timer may be + * running or may have just expired if we're called to reschedule the + * next event before the previous event time arrives. + */ + WR4(sc, EPIT_CR, sc->ctlreg); + WR4(sc, EPIT_SR, EPIT_SR_OCIF); + if (period != 0) { + sc->oneshot = false; + ticks = ((uint32_t)et->et_frequency * period) >> 32; + } else if (first != 0) { + sc->oneshot = true; + ticks = ((uint32_t)et->et_frequency * first) >> 32; + } else { + return (EINVAL); + } + + /* Set the countdown load register and start the timer. */ + WR4(sc, EPIT_LR, ticks); + WR4B(sc, EPIT_CR, sc->ctlreg | EPIT_CR_EN); + + return (0); +} + +static int +epit_et_stop(struct eventtimer *et) +{ + struct epit_softc *sc; + + sc = (struct epit_softc *)et->et_priv; + + /* Disable the timer and clear any pending status. */ + WR4(sc, EPIT_CR, sc->ctlreg); + WR4B(sc, EPIT_SR, EPIT_SR_OCIF); + + return (0); +} + +static int +epit_intr(void *arg) +{ + struct epit_softc *sc; + uint32_t status; + + sc = arg; + + /* + * Disable a one-shot timer until a new event is scheduled so that the + * counter doesn't wrap and fire again. Do this before clearing the + * status since a short period would make it fire again really soon. + * + * Clear interrupt status before invoking event callbacks. The callback + * often sets up a new one-shot timer event and if the interval is short + * enough it can fire before we get out of this function. If we cleared + * at the bottom we'd miss the interrupt and hang until the clock wraps. + */ + if (sc->oneshot) + WR4(sc, EPIT_CR, sc->ctlreg); + + status = RD4(sc, EPIT_SR); + WR4B(sc, EPIT_SR, status); + + if ((status & EPIT_SR_OCIF) == 0) + return (FILTER_STRAY); + + if (sc->et.et_active) + sc->et.et_event_cb(&sc->et, sc->et.et_arg); + + return (FILTER_HANDLED); +} + +static int +epit_et_attach(struct epit_softc *sc) +{ + int err, rid; + + rid = 0; + sc->intres = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->intres == NULL) { + device_printf(sc->dev, "could not allocate interrupt\n"); + return (ENXIO); + } + + err = bus_setup_intr(sc->dev, sc->intres, INTR_TYPE_CLK | INTR_MPSAFE, + epit_intr, NULL, sc, &sc->inthandle); + if (err != 0) { + device_printf(sc->dev, "unable to setup the irq handler\n"); + return (err); + } + + /* To be an eventtimer, we need interrupts enabled. */ + sc->ctlreg |= EPIT_CR_OCIEN; + + /* Register as an eventtimer. */ + sc->et.et_name = "EPIT"; + sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC; + sc->et.et_quality = 1000; + sc->et.et_frequency = sc->clkfreq; + sc->et.et_min_period = ((uint64_t)ET_MIN_TICKS << 32) / sc->clkfreq; + sc->et.et_max_period = ((uint64_t)ET_MAX_TICKS << 32) / sc->clkfreq; + sc->et.et_start = epit_et_start; + sc->et.et_stop = epit_et_stop; + sc->et.et_priv = sc; + et_register(&sc->et); + + return (0); +} + +static int +epit_probe(device_t dev) +{ + struct resource *memres; + rman_res_t ioaddr; + int num_units, rid, unit; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + /* + * The FDT data for imx5 and imx6 EPIT hardware is missing or broken, + * but it may get fixed some day, so first just do a normal check. We + * return success if the compatible string matches and we haven't + * already instantiated the number of units needed on this platform. + */ + unit = device_get_unit(dev); + num_units = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (unit < num_units) { + device_set_desc(dev, "i.MX EPIT timer"); + return (BUS_PROBE_DEFAULT); + } + + /* + * No compat string match, but for imx6 all the data we need is in the + * node except the compat string, so do our own compatibility check + * using the device name of the node and the register block address. + */ + if (strstr(ofw_bus_get_name(dev), "epit") == NULL) + return (ENXIO); + + rid = 0; + memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_UNMAPPED); + if (memres == NULL) + return (ENXIO); + ioaddr = rman_get_start(memres); + bus_free_resource(dev, SYS_RES_MEMORY, memres); + + if (imx_soc_family() == 6) { + if (unit > 0) + return (ENXIO); + if (ioaddr != imx6_epit_ioaddr[unit]) + return (ENXIO); + } else { + if (unit > 1) + return (ENXIO); + switch (imx_soc_type()) { + case IMXSOC_51: + if (ioaddr != imx51_epit_ioaddr[unit]) + return (ENXIO); + break; + case IMXSOC_53: + if (ioaddr != imx53_epit_ioaddr[unit]) + return (ENXIO); + break; + default: + return (ENXIO); + } + /* + * XXX Right now we have no way to handle the fact that the + * entire EPIT node is missing, which means no interrupt data. + */ + return (ENXIO); + } + + device_set_desc(dev, "i.MX EPIT timer"); + return (BUS_PROBE_DEFAULT); +} + +static int +epit_attach(device_t dev) +{ + struct epit_softc *sc; + int err, rid; + uint32_t clksrc; + + sc = device_get_softc(dev); + sc->dev = dev; + + rid = 0; + sc->memres = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->memres == NULL) { + device_printf(sc->dev, "could not allocate registers\n"); + return (ENXIO); + } + + /* + * For now, use ipg (66 MHz). Some day we should get this from fdt. + */ + clksrc = EPIT_CR_CLKSRC_IPG; + + switch (clksrc) { + default: + device_printf(dev, + "Unsupported clock source '%d', using IPG\n", clksrc); + /* FALLTHROUGH */ + case EPIT_CR_CLKSRC_IPG: + sc->clkfreq = imx_ccm_ipg_hz(); + break; + case EPIT_CR_CLKSRC_HFCLK: + sc->clkfreq = imx_ccm_perclk_hz(); + break; + case EPIT_CR_CLKSRC_LFCLK: + sc->clkfreq = 32768; + break; + } + + /* + * Init: stop operations and clear all options, then set up options and + * clock source, then do a soft-reset and wait for it to complete. + */ + WR4(sc, EPIT_CR, 0); + + sc->ctlreg = + (clksrc << EPIT_CR_CLKSRC_SHIFT) | /* Use selected clock */ + EPIT_CR_ENMOD | /* Reload counter on enable */ + EPIT_CR_RLD | /* Reload counter from LR */ + EPIT_CR_STOPEN | /* Run in STOP mode */ + EPIT_CR_WAITEN | /* Run in WAIT mode */ + EPIT_CR_DBGEN; /* Run in DEBUG mode */ + + WR4B(sc, EPIT_CR, sc->ctlreg | EPIT_CR_SWR); + while (RD4(sc, EPIT_CR) & EPIT_CR_SWR) + continue; + + /* + * Unit 0 is the timecounter, 1 (if instantiated) is the eventtimer. + */ + if (device_get_unit(sc->dev) == 0) + err = epit_tc_attach(sc); + else + err = epit_et_attach(sc); + + return (err); +} + +static device_method_t epit_methods[] = { + DEVMETHOD(device_probe, epit_probe), + DEVMETHOD(device_attach, epit_attach), + + DEVMETHOD_END +}; + +static driver_t epit_driver = { + "imx_epit", + epit_methods, + sizeof(struct epit_softc), +}; + +static devclass_t epit_devclass; + +EARLY_DRIVER_MODULE(imx_epit, simplebus, epit_driver, epit_devclass, 0, + 0, BUS_PASS_TIMER); + +#ifndef MULTIDELAY + +/* + * Hand-calibrated delay-loop counter. This was calibrated on an i.MX6 running + * at 792mhz. It will delay a bit too long on slower processors -- that's + * better than not delaying long enough. In practice this is unlikely to get + * used much since the clock driver is one of the first to start up, and once + * we're attached the delay loop switches to using the timer hardware. + */ +static const int epit_delay_count = 78; + +void +DELAY(int usec) +{ + uint64_t ticks; + + /* If the timer hardware is not accessible, just use a loop. */ + if (epit_sc == NULL) { + while (usec-- > 0) + for (ticks = 0; ticks < epit_delay_count; ++ticks) + cpufunc_nullop(); + return; + } else { + epit_do_delay(usec, epit_sc); + } +} + +#endif From owner-svn-src-all@freebsd.org Mon Sep 11 02:50:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEAC7E143FB; Mon, 11 Sep 2017 02:50:25 +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 9C1C96BDE2; Mon, 11 Sep 2017 02:50:25 +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 v8B2oO57077157; Mon, 11 Sep 2017 02:50:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2oOX2077152; Mon, 11 Sep 2017 02:50:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110250.v8B2oOX2077152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323419 - in stable/11/sys: arm/freescale/imx conf dev/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/freescale/imx conf dev/iicbus X-SVN-Commit-Revision: 323419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:50:25 -0000 Author: ian Date: Mon Sep 11 02:50:24 2017 New Revision: 323419 URL: https://svnweb.freebsd.org/changeset/base/323419 Log: MFC r320460, r320461, r320462, r320463: If an i2c transfer ends due to error, issue a stop on the bus even if the nostop option is set, if a start was issued. Add iic_recover_bus(), a helper function that can be used by any i2c driver which is able to manipulate the clock and data lines directly. When an i2c bus is hung by a slave device stuck in the middle of a transaction that didn't complete properly, this function manipulates the clock and data lines in a sequence known to reliably reset slave devices. The most common cause of a hung i2c bus is a system reboot in the middle of an i2c transfer (so it doesnt' happen often, but now there is a way other than power cycling to recover from it). Add bus recovery handling to the imx5/imx6 i2c driver. Added: stable/11/sys/dev/iicbus/iic_recover_bus.c - copied unchanged from r320461, head/sys/dev/iicbus/iic_recover_bus.c stable/11/sys/dev/iicbus/iic_recover_bus.h - copied unchanged from r320461, head/sys/dev/iicbus/iic_recover_bus.h Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c stable/11/sys/conf/files stable/11/sys/dev/iicbus/iiconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_i2c.c Mon Sep 11 02:38:57 2017 (r323418) +++ stable/11/sys/arm/freescale/imx/imx_i2c.c Mon Sep 11 02:50:24 2017 (r323419) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "iicbus_if.h" #include @@ -68,6 +70,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #define I2C_ADDR_REG 0x00 /* I2C slave address register */ #define I2C_FDR_REG 0x04 /* I2C frequency divider register */ #define I2C_CONTROL_REG 0x08 /* I2C control register */ @@ -131,6 +136,9 @@ struct i2c_softc { struct resource *res; int rid; sbintime_t byte_time_sbt; + int rb_pinctl_idx; + gpio_pin_t rb_sclpin; + gpio_pin_t rb_sdapin; }; static phandle_t i2c_get_node(device_t, device_t); @@ -275,6 +283,68 @@ i2c_error_handler(struct i2c_softc *sc, int error) } static int +i2c_recover_getsda(void *ctx) +{ + bool active; + + gpio_pin_is_active(((struct i2c_softc *)ctx)->rb_sdapin, &active); + return (active); +} + +static void +i2c_recover_setsda(void *ctx, int value) +{ + + gpio_pin_set_active(((struct i2c_softc *)ctx)->rb_sdapin, value); +} + +static int +i2c_recover_getscl(void *ctx) +{ + bool active; + + gpio_pin_is_active(((struct i2c_softc *)ctx)->rb_sclpin, &active); + return (active); + +} + +static void +i2c_recover_setscl(void *ctx, int value) +{ + + gpio_pin_set_active(((struct i2c_softc *)ctx)->rb_sclpin, value); +} + +static int +i2c_recover_bus(struct i2c_softc *sc) +{ + struct iicrb_pin_access pins; + int err; + + /* + * If we have gpio pinmux config, reconfigure the pins to gpio mode, + * invoke iic_recover_bus which checks for a hung bus and bitbangs a + * recovery sequence if necessary, then configure the pins back to i2c + * mode (idx 0). + */ + if (sc->rb_pinctl_idx == 0) + return (0); + + fdt_pinctrl_configure(sc->dev, sc->rb_pinctl_idx); + + pins.ctx = sc; + pins.getsda = i2c_recover_getsda; + pins.setsda = i2c_recover_setsda; + pins.getscl = i2c_recover_getscl; + pins.setscl = i2c_recover_setscl; + err = iic_recover_bus(&pins); + + fdt_pinctrl_configure(sc->dev, 0); + + return (err); +} + +static int i2c_probe(device_t dev) { @@ -292,7 +362,10 @@ i2c_probe(device_t dev) static int i2c_attach(device_t dev) { + char wrkstr[16]; struct i2c_softc *sc; + phandle_t node; + int err, cfgidx; sc = device_get_softc(dev); sc->dev = dev; @@ -311,6 +384,49 @@ i2c_attach(device_t dev) return (ENXIO); } + /* + * Set up for bus recovery using gpio pins, if the pinctrl and gpio + * properties are present. This is optional. If all the config data is + * not in place, we just don't do gpio bitbang bus recovery. + */ + node = ofw_bus_get_node(sc->dev); + + err = gpio_pin_get_by_ofw_property(dev, node, "scl-gpios", + &sc->rb_sclpin); + if (err != 0) + goto no_recovery; + err = gpio_pin_get_by_ofw_property(dev, node, "sda-gpios", + &sc->rb_sdapin); + if (err != 0) + goto no_recovery; + + /* + * Preset the gpio pins to output high (idle bus state). The signal + * won't actually appear on the pins until the bus recovery code changes + * the pinmux config from i2c to gpio. + */ + gpio_pin_setflags(sc->rb_sclpin, GPIO_PIN_OUTPUT); + gpio_pin_setflags(sc->rb_sdapin, GPIO_PIN_OUTPUT); + gpio_pin_set_active(sc->rb_sclpin, true); + gpio_pin_set_active(sc->rb_sdapin, true); + + /* + * Obtain the index of pinctrl node for bus recovery using gpio pins, + * then confirm that pinctrl properties exist for that index and for the + * default pinctrl-0. If sc->rb_pinctl_idx is non-zero, the reset code + * will also do a bus recovery, so setting this value must be last. + */ + err = ofw_bus_find_string_index(node, "pinctrl-names", "gpio", &cfgidx); + if (err == 0) { + snprintf(wrkstr, sizeof(wrkstr), "pinctrl-%d", cfgidx); + if (OF_hasprop(node, "pinctrl-0") && OF_hasprop(node, wrkstr)) + sc->rb_pinctl_idx = cfgidx; + } + +no_recovery: + + /* We don't do a hardware reset here because iicbus_attach() does it. */ + bus_generic_attach(dev); return (0); } @@ -340,7 +456,7 @@ i2c_repeated_start(device_t dev, u_char slave, int tim } static int -i2c_start(device_t dev, u_char slave, int timeout) +i2c_start_ll(device_t dev, u_char slave, int timeout) { struct i2c_softc *sc; int error; @@ -362,6 +478,31 @@ i2c_start(device_t dev, u_char slave, int timeout) } static int +i2c_start(device_t dev, u_char slave, int timeout) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + /* + * Invoke the low-level code to put the bus into master mode and address + * the given slave. If that fails, idle the controller and attempt a + * bus recovery, and then try again one time. Signaling a start and + * addressing the slave is the only operation that a low-level driver + * can safely retry without any help from the upper layers that know + * more about the slave device. + */ + if ((error = i2c_start_ll(dev, slave, timeout)) != 0) { + i2c_write_reg(sc, I2C_CONTROL_REG, 0x0); + if ((error = i2c_recover_bus(sc)) != 0) + return (error); + error = i2c_start_ll(dev, slave, timeout); + } + return (error); +} + +static int i2c_stop(device_t dev) { struct i2c_softc *sc; @@ -410,7 +551,12 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_c i2c_write_reg(sc, I2C_STATUS_REG, 0x0); i2c_write_reg(sc, I2C_CONTROL_REG, 0x0); i2c_write_reg(sc, I2C_FDR_REG, (uint8_t)clkdiv_table[i].regcode); - return (IIC_NOERR); + + /* + * Now that the controller is idle, perform bus recovery. If the bus + * isn't hung, this a fairly fast no-op. + */ + return (i2c_recover_bus(sc)); } static int Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Sep 11 02:38:57 2017 (r323418) +++ stable/11/sys/conf/files Mon Sep 11 02:50:24 2017 (r323419) @@ -1693,6 +1693,7 @@ dev/iicbus/ds3231.c optional ds3231 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic +dev/iicbus/iic_recover_bus.c optional iicbus dev/iicbus/iicbb.c optional iicbb dev/iicbus/iicbb_if.m optional iicbb dev/iicbus/iicbus.c optional iicbus Copied: stable/11/sys/dev/iicbus/iic_recover_bus.c (from r320461, head/sys/dev/iicbus/iic_recover_bus.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/iicbus/iic_recover_bus.c Mon Sep 11 02:50:24 2017 (r323419, copy of r320461, head/sys/dev/iicbus/iic_recover_bus.c) @@ -0,0 +1,124 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Development sponsored by Microsemi, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Helper code to recover a hung i2c bus by bit-banging a recovery sequence. + * + * An i2c bus can be hung by a slave driving the clock (rare) or data lines low. + * The most common cause is a partially-completed transaction such as rebooting + * while a slave is sending a byte of data. Because i2c allows the clock to + * freeze for any amount of time, the slave device will continue driving the + * data line until power is removed, or the clock cycles enough times to + * complete the current byte. After completing any partial byte, a START/STOP + * sequence resets the slave and the bus is recovered. + * + * Any i2c driver which is able to manually set the level of the clock and data + * lines can use this common code for bus recovery. On many SOCs that have + * embedded i2c controllers, the i2c pins can be temporarily reassigned as gpio + * pins to do the bus recovery, then can be assigned back to the i2c hardware. + */ + +#include "opt_platform.h" + +#include +#include +#include + +#include +#include + +int +iic_recover_bus(struct iicrb_pin_access *pins) +{ + const u_int timeout_us = 40000; + const u_int delay_us = 500; + int i; + + /* + * Start with clock and data high. + */ + pins->setsda(pins->ctx, 1); + pins->setscl(pins->ctx, 1); + + /* + * At this point, SCL should be high. If it's not, some slave on the + * bus is doing clock-stretching and we should wait a while. If that + * slave is completely locked up there may be no way to recover at all. + * We wait up to 40 milliseconds, a seriously pessimistic time (even a + * cheap eeprom has a max post-write delay of only 10ms), and also long + * enough to allow SMB slaves to timeout normally after 35ms. + */ + for (i = 0; i < timeout_us; i += delay_us) { + if (pins->getscl(pins->ctx)) + break; + DELAY(delay_us); + } + if (i >= timeout_us) + return (IIC_EBUSERR); + + /* + * At this point we should be able to control the clock line. Some + * slave may be part way through a byte transfer, and could be holding + * the data line low waiting for more clock pulses to finish the byte. + * Cycle the clock until we see the data line go high, but only up to 9 + * times because if it's not free after 9 clocks we're never going to + * win this battle. We do 9 max because that's a byte plus an ack/nack + * bit, after which the slave must not be driving the data line anymore. + */ + for (i = 0; ; ++i) { + if (pins->getsda(pins->ctx)) + break; + if (i == 9) + return (IIC_EBUSERR); + pins->setscl(pins->ctx, 0); + DELAY(5); + pins->setscl(pins->ctx, 1); + DELAY(5); + } + + /* + * At this point we should be in control of both the clock and data + * lines, and both lines should be high. To complete the reset of a + * slave that was part way through a transaction, we need to do a + * START/STOP sequence, which leaves both lines high at the end. + * - START: SDA transitions high->low while SCL remains high. + * - STOP: SDA transitions low->high while SCL remains high. + * Note that even though the clock line remains high, we transition the + * data line no faster than it would change state with a 100khz clock. + */ + pins->setsda(pins->ctx, 0); + DELAY(5); + pins->setsda(pins->ctx, 1); + DELAY(5); + + return (0); +} + Copied: stable/11/sys/dev/iicbus/iic_recover_bus.h (from r320461, head/sys/dev/iicbus/iic_recover_bus.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/iicbus/iic_recover_bus.h Mon Sep 11 02:50:24 2017 (r323419, copy of r320461, head/sys/dev/iicbus/iic_recover_bus.h) @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Development sponsored by Microsemi, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Helper code to recover a hung i2c bus by bit-banging a recovery sequence. + */ + +#ifndef _IICBUS_IIC_RECOVER_BUS_H_ +#define _IICBUS_IIC_RECOVER_BUS_H_ + +struct iicrb_pin_access { + void *ctx; + int (*getsda)(void *ctx); + void (*setsda)(void *ctx, int value); + int (*getscl)(void *ctx); + void (*setscl)(void *ctx, int value); +}; + +/* + * Drive the bus-recovery logic by manipulating the line states using the + * caller-provided functions. This does not block or sleep or acquire any locks + * (unless the provided pin access functions do so). It uses DELAY() to pace + * bits on the bus. + * + * Returns 0 if the bus is functioning properly or IIC_EBUSERR if the recovery + * attempt failed and some slave device is still driving the bus. + */ +int iic_recover_bus(struct iicrb_pin_access *pins); + +#endif Modified: stable/11/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.c Mon Sep 11 02:38:57 2017 (r323418) +++ stable/11/sys/dev/iicbus/iiconf.c Mon Sep 11 02:50:24 2017 (r323419) @@ -419,7 +419,7 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs { int i, error, lenread, lenwrote, nkid, rpstart, addr; device_t *children, bus; - bool nostop; + bool nostop, started; if ((error = device_get_children(dev, &children, &nkid)) != 0) return (IIC_ERESOURCE); @@ -431,6 +431,7 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs rpstart = 0; free(children, M_TEMP); nostop = iicbus_get_nostop(dev); + started = false; for (i = 0, error = 0; i < nmsgs && error == 0; i++) { addr = msgs[i].slave; if (msgs[i].flags & IIC_M_RD) @@ -443,9 +444,10 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs error = iicbus_repeated_start(bus, addr, 0); else error = iicbus_start(bus, addr, 0); + if (error != 0) + break; + started = true; } - if (error != 0) - break; if (msgs[i].flags & IIC_M_RD) error = iicbus_read(bus, msgs[i].buf, msgs[i].len, @@ -464,7 +466,7 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs iicbus_stop(bus); } } - if (error != 0 && !nostop) + if (error != 0 && started) iicbus_stop(bus); return (error); } From owner-svn-src-all@freebsd.org Mon Sep 11 02:52:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4608E146E5; Mon, 11 Sep 2017 02:52: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 A078A6C18B; Mon, 11 Sep 2017 02:52: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 v8B2qfFG080795; Mon, 11 Sep 2017 02:52:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2qfvQ080792; Mon, 11 Sep 2017 02:52:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110252.v8B2qfvQ080792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323420 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:52:42 -0000 Author: ian Date: Mon Sep 11 02:52:41 2017 New Revision: 323420 URL: https://svnweb.freebsd.org/changeset/base/323420 Log: MFC r320655, r321933: Add a driver for the imx6 on-chip realtime clock (snvs). The imx6_snvs driver is not strictly required for the system to run, so change it from standard to optional and add a device statement for it so that it's included unless someone uses nodevice to eliminate it. Added: stable/11/sys/arm/freescale/imx/imx6_snvs.c - copied unchanged from r320655, head/sys/arm/freescale/imx/imx6_snvs.c Modified: stable/11/sys/arm/freescale/imx/files.imx6 stable/11/sys/arm/freescale/imx/std.imx6 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/files.imx6 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx6 Mon Sep 11 02:50:24 2017 (r323419) +++ stable/11/sys/arm/freescale/imx/files.imx6 Mon Sep 11 02:52:41 2017 (r323420) @@ -14,6 +14,7 @@ arm/freescale/imx/imx6_ccm.c standard arm/freescale/imx/imx6_machdep.c standard arm/freescale/imx/imx6_mp.c optional smp arm/freescale/imx/imx6_pl310.c standard +arm/freescale/imx/imx6_snvs.c optional imx6_snvs arm/freescale/imx/imx6_src.c standard arm/freescale/imx/imx_epit.c standard arm/freescale/imx/imx_iomux.c standard Copied: stable/11/sys/arm/freescale/imx/imx6_snvs.c (from r320655, head/sys/arm/freescale/imx/imx6_snvs.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/freescale/imx/imx6_snvs.c Mon Sep 11 02:52:41 2017 (r323420, copy of r320655, head/sys/arm/freescale/imx/imx6_snvs.c) @@ -0,0 +1,228 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for imx6 Secure Non-Volatile Storage system, which really means "all + * the stuff that's powered by a battery when main power is off". This includes + * realtime clock, tamper monitor, and power-management functions. Currently + * this driver provides only realtime clock support. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "clock_if.h" + +#define SNVS_LPCR 0x38 /* Control register */ +#define LPCR_LPCALB_VAL_SHIFT 10 /* Calibration shift */ +#define LPCR_LPCALB_VAL_MASK 0x1f /* Calibration mask */ +#define LPCR_LPCALB_EN (1u << 8) /* Calibration enable */ +#define LPCR_SRTC_ENV (1u << 0) /* RTC enabled/valid */ + +#define SNVS_LPSRTCMR 0x50 /* Counter MSB */ +#define SNVS_LPSRTCLR 0x54 /* Counter LSB */ + +#define RTC_RESOLUTION_US (1000000 / 32768) /* 32khz clock */ + +/* + * The RTC is a 47-bit counter clocked at 32KHz and organized as a 32.15 + * fixed-point binary value. Shifting by SBT_LSB bits translates between + * counter and sbintime values. + */ +#define RTC_BITS 47 +#define SBT_BITS 64 +#define SBT_LSB (SBT_BITS - RTC_BITS) + +struct snvs_softc { + device_t dev; + struct resource * memres; + uint32_t lpcr; +}; + +static struct ofw_compat_data compat_data[] = { + {"fsl,sec-v4.0-mon", true}, + {NULL, false} +}; + +static inline uint32_t +RD4(struct snvs_softc *sc, bus_size_t offset) +{ + + return (bus_read_4(sc->memres, offset)); +} + +static inline void +WR4(struct snvs_softc *sc, bus_size_t offset, uint32_t value) +{ + + bus_write_4(sc->memres, offset, value); +} + +static void +snvs_rtc_enable(struct snvs_softc *sc, bool enable) +{ + uint32_t enbit; + + if (enable) + sc->lpcr |= LPCR_SRTC_ENV; + else + sc->lpcr &= ~LPCR_SRTC_ENV; + WR4(sc, SNVS_LPCR, sc->lpcr); + + /* Wait for the hardware to achieve the requested state. */ + enbit = sc->lpcr & LPCR_SRTC_ENV; + while ((RD4(sc, SNVS_LPCR) & LPCR_SRTC_ENV) != enbit) + continue; +} + +static int +snvs_gettime(device_t dev, struct timespec *ts) +{ + struct snvs_softc *sc; + sbintime_t counter1, counter2; + + sc = device_get_softc(dev); + + /* If the clock is not enabled and valid, we can't help. */ + if (!(RD4(sc, SNVS_LPCR) & LPCR_SRTC_ENV)) { + return (EINVAL); + } + + /* + * The counter is clocked asynchronously to cpu accesses; read and + * assemble the pieces of the counter until we get the same value twice. + * The counter is 47 bits, organized as a 32.15 binary fixed-point + * value. If we shift it up to the high order part of a 64-bit word it + * turns into an sbintime. + */ + do { + counter1 = (uint64_t)RD4(sc, SNVS_LPSRTCMR) << (SBT_LSB + 32); + counter1 |= (uint64_t)RD4(sc, SNVS_LPSRTCLR) << (SBT_LSB); + counter2 = (uint64_t)RD4(sc, SNVS_LPSRTCMR) << (SBT_LSB + 32); + counter2 |= (uint64_t)RD4(sc, SNVS_LPSRTCLR) << (SBT_LSB); + } while (counter1 != counter2); + + *ts = sbttots(counter1); + + return (0); +} + +static int +snvs_settime(device_t dev, struct timespec *unused) +{ + struct snvs_softc *sc; + struct bintime bt; + sbintime_t sbt; + + sc = device_get_softc(dev); + + /* + * Ignore the inaccurate time passed in from the common clock code and + * obtain a time worthy of our 30us accuracy. + */ + bintime(&bt); + bt.sec -= utc_offset(); + sbt = bttosbt(bt); + + /* + * It takes two clock cycles for the counter to start after setting the + * enable bit, so add two SBT_LSBs to what we're about to set. + */ + sbt += 2 << SBT_LSB; + snvs_rtc_enable(sc, false); + WR4(sc, SNVS_LPSRTCMR, (uint32_t)(sbt >> (SBT_LSB + 32))); + WR4(sc, SNVS_LPSRTCLR, (uint32_t)(sbt >> (SBT_LSB))); + snvs_rtc_enable(sc, true); + + return (0); +} + +static int +snvs_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "i.MX6 SNVS RTC"); + return (BUS_PROBE_DEFAULT); +} + +static int +snvs_attach(device_t dev) +{ + struct snvs_softc *sc; + int rid; + + sc = device_get_softc(dev); + sc->dev = dev; + + rid = 0; + sc->memres = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->memres == NULL) { + device_printf(sc->dev, "could not allocate registers\n"); + return (ENXIO); + } + + clock_register(sc->dev, RTC_RESOLUTION_US); + + return (0); +} + +static device_method_t snvs_methods[] = { + DEVMETHOD(device_probe, snvs_probe), + DEVMETHOD(device_attach, snvs_attach), + + /* clock_if methods */ + DEVMETHOD(clock_gettime, snvs_gettime), + DEVMETHOD(clock_settime, snvs_settime), + + DEVMETHOD_END +}; + +static driver_t snvs_driver = { + "snvs", + snvs_methods, + sizeof(struct snvs_softc), +}; + +static devclass_t snvs_devclass; + +DRIVER_MODULE(snvs, simplebus, snvs_driver, snvs_devclass, 0, 0); Modified: stable/11/sys/arm/freescale/imx/std.imx6 ============================================================================== --- stable/11/sys/arm/freescale/imx/std.imx6 Mon Sep 11 02:50:24 2017 (r323419) +++ stable/11/sys/arm/freescale/imx/std.imx6 Mon Sep 11 02:52:41 2017 (r323420) @@ -9,7 +9,8 @@ makeoptions KERNVIRTADDR = 0xc2000000 options IPI_IRQ_START=0 options IPI_IRQ_END=15 -device fdt_pinctrl +device fdt_pinctrl +device imx6_snvs files "../freescale/imx/files.imx6" From owner-svn-src-all@freebsd.org Mon Sep 11 02:56:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 695B7E149F1; Mon, 11 Sep 2017 02:56:47 +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 365396C32D; Mon, 11 Sep 2017 02:56:47 +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 v8B2ukvJ080986; Mon, 11 Sep 2017 02:56:46 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2ukFS080983; Mon, 11 Sep 2017 02:56:46 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110256.v8B2ukFS080983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323421 - in stable/11/sys/dev: bwi iicbus iwi X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys/dev: bwi iicbus iwi X-SVN-Commit-Revision: 323421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:56:47 -0000 Author: ian Date: Mon Sep 11 02:56:45 2017 New Revision: 323421 URL: https://svnweb.freebsd.org/changeset/base/323421 Log: MFC r320743: Fix drivers that assume ticks starts at zero. These drivers all have logic similar to "if (ticks > localvar+interval) {localvar=ticks; ...}" where localvar is initialized to zero. Ticks is initialized to a negative value since r278230, and that leads to these if statements never being true. Modified: stable/11/sys/dev/bwi/if_bwi.c stable/11/sys/dev/iicbus/ad7418.c stable/11/sys/dev/iwi/if_iwi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bwi/if_bwi.c ============================================================================== --- stable/11/sys/dev/bwi/if_bwi.c Mon Sep 11 02:52:41 2017 (r323420) +++ stable/11/sys/dev/bwi/if_bwi.c Mon Sep 11 02:56:45 2017 (r323421) @@ -381,6 +381,7 @@ bwi_attach(struct bwi_softc *sc) */ sc->sc_fw_version = BWI_FW_VERSION3; sc->sc_led_idle = (2350 * hz) / 1000; + sc->sc_led_ticks = ticks - sc->sc_led_idle; sc->sc_led_blink = 1; sc->sc_txpwr_calib = 1; #ifdef BWI_DEBUG Modified: stable/11/sys/dev/iicbus/ad7418.c ============================================================================== --- stable/11/sys/dev/iicbus/ad7418.c Mon Sep 11 02:52:41 2017 (r323420) +++ stable/11/sys/dev/iicbus/ad7418.c Mon Sep 11 02:56:45 2017 (r323421) @@ -120,6 +120,8 @@ ad7418_attach(device_t dev) int conf; sc->sc_dev = dev; + sc->sc_lastupdate = ticks - hz; + sx_init(&sc->sc_lock, "ad7418"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, Modified: stable/11/sys/dev/iwi/if_iwi.c ============================================================================== --- stable/11/sys/dev/iwi/if_iwi.c Mon Sep 11 02:52:41 2017 (r323420) +++ stable/11/sys/dev/iwi/if_iwi.c Mon Sep 11 02:56:45 2017 (r323421) @@ -286,6 +286,7 @@ iwi_attach(device_t dev) int i, error; sc->sc_dev = dev; + sc->sc_ledevent = ticks; IWI_LOCK_INIT(sc); mbufq_init(&sc->sc_snd, ifqmaxlen); From owner-svn-src-all@freebsd.org Mon Sep 11 02:57:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F660E14B27; Mon, 11 Sep 2017 02:57:56 +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 598996C47A; Mon, 11 Sep 2017 02:57:56 +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 v8B2vtvd081074; Mon, 11 Sep 2017 02:57:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B2vtl0081072; Mon, 11 Sep 2017 02:57:55 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110257.v8B2vtl0081072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 02:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323422 - in stable/11/sys: arm/freescale/imx dev/usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/freescale/imx dev/usb/controller X-SVN-Commit-Revision: 323422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 02:57:56 -0000 Author: ian Date: Mon Sep 11 02:57:55 2017 New Revision: 323422 URL: https://svnweb.freebsd.org/changeset/base/323422 Log: MFC r320928, r320929: Support the "disable-over-current" property for imx ehci controllers. It turns out that this is more than a power optization. The OTG port won't work on boards that have this property unless this setting is honored. Also ensure that the usb phy device attaches before ehci. Put an #ifdef notyet wrapper around a function that's not being used yet, to avoid compile warnings. Modified: stable/11/sys/arm/freescale/imx/imx6_usbphy.c stable/11/sys/dev/usb/controller/ehci_imx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx6_usbphy.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_usbphy.c Mon Sep 11 02:56:45 2017 (r323421) +++ stable/11/sys/arm/freescale/imx/imx6_usbphy.c Mon Sep 11 02:57:55 2017 (r323422) @@ -198,5 +198,11 @@ static driver_t usbphy_driver = { static devclass_t usbphy_devclass; -DRIVER_MODULE(usbphy, simplebus, usbphy_driver, usbphy_devclass, 0, 0); +/* + * This driver needs to start before the ehci driver, but later than the usual + * "special" drivers like clocks and cpu. Ehci starts at DEFAULT so + * DEFAULT-1000 seems good. + */ +EARLY_DRIVER_MODULE(usbphy, simplebus, usbphy_driver, usbphy_devclass, 0, 0, + BUS_PASS_DEFAULT - 1000); Modified: stable/11/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_imx.c Mon Sep 11 02:56:45 2017 (r323421) +++ stable/11/sys/dev/usb/controller/ehci_imx.c Mon Sep 11 02:57:55 2017 (r323422) @@ -83,12 +83,11 @@ __FBSDID("$FreeBSD$"); * data, this means that the resources (memory-mapped register range) for the * non-core registers belongs to a device other than the echi devices. * - * At the moment we have no need to access the non-core registers, so all of - * this amounts to documenting what's known. The following compat strings have - * been seen in existing FDT data: - * - "fsl,imx25-usbmisc" - * - "fsl,imx51-usbmisc"; - * - "fsl,imx6q-usbmisc"; + * Because the main ehci device cannot access registers in a range that's + * defined in the fdt data as belonging to another device, we implement a teeny + * little "usbmisc" driver which exists only to provide access to the usbmisc + * control register for each of the 4 usb controller instances. That little + * driver is implemented here in this file, before the main driver. * * In addition to the single usbmisc device, the existing FDT data defines a * separate device for each of the OTG or EHCI cores within the USBOH3. Each of @@ -133,18 +132,129 @@ __FBSDID("$FreeBSD$"); * */ -static struct ofw_compat_data compat_data[] = { - {"fsl,imx6q-usb", 1}, - {"fsl,imx53-usb", 1}, - {"fsl,imx51-usb", 1}, - {"fsl,imx28-usb", 1}, - {"fsl,imx27-usb", 1}, - {"fsl,imx25-usb", 1}, - {"fsl,imx23-usb", 1}, - {NULL, 0}, +/*----------------------------------------------------------------------------- + * imx_usbmisc driver + *---------------------------------------------------------------------------*/ + +#define USBNC_OVER_CUR_POL (1u << 8) +#define USBNC_OVER_CUR_DIS (1u << 7) + +struct imx_usbmisc_softc { + device_t dev; + struct resource *mmio; }; +static struct ofw_compat_data usbmisc_compat_data[] = { + {"fsl,imx6q-usbmisc", true}, + {"fsl,imx51-usbmisc", true}, + {"fsl,imx25-usbmisc", true}, + {NULL, false}, +}; + +static void +imx_usbmisc_set_ctrl(device_t dev, u_int index, uint32_t bits) +{ + struct imx_usbmisc_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = bus_read_4(sc->mmio, index * sizeof(uint32_t)); + bus_write_4(sc->mmio, index * sizeof(uint32_t), reg | bits); +} + +#ifdef notyet +static void +imx_usbmisc_clr_ctrl(device_t dev, u_int index, uint32_t bits) +{ + struct imx_usbmisc_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = bus_read_4(sc->mmio, index * sizeof(uint32_t)); + bus_write_4(sc->mmio, index * sizeof(uint32_t), reg & ~bits); +} +#endif + +static int +imx_usbmisc_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, usbmisc_compat_data)->ocd_data) { + device_set_desc(dev, "i.MX USB Misc Control"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +imx_usbmisc_detach(device_t dev) +{ + struct imx_usbmisc_softc *sc; + + sc = device_get_softc(dev); + + if (sc->mmio != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mmio); + + return (0); +} + +static int +imx_usbmisc_attach(device_t dev) +{ + struct imx_usbmisc_softc *sc; + int err, rid; + + sc = device_get_softc(dev); + err = 0; + + /* Allocate bus_space resources. */ + rid = 0; + sc->mmio = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mmio == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + return (ENXIO); + } + + OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); + + return (0); +} + +static device_method_t imx_usbmisc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, imx_usbmisc_probe), + DEVMETHOD(device_attach, imx_usbmisc_attach), + DEVMETHOD(device_detach, imx_usbmisc_detach), + + DEVMETHOD_END +}; + +static driver_t imx_usbmisc_driver = { + "imx_usbmisc", + imx_usbmisc_methods, + sizeof(struct imx_usbmisc_softc) +}; + +static devclass_t imx_usbmisc_devclass; + /* + * This driver needs to start before the ehci driver, but later than the usual + * "special" drivers like clocks and cpu. Ehci starts at DEFAULT so + * DEFAULT-1000 seems good. + */ +EARLY_DRIVER_MODULE(imx_usbmisc, simplebus, imx_usbmisc_driver, + imx_usbmisc_devclass, 0, 0, BUS_PASS_DEFAULT - 1000); + +/*----------------------------------------------------------------------------- + * imx_ehci driver... + *---------------------------------------------------------------------------*/ + +/* * Each EHCI device in the SoC has some SoC-specific per-device registers at an * offset of 0, then the standard EHCI registers begin at an offset of 0x100. */ @@ -153,10 +263,22 @@ static struct ofw_compat_data compat_data[] = { struct imx_ehci_softc { ehci_softc_t ehci_softc; + device_t dev; struct resource *ehci_mem_res; /* EHCI core regs. */ struct resource *ehci_irq_res; /* EHCI core IRQ. */ }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-usb", 1}, + {"fsl,imx53-usb", 1}, + {"fsl,imx51-usb", 1}, + {"fsl,imx28-usb", 1}, + {"fsl,imx27-usb", 1}, + {"fsl,imx25-usb", 1}, + {"fsl,imx23-usb", 1}, + {NULL, 0}, +}; + static void imx_ehci_post_reset(struct ehci_softc *ehci_softc) { @@ -215,6 +337,36 @@ imx_ehci_detach(device_t dev) return (0); } +static void +imx_ehci_disable_oc(struct imx_ehci_softc *sc) +{ + device_t usbmdev; + pcell_t usbmprops[2]; + phandle_t node; + ssize_t size; + int index; + + /* Get the reference to the usbmisc driver from the fdt data */ + node = ofw_bus_get_node(sc->dev); + size = OF_getencprop(node, "fsl,usbmisc", usbmprops, + sizeof(usbmprops)); + if (size < sizeof(usbmprops)) { + device_printf(sc->dev, "failed to retrieve fsl,usbmisc " + "property, cannot disable overcurrent protection"); + return; + } + /* Retrieve the device_t via the xref handle. */ + usbmdev = OF_device_from_xref(usbmprops[0]); + if (usbmdev == NULL) { + device_printf(sc->dev, "usbmisc device not found, " + "cannot disable overcurrent protection"); + return; + } + /* Call the device routine to set the overcurrent disable bit. */ + index = usbmprops[1]; + imx_usbmisc_set_ctrl(usbmdev, index, USBNC_OVER_CUR_DIS); +} + static int imx_ehci_attach(device_t dev) { @@ -223,6 +375,7 @@ imx_ehci_attach(device_t dev) int err, rid; sc = device_get_softc(dev); + sc->dev = dev; esc = &sc->ehci_softc; err = 0; @@ -282,6 +435,10 @@ imx_ehci_attach(device_t dev) /* Turn on clocks. */ imx_ccm_usb_enable(dev); + + /* Disable overcurrent detection, if configured to do so. */ + if (OF_hasprop(ofw_bus_get_node(sc->dev), "disable-over-current")) + imx_ehci_disable_oc(sc); /* Add USB bus device. */ esc->sc_bus.bdev = device_add_child(dev, "usbus", -1); From owner-svn-src-all@freebsd.org Mon Sep 11 03:24:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1870EE16176; Mon, 11 Sep 2017 03:24:52 +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 DB3186D5B9; Mon, 11 Sep 2017 03:24:51 +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 v8B3OoTJ093972; Mon, 11 Sep 2017 03:24:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B3Oo1G093971; Mon, 11 Sep 2017 03:24:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110324.v8B3Oo1G093971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 03:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323423 - stable/11/sys/arm/include X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/include X-SVN-Commit-Revision: 323423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 03:24:52 -0000 Author: ian Date: Mon Sep 11 03:24:50 2017 New Revision: 323423 URL: https://svnweb.freebsd.org/changeset/base/323423 Log: MFC r321489: Use the MD __size_t to avoid a dependency on/include of non-MD header files. This should fix the compilation of the lua 5.3.4 port, among others. Modified: stable/11/sys/arm/include/ucontext.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/ucontext.h ============================================================================== --- stable/11/sys/arm/include/ucontext.h Mon Sep 11 02:57:55 2017 (r323422) +++ stable/11/sys/arm/include/ucontext.h Mon Sep 11 03:24:50 2017 (r323423) @@ -78,7 +78,7 @@ typedef struct { * Originally, rest of this structure was named __fpu, 35 * 4 bytes * long, never accessed from kernel. */ - size_t mc_vfp_size; + __size_t mc_vfp_size; void *mc_vfp_ptr; unsigned int mc_spare[33]; } mcontext_t; From owner-svn-src-all@freebsd.org Mon Sep 11 04:22:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23FE4E18F0B; Mon, 11 Sep 2017 04:22: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 F41C26EFC7; Mon, 11 Sep 2017 04:22:26 +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 v8B4MQMK018463; Mon, 11 Sep 2017 04:22:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B4MP79018460; Mon, 11 Sep 2017 04:22:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709110422.v8B4MP79018460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 04:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323424 - in stable/11/sys: arm/arm dev/ow sys X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/arm dev/ow sys X-SVN-Commit-Revision: 323424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 04:22:27 -0000 Author: ian Date: Mon Sep 11 04:22:25 2017 New Revision: 323424 URL: https://svnweb.freebsd.org/changeset/base/323424 Log: MFC r321686: Add inline functions to convert between sbintime_t and decimal time units. Use them in some existing code that is vulnerable to roundoff errors. Modified: stable/11/sys/arm/arm/mpcore_timer.c stable/11/sys/dev/ow/owc_gpiobus.c stable/11/sys/sys/time.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/mpcore_timer.c ============================================================================== --- stable/11/sys/arm/arm/mpcore_timer.c Mon Sep 11 03:24:50 2017 (r323423) +++ stable/11/sys/arm/arm/mpcore_timer.c Mon Sep 11 04:22:25 2017 (r323424) @@ -348,7 +348,7 @@ attach_et(struct arm_tmr_softc *sc) sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; sc->et.et_quality = 1000; sc->et.et_frequency = sc->clkfreq; - sc->et.et_min_period = 20 * SBT_1NS; + sc->et.et_min_period = nstosbt(20); sc->et.et_max_period = 2 * SBT_1S; sc->et.et_start = arm_tmr_start; sc->et.et_stop = arm_tmr_stop; Modified: stable/11/sys/dev/ow/owc_gpiobus.c ============================================================================== --- stable/11/sys/dev/ow/owc_gpiobus.c Mon Sep 11 03:24:50 2017 (r323423) +++ stable/11/sys/dev/ow/owc_gpiobus.c Mon Sep 11 04:22:25 2017 (r323424) @@ -295,10 +295,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * do { now = sbinuptime(); GETPIN(sc, &sample); - } while ((now - then) / SBT_1US < t->t_rdv + 2 && sample == 0); + } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); critical_exit(); - if ((now - then) / SBT_1NS < t->t_rdv * 1000) + if (sbttons(now - then) < t->t_rdv * 1000) *bit = 1; else *bit = 0; Modified: stable/11/sys/sys/time.h ============================================================================== --- stable/11/sys/sys/time.h Mon Sep 11 03:24:50 2017 (r323423) +++ stable/11/sys/sys/time.h Mon Sep 11 04:22:25 2017 (r323424) @@ -128,7 +128,7 @@ bintime_shift(struct bintime *_bt, int _exp) #define SBT_1M (SBT_1S * 60) #define SBT_1MS (SBT_1S / 1000) #define SBT_1US (SBT_1S / 1000000) -#define SBT_1NS (SBT_1S / 1000000000) +#define SBT_1NS (SBT_1S / 1000000000) /* beware rounding, see nstosbt() */ #define SBT_MAX 0x7fffffffffffffffLL static __inline int @@ -155,6 +155,53 @@ sbttobt(sbintime_t _sbt) return (_bt); } +/* + * Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS results in + * large roundoff errors which sbttons() and nstosbt() avoid. Millisecond and + * microsecond functions are also provided for completeness. + */ +static __inline int64_t +sbttons(sbintime_t _sbt) +{ + + return ((1000000000 * _sbt) >> 32); +} + +static __inline sbintime_t +nstosbt(int64_t _ns) +{ + + return ((_ns * (((uint64_t)1 << 63) / 500000000) >> 32)); +} + +static __inline int64_t +sbttous(sbintime_t _sbt) +{ + + return ((1000000 * _sbt) >> 32); +} + +static __inline sbintime_t +ustosbt(int64_t _us) +{ + + return ((_us * (((uint64_t)1 << 63) / 500000) >> 32)); +} + +static __inline int64_t +sbttoms(sbintime_t _sbt) +{ + + return ((1000 * _sbt) >> 32); +} + +static __inline sbintime_t +mstosbt(int64_t _ms) +{ + + return ((_ms * (((uint64_t)1 << 63) / 500) >> 32)); +} + /*- * Background information: * @@ -210,7 +257,7 @@ sbttots(sbintime_t _sbt) struct timespec _ts; _ts.tv_sec = _sbt >> 32; - _ts.tv_nsec = ((uint64_t)1000000000 * (uint32_t)_sbt) >> 32; + _ts.tv_nsec = sbttons((uint32_t)_sbt); return (_ts); } @@ -218,8 +265,7 @@ static __inline sbintime_t tstosbt(struct timespec _ts) { - return (((sbintime_t)_ts.tv_sec << 32) + - (_ts.tv_nsec * (((uint64_t)1 << 63) / 500000000) >> 32)); + return (((sbintime_t)_ts.tv_sec << 32) + nstosbt(_ts.tv_nsec)); } static __inline struct timeval @@ -228,7 +274,7 @@ sbttotv(sbintime_t _sbt) struct timeval _tv; _tv.tv_sec = _sbt >> 32; - _tv.tv_usec = ((uint64_t)1000000 * (uint32_t)_sbt) >> 32; + _tv.tv_usec = sbttous((uint32_t)_sbt); return (_tv); } @@ -236,8 +282,7 @@ static __inline sbintime_t tvtosbt(struct timeval _tv) { - return (((sbintime_t)_tv.tv_sec << 32) + - (_tv.tv_usec * (((uint64_t)1 << 63) / 500000) >> 32)); + return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec)); } #endif /* __BSD_VISIBLE */ From owner-svn-src-all@freebsd.org Mon Sep 11 07:21:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02A81E208A7; Mon, 11 Sep 2017 07:21:36 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C418074290; Mon, 11 Sep 2017 07:21:35 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8B7LYph089080; Mon, 11 Sep 2017 07:21:34 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B7LYCN089079; Mon, 11 Sep 2017 07:21:34 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709110721.v8B7LYCN089079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Mon, 11 Sep 2017 07:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323425 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 323425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 07:21:36 -0000 Author: rlibby Date: Mon Sep 11 07:21:34 2017 New Revision: 323425 URL: https://svnweb.freebsd.org/changeset/base/323425 Log: MFC r321668: bhyve/pci_e82545.c: squelch gcc warning for noreturn procedure Modified: stable/11/usr.sbin/bhyve/pci_e82545.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_e82545.c Mon Sep 11 04:22:25 2017 (r323424) +++ stable/11/usr.sbin/bhyve/pci_e82545.c Mon Sep 11 07:21:34 2017 (r323425) @@ -1405,7 +1405,7 @@ e82545_tx_run(struct e82545_softc *sc) sc->esc_TDH, sc->esc_TDHr, sc->esc_TDT); } -static void * +static _Noreturn void * e82545_tx_thread(void *param) { struct e82545_softc *sc = param; From owner-svn-src-all@freebsd.org Mon Sep 11 07:22:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D0FCE20965; Mon, 11 Sep 2017 07:22:54 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A33F74464; Mon, 11 Sep 2017 07:22:54 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8B7Mrrg092165; Mon, 11 Sep 2017 07:22:53 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B7MrW0092164; Mon, 11 Sep 2017 07:22:53 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709110722.v8B7MrW0092164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Mon, 11 Sep 2017 07:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323426 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 323426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 07:22:54 -0000 Author: rlibby Date: Mon Sep 11 07:22:53 2017 New Revision: 323426 URL: https://svnweb.freebsd.org/changeset/base/323426 Log: MFC r321669: bhyve/vga.c: fix atc_color_select_67 bit shift Modified: stable/11/usr.sbin/bhyve/vga.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/vga.c ============================================================================== --- stable/11/usr.sbin/bhyve/vga.c Mon Sep 11 07:21:34 2017 (r323425) +++ stable/11/usr.sbin/bhyve/vga.c Mon Sep 11 07:22:53 2017 (r323426) @@ -1069,7 +1069,7 @@ vga_port_out_handler(struct vmctx *ctx, int in, int po sc->vga_atc.atc_color_select_45 = (val & ATC_CS_C45) << 4; sc->vga_atc.atc_color_select_67 = - (val & ATC_CS_C67) << 6; + ((val & ATC_CS_C67) >> 2) << 6; break; default: //printf("XXX VGA ATC: outb 0x%04x, 0x%02x at index %d\n", port, val, sc->vga_atc.atc_index); From owner-svn-src-all@freebsd.org Mon Sep 11 07:24:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1552AE20A61; Mon, 11 Sep 2017 07:24:58 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D83CC745E3; Mon, 11 Sep 2017 07:24:57 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8B7OvTi092279; Mon, 11 Sep 2017 07:24:57 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B7OvWQ092278; Mon, 11 Sep 2017 07:24:57 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709110724.v8B7OvWQ092278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Mon, 11 Sep 2017 07:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323427 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 323427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 07:24:58 -0000 Author: rlibby Date: Mon Sep 11 07:24:56 2017 New Revision: 323427 URL: https://svnweb.freebsd.org/changeset/base/323427 Log: bhyve: actually call bhyve_caph_cache_catpages Gcc noticed that bhyve_caph_cache_catpages was defined but unused. It is a stable/11 copy of caph_cache_catpages in head. Direct commit to stable/11. This bug does not apply to head. Reviewed by: grehan Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12212 Modified: stable/11/usr.sbin/bhyve/bhyverun.c Modified: stable/11/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/11/usr.sbin/bhyve/bhyverun.c Mon Sep 11 07:22:53 2017 (r323426) +++ stable/11/usr.sbin/bhyve/bhyverun.c Mon Sep 11 07:24:56 2017 (r323427) @@ -1021,7 +1021,7 @@ main(int argc, char *argv[]) fwctl_init(); #ifndef WITHOUT_CAPSICUM - + bhyve_caph_cache_catpages(); if (bhyve_caph_limit_stdoe() == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); From owner-svn-src-all@freebsd.org Mon Sep 11 07:30:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2A2BE20D2C; Mon, 11 Sep 2017 07:30:12 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qk0-x235.google.com (mail-qk0-x235.google.com [IPv6:2607:f8b0:400d:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A5EA74878; Mon, 11 Sep 2017 07:30:12 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qk0-x235.google.com with SMTP id o129so16878852qkd.0; Mon, 11 Sep 2017 00:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=z40iQcK1NPHxWlF7Hc+DnTezziUcNTiDUQac3eIJM/k=; b=PjGEXDyhbcXoN4q2R2bbiiiqHgIBzAWKZSCaUGdV0/24qFZrR2YXrs+N7GpF6pEnTW 3N8HKHdyNyYk9A2JH/hjYIrntr8AX0zXEB/70fwW2JxaI1afvPWnTJ4YoWQAs1UBCnMS 1kyPQQVfeGoTzOwdah5IKb1taT41aIV9gfJ9L1GKqnVPXGyePTMV7ZOnEsiJGWi/goOV xGixKkzsoVg/eSr8cOjGLP4w9OM+UNz7iPVFMivwfyCFFzkL8obzMcYOyzvpD6JANOHB aUyra8CsNPI9qlyV5kBKQQgQ5YEGXQKnoAiGe9n6R6SvEPk77ybyRoafXn3i4yLp6I2n yXZQ== 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=z40iQcK1NPHxWlF7Hc+DnTezziUcNTiDUQac3eIJM/k=; b=ULoznsd/y2M0ajMaujjuNOs4F0JMliJyeatANCSeFKi5JgFsMZfIV7gM3VNOLcfmgN XE28rUAy78fICHM85bNKQ8dhzltacKt09LMHWbwmekqb2kKatJAE9DuNkztpa7MuyKQH v5RlN5T+wjOCoFWu3J3YGljzBmmvOztHmKY2FwOfPJYz3u0IdRoO7uYQ8LHCj29BwHyJ dZiqen4KvHbAhOhm6W2+YkFjne5bsWVob4cyenAniSn6g/mRTqGEpT/k7uFCIVaqutNY W64lQ/9g6d019tgLDloFBoWs1S49XB6sDrn2IVtOcUHLK+UfR2Q2Zxxk6iOIAhTw2YsI mAGw== X-Gm-Message-State: AHPjjUjKljtkgjxs9XFoGOud11v8au3aaVe26ithvWML/4i/y08uMFGn 4jhX9M/EzZ4wxgeSbQ1G6KYTirF38Q== X-Google-Smtp-Source: AOwi7QCQTgXpuyz6kN5zFWYZUVMm55Dw5lChm5lVAsADlpdChCoaRoAWEngHxQAALnxhffMP5NjUy8ufbKyP/wOvap8= X-Received: by 10.55.151.135 with SMTP id z129mr14730772qkd.119.1505115011399; Mon, 11 Sep 2017 00:30:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.63.54 with HTTP; Mon, 11 Sep 2017 00:30:10 -0700 (PDT) In-Reply-To: <20170911111127.B870@besplex.bde.org> References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> From: Mateusz Guzik Date: Mon, 11 Sep 2017 09:30:10 +0200 Message-ID: Subject: Re: svn commit: r323393 - in head/sys: sys vm To: Bruce Evans Cc: Mateusz Guzik , "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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 07:30:12 -0000 On Mon, Sep 11, 2017 at 11:56:21AM +1000, Bruce Evans wrote: > On Sun, 10 Sep 2017, Mateusz Guzik wrote: > > > Log: > > Move vmmeter atomic counters into dedicated cache lines > > > > Prior to the change they were subject to extreme false sharing. > > In particular this change shaves about 3 seconds real time of -j 80 buildkernel. > > Changes that small are hard to measure. Kernel builds take about 3 seconds > real time altogether (cheating slightly -- this is for a FreeBSD-4 kernel > where the sources are held constant to provide a benchmark and a bloatometer > for newer kernels and userlands which take 10-20 times longer). > Well, for me building 11.0 on tmpfs with 11.0 world reliably takes 1:25 (and now 1:22). > > Modified: head/sys/sys/vmmeter.h > > ============================================================================== > > --- head/sys/sys/vmmeter.h Sun Sep 10 18:08:25 2017 (r323392) > > +++ head/sys/sys/vmmeter.h Sun Sep 10 19:00:38 2017 (r323393) > > @@ -60,6 +60,12 @@ struct vmtotal { > > #if defined(_KERNEL) || defined(_WANT_VMMETER) > > #include > > > > +#ifdef _KERNEL > > +#define VMMETER_ALIGNED __aligned(CACHE_LINE_SIZE) > > +#else > > +#define VMMETER_ALIGNED > > +#endif > > + > > Using this breaks the "ABI" which is used by at least vmstat(1). > > This has some style bugs: > - verbose macro name. Using this unimproves the formatting later. > - space instead of tab after #define. This vfile is vaguely KNF-conformant > and had only 1 instance of this style bug before (for the idempotency > ifndef, which has 3 other style bugs: > - missing blank line before its #endif > - tab instead of space before the comment on its #endif > - backwards comment on its #endif). > > > /* > > * System wide statistics counters. > > * Locking: > > @@ -126,14 +132,15 @@ struct vmmeter { > > u_int v_free_target; /* (c) pages desired free */ > > u_int v_free_min; /* (c) pages desired free */ > > u_int v_free_count; /* (f) pages free */ > > - u_int v_wire_count; /* (a) pages wired down */ > > - u_int v_active_count; /* (q) pages active */ > > u_int v_inactive_target; /* (c) pages desired inactive */ > > - u_int v_inactive_count; /* (q) pages inactive */ > > - u_int v_laundry_count; /* (q) pages eligible for laundering */ > > Moving these also breaks the "ABI". > The original patched attempted to preserve it, but I was told it does not matter. Apparently that's indeed true, as evidenced by another change made few months ago which introduce counter type. > > u_int v_pageout_free_min; /* (c) min pages reserved for kernel */ > > u_int v_interrupt_free_min; /* (c) reserved pages for int code */ > > u_int v_free_severe; /* (c) severe page depletion point */ > > + u_int v_wire_count VMMETER_ALIGNED; /* (a) pages wired down */ > > The more complicated declaration unimproves the formatting, especially > since the macro name is so long. See way below. > Is there a technical reason to move to the end? style(9) requires > sorting on alignment, with the most aligned fields first, not last > (it says to sort on size, but means alignment). Is there a reason > to reverse this here. > There is. The annotation only guarantees the address of the field will be aligned. Whatever follows in the struct will start filling the same cacheline, unless annotated as well. i.e. in order to prevent the next field from collapsing into the line, the top of the struct would have to look like this: u_int v_wire_count VMMETER_ALIGNED; /* (a) pages wired down */ u_int v_active_count VMMETER_ALIGNED; /* (a) pages active */ u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */ u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for counter_u64_t v_swtch VMMETER_ALIGNED; That's significantly crappier. __exclusive_cache_line annotation of the vm_cnt object itself puts it into a dedicated section where the linker guarantees whatever folllows will not share the line. > > + u_int v_active_count VMMETER_ALIGNED; /* (a) pages active */ > > + u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */ > > + u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for > > + laundering */ > > This does more than move the other fields and unimprove their formatting. > It also changes the lock annotations from (q) to (a). > > The formatting is ugliest for the last field. > Agreed. > Naming the macro something like VMMA would things fit better. It is > stupid to abbreviate VIRTUAL_MEMORY to VM but spell out ALIGNED, > especially when the former is global and the latter is local. If > the namespace were documented, then the documentation would say that > vm, v_ and VM* are reserved, perhaps without underscores, so it would > not be namespace pollution to use VMMA. > I'm beyond indifferent on how to name the macro. This name was suggested in the review and I just rolled with it. If you want it changed, please argue with alc and/or markj. That said, looking now at the struct I think its use should be retired from the kernel. It can remain in headers for userspace use. First, there is a bunch of counter(9) fields. I don't know the original reasoning. I would expect these counters to be statically defined in a per-cpu struct. Then we are left with a bunch of read-only fields. They can be grouped together in a __read_mostly annotated object. One field with the free page queue lock is v_free_count. It can be annotated by hand in whatever way makes sense. And then there are the 4 atomics. They can just be regular globals with __exclusive_cache_line. However, I'm not interested in pursuing this. My primary motivation for the change here was to get rid of an obvious & important bottleneck and to stabilize performance over time. Interestingly, as different kernel versions produce different binaries, the vm_cnt object's offset within whatever cacheline it used was changing. This in turn was altering false sharing, making performance fluctuate a little bit. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Mon Sep 11 07:38:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79E63E211D5; Mon, 11 Sep 2017 07:38:54 +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 492BA74CEB; Mon, 11 Sep 2017 07:38:54 +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 v8B7crLx096503; Mon, 11 Sep 2017 07:38:53 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B7crWh096502; Mon, 11 Sep 2017 07:38:53 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709110738.v8B7crWh096502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 11 Sep 2017 07:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323428 - head/sys/boot/efi/loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/boot/efi/loader X-SVN-Commit-Revision: 323428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 07:38:54 -0000 Author: tsoome Date: Mon Sep 11 07:38:53 2017 New Revision: 323428 URL: https://svnweb.freebsd.org/changeset/base/323428 Log: r323389 breaks the kernel build when WITHOUT_ZFS is defined in src.conf Need to add #ifdef EFI_ZFS_BOOT guard into efi/loader/main.c PR: 222215 Reported by: Sylvain Garrigues Modified: head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Mon Sep 11 07:24:56 2017 (r323427) +++ head/sys/boot/efi/loader/main.c Mon Sep 11 07:38:53 2017 (r323428) @@ -872,16 +872,20 @@ command_chain(int argc, char *argv[]) } if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) { +#ifdef EFI_ZFS_BOOT struct zfs_devdesc *z_dev; +#endif struct disk_devdesc *d_dev; pdinfo_t *hd, *pd; switch (dev->d_type) { +#ifdef EFI_ZFS_BOOT case DEVT_ZFS: z_dev = (struct zfs_devdesc *)dev; loaded_image->DeviceHandle = efizfs_get_handle_by_guid(z_dev->pool_guid); break; +#endif case DEVT_NET: loaded_image->DeviceHandle = efi_find_handle(dev->d_dev, dev->d_unit); From owner-svn-src-all@freebsd.org Mon Sep 11 08:16:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26F34E22372; Mon, 11 Sep 2017 08:16:40 +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 E6C0875E5A; Mon, 11 Sep 2017 08:16:39 +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 v8B8GdVn012613; Mon, 11 Sep 2017 08:16:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B8GdaX012612; Mon, 11 Sep 2017 08:16:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709110816.v8B8GdaX012612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Sep 2017 08:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323429 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/msdosfs X-SVN-Commit-Revision: 323429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 08:16:40 -0000 Author: kib Date: Mon Sep 11 08:16:38 2017 New Revision: 323429 URL: https://svnweb.freebsd.org/changeset/base/323429 Log: MFC r322982: Verify that the BPB media descriptor and FAT ID match. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Mon Sep 11 07:38:53 2017 (r323428) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Mon Sep 11 08:16:38 2017 (r323429) @@ -908,19 +908,17 @@ fillinusemap(struct msdosfsmount *pmp) * zero. These represent free clusters. */ pmp->pm_freeclustercount = 0; - for (cn = CLUST_FIRST; cn <= pmp->pm_maxcluster; cn++) { + for (cn = 0; cn <= pmp->pm_maxcluster; cn++) { byteoffset = FATOFS(pmp, cn); bo = byteoffset % pmp->pm_fatblocksize; - if (!bo || !bp) { + if (bo == 0) { /* Read new FAT block */ - if (bp) + if (bp != NULL) brelse(bp); fatblock(pmp, byteoffset, &bn, &bsize, NULL); error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp); - if (error) { - brelse(bp); + if (error != 0) return (error); - } } if (FAT32(pmp)) readcn = getulong(&bp->b_data[bo]); @@ -930,7 +928,19 @@ fillinusemap(struct msdosfsmount *pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == CLUST_FREE) + /* + * Check if the FAT ID matches the BPB's media descriptor and + * all other bits are set to 1. + */ + if (cn == 0 && readcn != ((pmp->pm_fatmask & 0xffffff00) | + pmp->pm_bpb.bpbMedia)) { +#ifdef MSDOSFS_DEBUG + printf("mountmsdosfs(): Media descriptor in BPB" + "does not match FAT ID\n"); +#endif + brelse(bp); + return (EINVAL); + } else if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) From owner-svn-src-all@freebsd.org Mon Sep 11 08:18:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1490E2246B; Mon, 11 Sep 2017 08:18:57 +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 9E23B75FDD; Mon, 11 Sep 2017 08:18:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8B8IusU012750; Mon, 11 Sep 2017 08:18:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B8IubG012749; Mon, 11 Sep 2017 08:18:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709110818.v8B8IubG012749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Sep 2017 08:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323430 - stable/11/sys/fs/msdosfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/msdosfs X-SVN-Commit-Revision: 323430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 08:18:57 -0000 Author: kib Date: Mon Sep 11 08:18:56 2017 New Revision: 323430 URL: https://svnweb.freebsd.org/changeset/base/323430 Log: MFC r322984: Style. Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_fat.c Mon Sep 11 08:16:38 2017 (r323429) +++ stable/11/sys/fs/msdosfs/msdosfs_fat.c Mon Sep 11 08:18:56 2017 (r323430) @@ -888,12 +888,12 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus int fillinusemap(struct msdosfsmount *pmp) { - struct buf *bp = NULL; - u_long cn, readcn; + struct buf *bp; + u_long bn, bo, bsize, byteoffset, cn, readcn; int error; - u_long bn, bo, bsize, byteoffset; MSDOSFS_ASSERT_MP_LOCKED(pmp); + bp = NULL; /* * Mark all clusters in use, we mark the free ones in the fat scan From owner-svn-src-all@freebsd.org Mon Sep 11 08:24:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ADE9E228FE; Mon, 11 Sep 2017 08:24:37 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f43.google.com (mail-pg0-f43.google.com [74.125.83.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A04FB76B1C; Mon, 11 Sep 2017 08:24:36 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f43.google.com with SMTP id v66so14080541pgb.5; Mon, 11 Sep 2017 01:24:36 -0700 (PDT) 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=myqUI/i9PDNN8Z7TUanq5/5WhbTtGPLVzTw4w9YW0Gg=; b=Lbl9vvqhHVNa9s5VUdMoU2274RaZHlOWrpDmAu1MXFuBbfkmAN4nOQLJJE0SNFAdQc aMg3hCBQ/Qbg5/skPpUZ6cBfN7mhjZe12MFEjG7yDA9UW+sq8hDCEiU1nOhUNBCHn+vc /5v0Zvu/5s2oxUEUXCLcVqoVH2N1sgFdgxESc7973Z8DKde7XfQjUWeBm388XQQgq3j9 SRic3C0oeu2fyqq+yOlffyzrfxxbQwE++79GeF2Y2N0GfnIs095jZb+6v7LGv3zC9+sN lLekMPlDRtA//0Y2QkmO2kmPCVpv1VmnwX/w5MZKeV0oeoBvN4wW2PmtTBClmjCRz7G/ DvlQ== X-Gm-Message-State: AHPjjUjoLsrZOGuQien5qgzlJWBSHQvJSFygM8WnMWfbLknEt/FjepWC zJ4iHt8JQnAPYcoLp7fE8A== X-Received: by 10.84.218.7 with SMTP id q7mr12964467pli.111.1505118269902; Mon, 11 Sep 2017 01:24:29 -0700 (PDT) Received: from mail-pg0-f42.google.com (mail-pg0-f42.google.com. [74.125.83.42]) by smtp.gmail.com with ESMTPSA id i63sm16320050pfk.34.2017.09.11.01.24.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Sep 2017 01:24:29 -0700 (PDT) Received: by mail-pg0-f42.google.com with SMTP id i130so6765782pgc.3; Mon, 11 Sep 2017 01:24:29 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4wFbimr43Mcpc5cqzEZAh/Z/rl0NsDBNUqNdU4MOGYoicFvZzSVP+IO87RlBPznBxgv2u70ZiOF9iFumK1hnY= X-Received: by 10.98.74.4 with SMTP id x4mr10946767pfa.222.1505118268555; Mon, 11 Sep 2017 01:24:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.189.73 with HTTP; Mon, 11 Sep 2017 01:24:27 -0700 (PDT) In-Reply-To: References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> From: Ryan Libby Date: Mon, 11 Sep 2017 01:24:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r323393 - in head/sys: sys vm To: Mateusz Guzik Cc: Bruce Evans , Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 08:24:37 -0000 On Mon, Sep 11, 2017 at 12:30 AM, Mateusz Guzik wrote: [...] > That said, looking now at the struct I think its use should be retired > from the kernel. It can remain in headers for userspace use. > > First, there is a bunch of counter(9) fields. I don't know the original > reasoning. I would expect these counters to be statically defined in a > per-cpu struct. The actual counter(9) counters are per-CPU. These are just offsets into the PCPU area. See r317061 / D10156 (recent work by glebius). From owner-svn-src-all@freebsd.org Mon Sep 11 08:37:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18046E2325E; Mon, 11 Sep 2017 08:37:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C30D77736B; Mon, 11 Sep 2017 08:37:52 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x229.google.com with SMTP id i50so17620366qtf.0; Mon, 11 Sep 2017 01:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ijWwq+oT8rK2dxuriAT6ZjoJBnRmihr+1megLS2FULM=; b=qObFnhKVKewBsGCS5/eGAPbavhd3JSMVFlUSpsNSykDTb0SLU5HxZw0Tc45Shrcwvq 80RT/Mr/ENLd1g0lDZa9bIgQbpVC6VWqwEwMiJvPGAShaIrEpVPwPUgxymBim3Bau7NH jHvcoEPgXFxTtKFsKsDU3qA8a+z6HaeXCbmfiBi8pJ2+uYRHo78BXi52cdKVFs6TIkGN EYfRcxV2oYPZ3U0Gt6aFQnvsF+oWWZwRwl3ajY3basuPFdcxpfaLW+6AuGYEmFSMbaVP 5B8gl955IPjjd9JSfJruX3j1wnEVSVuLYnFraardt407xtC1xLj8qdJuv7UH6BE7nwe/ BS7A== 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=ijWwq+oT8rK2dxuriAT6ZjoJBnRmihr+1megLS2FULM=; b=dAqS9wmvMnflJQNv8PKYlKnqdrKxBMxTGjvelTW5qwffcz8XmkZo17R8ZKK3MCpILi TrFJCNWanQ8ii/7KAOa78N3VRr7V7AkY6m8Ql2i2PkwLH6v4hlSU6V4TjjAIrtlzjTUM 7PS3kvbbX6yBvSotiobagVpZ5q/xCKLcUO2MbC2KszHi477QS68qUnvQnRDOvnm+oP6T T0TB2YN0CgKlex7Choohvl1JpeTSqOHh2jN+QcrylJmkNiFjjk4u7jRNG03OMlwcureT Ir800W/FFz12/dqGpvwaLkj+xwFJIGdEp4HJTdT0Fj8eWq6wKnhZorHQ9qkfZq0OSsfU 2VyQ== X-Gm-Message-State: AHPjjUgjXPBTfK+nC1raBchFYBiUGSGHbDFWE2feCs9qqeahmdP3QRzT YtxKwH/h55vuL4E1mGBIdwAPkKCoorou X-Google-Smtp-Source: AOwi7QA2TE2W+sEkr265m4hvfVgT8aLrukoYnAJX0wvT1BBnIB6pNlgaCAduhUutOAad8/EqjCjMsQGIP8aS82P4Pzc= X-Received: by 10.200.35.65 with SMTP id b1mr14281106qtb.329.1505119071916; Mon, 11 Sep 2017 01:37:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.43.121 with HTTP; Mon, 11 Sep 2017 01:37:50 -0700 (PDT) In-Reply-To: References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> From: Mateusz Guzik Date: Mon, 11 Sep 2017 10:37:50 +0200 Message-ID: Subject: Re: svn commit: r323393 - in head/sys: sys vm To: Ryan Libby Cc: Bruce Evans , Mateusz Guzik , "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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 08:37:53 -0000 On Mon, Sep 11, 2017 at 10:24 AM, Ryan Libby wrote: > On Mon, Sep 11, 2017 at 12:30 AM, Mateusz Guzik wrote: > [...] > > That said, looking now at the struct I think its use should be retired > > from the kernel. It can remain in headers for userspace use. > > > > First, there is a bunch of counter(9) fields. I don't know the original > > reasoning. I would expect these counters to be statically defined in a > > per-cpu struct. > > The actual counter(9) counters are per-CPU. These are just offsets into > the PCPU area. See r317061 / D10156 (recent work by glebius). > I mean their ids are allocated on boot, even though these counters are always present and could be resolved at compilation time. So in order to update them you have to fetch the id, as opposed to having the code just do the right thing. I.e. for stuff which is always there we should just have well known offsets into per-cpu tables. But I'm not going to try to flame a patch in (or write one). -- Mateusz Guzik From owner-svn-src-all@freebsd.org Mon Sep 11 08:48:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D48BE237DD; Mon, 11 Sep 2017 08:48:38 +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 6A95A779DD; Mon, 11 Sep 2017 08:48:38 +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 v8B8mbtY026052; Mon, 11 Sep 2017 08:48:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8B8maIj026041; Mon, 11 Sep 2017 08:48:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709110848.v8B8maIj026041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Sep 2017 08:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323431 - in stable/11/sys: amd64/amd64 amd64/include amd64/vmm/intel sys x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/include amd64/vmm/intel sys x86/x86 X-SVN-Commit-Revision: 323431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 08:48:38 -0000 Author: kib Date: Mon Sep 11 08:48:36 2017 New Revision: 323431 URL: https://svnweb.freebsd.org/changeset/base/323431 Log: MFC r322762, r322799, r322832, r322833: Make WRFSBASE and WRGSBASE instructions functional. Bump stable/11 __FreeBSD_version. Modified: stable/11/sys/amd64/amd64/cpu_switch.S stable/11/sys/amd64/amd64/exception.S stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/amd64/ptrace_machdep.c stable/11/sys/amd64/amd64/sys_machdep.c stable/11/sys/amd64/amd64/vm_machdep.c stable/11/sys/amd64/include/asmacros.h stable/11/sys/amd64/include/pcb.h stable/11/sys/amd64/vmm/intel/vmx_msr.c stable/11/sys/sys/param.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/11/sys/amd64/amd64/cpu_switch.S Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/amd64/cpu_switch.S Mon Sep 11 08:48:36 2017 (r323431) @@ -87,7 +87,6 @@ END(cpu_throw) ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ movq TD_PCB(%rdi),%r8 - orl $PCB_FULL_IRET,PCB_FLAGS(%r8) movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) @@ -99,6 +98,30 @@ ENTRY(cpu_switch) movq %rbx,PCB_RBX(%r8) movq %rax,PCB_RIP(%r8) + testl $PCB_FULL_IRET,PCB_FLAGS(%r8) + jnz 2f + orl $PCB_FULL_IRET,PCB_FLAGS(%r8) + testl $TDP_KTHREAD,TD_PFLAGS(%rdi) + jnz 2f + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 2f + movl %fs,%eax + cmpl $KUF32SEL,%eax + jne 1f + rdfsbaseq %rax + movq %rax,PCB_FSBASE(%r8) +1: movl %gs,%eax + cmpl $KUG32SEL,%eax + jne 2f + movq %rdx,%r12 + movl $MSR_KGSBASE,%ecx /* Read user gs base */ + rdmsr + shlq $32,%rdx + orq %rdx,%rax + movq %rax,PCB_GSBASE(%r8) + movq %r12,%rdx + +2: testl $PCB_DBREGS,PCB_FLAGS(%r8) jnz store_dr /* static predict not taken */ done_store_dr: Modified: stable/11/sys/amd64/amd64/exception.S ============================================================================== --- stable/11/sys/amd64/amd64/exception.S Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/amd64/exception.S Mon Sep 11 08:48:36 2017 (r323431) @@ -187,12 +187,13 @@ alltraps_testi: jz alltraps_pushregs_no_rdi sti alltraps_pushregs_no_rdi: - movq %rsi,TF_RSI(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rax,TF_RAX(%rsp) +alltraps_pushregs_no_rax: + movq %rsi,TF_RSI(%rsp) movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) - movq %rax,TF_RAX(%rsp) movq %rbx,TF_RBX(%rsp) movq %rbp,TF_RBP(%rsp) movq %r10,TF_R10(%rsp) @@ -326,31 +327,53 @@ IDTVEC(prot) prot_addrf: movq $0,TF_ADDR(%rsp) movq %rdi,TF_RDI(%rsp) /* free up a GP register */ + movq %rax,TF_RAX(%rsp) + movq %rdx,TF_RDX(%rsp) + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) leaq doreti_iret(%rip),%rdi cmpq %rdi,TF_RIP(%rsp) - je 1f /* kernel but with user gsbase!! */ + je 5f /* kernel but with user gsbase!! */ testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz 2f /* already running with kernel GS.base */ -1: swapgs -2: movq PCPU(CURPCB),%rdi - orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) + jz 6f /* already running with kernel GS.base */ + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 2f + cmpw $KUF32SEL,TF_FS(%rsp) + jne 1f + rdfsbaseq %rax +1: cmpw $KUG32SEL,TF_GS(%rsp) + jne 2f + rdgsbaseq %rdx +2: swapgs + movq PCPU(CURPCB),%rdi + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 4f + cmpw $KUF32SEL,TF_FS(%rsp) + jne 3f + movq %rax,PCB_FSBASE(%rdi) +3: cmpw $KUG32SEL,TF_GS(%rsp) + jne 4f + movq %rdx,PCB_GSBASE(%rdi) +4: orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs_no_rdi + jz alltraps_pushregs_no_rax sti - jmp alltraps_pushregs_no_rdi + jmp alltraps_pushregs_no_rax +5: swapgs +6: movq PCPU(CURPCB),%rdi + jmp 4b + /* * Fast syscall entry point. We enter here with just our new %cs/%ss set, * and the new privilige level. We are still running on the old user stack * pointer. We have to juggle a few things around to find our stack etc. * swapgs gives us access to our PCPU space only. * - * We do not support invoking this from a custom %cs or %ss (e.g. using - * entries from an LDT). + * We do not support invoking this from a custom segment registers, + * esp. %cs, %ss, %fs, %gs, e.g. using entries from an LDT. */ IDTVEC(fast_syscall) swapgs @@ -503,6 +526,23 @@ IDTVEC(nmi) nmi_fromuserspace: incl %ebx swapgs + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 2f + movq PCPU(CURPCB),%rdi + testq %rdi,%rdi + jz 2f + cmpw $KUF32SEL,TF_FS(%rsp) + jne 1f + rdfsbaseq %rax + movq %rax,PCB_FSBASE(%rdi) +1: cmpw $KUG32SEL,TF_GS(%rsp) + jne 2f + movl $MSR_KGSBASE,%ecx + rdmsr + shlq $32,%rdx + orq %rdx,%rax + movq %rax,PCB_GSBASE(%rdi) +2: /* Note: this label is also used by ddb and gdb: */ nmi_calltrap: FAKE_MCOUNT(TF_RIP(%rsp)) @@ -705,6 +745,7 @@ doreti_exit: jz ld_regs testl $PCB_FULL_IRET,PCB_FLAGS(%r8) jz ld_regs + andl $~PCB_FULL_IRET,PCB_FLAGS(%r8) testl $TF_HASSEGS,TF_FLAGS(%rsp) je set_segs Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/amd64/machdep.c Mon Sep 11 08:48:36 2017 (r323431) @@ -379,6 +379,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); fpstate_drop(td); + update_pcb_bases(pcb); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; bzero(sf.sf_uc.uc_mcontext.mc_spare, @@ -449,7 +450,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask regs->tf_fs = _ufssel; regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; - set_pcb_flags(pcb, PCB_FULL_IRET); PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -555,6 +555,7 @@ sys_sigreturn(td, uap) return (ret); } bcopy(&ucp->uc_mcontext.mc_rdi, regs, sizeof(*regs)); + update_pcb_bases(pcb); pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase; pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase; @@ -566,7 +567,6 @@ sys_sigreturn(td, uap) #endif kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); - set_pcb_flags(pcb, PCB_FULL_IRET); return (EJUSTRETURN); } @@ -594,11 +594,11 @@ exec_setregs(struct thread *td, struct image_params *i else mtx_unlock(&dt_lock); + update_pcb_bases(pcb); pcb->pcb_fsbase = 0; pcb->pcb_gsbase = 0; clear_pcb_flags(pcb, PCB_32BIT); pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; - set_pcb_flags(pcb, PCB_FULL_IRET); bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = imgp->entry_addr; @@ -2142,6 +2142,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int f mcp->mc_flags = tp->tf_flags; mcp->mc_len = sizeof(*mcp); get_fpcontext(td, mcp, NULL, 0); + update_pcb_bases(pcb); mcp->mc_fsbase = pcb->pcb_fsbase; mcp->mc_gsbase = pcb->pcb_gsbase; mcp->mc_xfpustate = 0; @@ -2212,11 +2213,11 @@ set_mcontext(struct thread *td, mcontext_t *mcp) tp->tf_fs = mcp->mc_fs; tp->tf_gs = mcp->mc_gs; } + set_pcb_flags(pcb, PCB_FULL_IRET); if (mcp->mc_flags & _MC_HASBASES) { pcb->pcb_fsbase = mcp->mc_fsbase; pcb->pcb_gsbase = mcp->mc_gsbase; } - set_pcb_flags(pcb, PCB_FULL_IRET); return (0); } @@ -2485,6 +2486,71 @@ user_dbreg_trap(void) * None of the breakpoints are in user space. */ return 0; +} + +/* + * The pcb_flags is only modified by current thread, or by other threads + * when current thread is stopped. However, current thread may change it + * from the interrupt context in cpu_switch(), or in the trap handler. + * When we read-modify-write pcb_flags from C sources, compiler may generate + * code that is not atomic regarding the interrupt handler. If a trap or + * interrupt happens and any flag is modified from the handler, it can be + * clobbered with the cached value later. Therefore, we implement setting + * and clearing flags with single-instruction functions, which do not race + * with possible modification of the flags from the trap or interrupt context, + * because traps and interrupts are executed only on instruction boundary. + */ +void +set_pcb_flags_raw(struct pcb *pcb, const u_int flags) +{ + + __asm __volatile("orl %1,%0" + : "=m" (pcb->pcb_flags) : "ir" (flags), "m" (pcb->pcb_flags) + : "cc", "memory"); + +} + +/* + * The support for RDFSBASE, WRFSBASE and similar instructions for %gs + * base requires that kernel saves MSR_FSBASE and MSR_{K,}GSBASE into + * pcb if user space modified the bases. We must save on the context + * switch or if the return to usermode happens through the doreti. + * + * Tracking of both events is performed by the pcb flag PCB_FULL_IRET, + * which have a consequence that the base MSRs must be saved each time + * the PCB_FULL_IRET flag is set. We disable interrupts to sync with + * context switches. + */ +void +set_pcb_flags(struct pcb *pcb, const u_int flags) +{ + register_t r; + + if (curpcb == pcb && + (flags & PCB_FULL_IRET) != 0 && + (pcb->pcb_flags & PCB_FULL_IRET) == 0 && + (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) { + r = intr_disable(); + if ((pcb->pcb_flags & PCB_FULL_IRET) == 0) { + if (rfs() == _ufssel) + pcb->pcb_fsbase = rdfsbase(); + if (rgs() == _ugssel) + pcb->pcb_gsbase = rdmsr(MSR_KGSBASE); + } + set_pcb_flags_raw(pcb, flags); + intr_restore(r); + } else { + set_pcb_flags_raw(pcb, flags); + } +} + +void +clear_pcb_flags(struct pcb *pcb, const u_int flags) +{ + + __asm __volatile("andl %1,%0" + : "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags) + : "cc", "memory"); } #ifdef KDB Modified: stable/11/sys/amd64/amd64/ptrace_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/ptrace_machdep.c Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/amd64/ptrace_machdep.c Mon Sep 11 08:48:36 2017 (r323431) @@ -117,15 +117,17 @@ cpu_ptrace_xstate(struct thread *td, int req, void *ad static void cpu_ptrace_setbase(struct thread *td, int req, register_t r) { + struct pcb *pcb; + pcb = td->td_pcb; + set_pcb_flags(pcb, PCB_FULL_IRET); if (req == PT_SETFSBASE) { - td->td_pcb->pcb_fsbase = r; + pcb->pcb_fsbase = r; td->td_frame->tf_fs = _ufssel; } else { - td->td_pcb->pcb_gsbase = r; + pcb->pcb_gsbase = r; td->td_frame->tf_gs = _ugssel; } - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } #ifdef COMPAT_FREEBSD32 @@ -136,6 +138,7 @@ static int cpu32_ptrace(struct thread *td, int req, void *addr, int data) { struct savefpu *fpstate; + struct pcb *pcb; uint32_t r; int error; @@ -167,8 +170,10 @@ cpu32_ptrace(struct thread *td, int req, void *addr, i error = EINVAL; break; } - r = req == PT_GETFSBASE ? td->td_pcb->pcb_fsbase : - td->td_pcb->pcb_gsbase; + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + r = req == PT_GETFSBASE ? pcb->pcb_fsbase : pcb->pcb_gsbase; error = copyout(&r, addr, sizeof(r)); break; @@ -197,6 +202,7 @@ int cpu_ptrace(struct thread *td, int req, void *addr, int data) { register_t *r, rv; + struct pcb *pcb; int error; #ifdef COMPAT_FREEBSD32 @@ -221,8 +227,10 @@ cpu_ptrace(struct thread *td, int req, void *addr, int case PT_GETFSBASE: case PT_GETGSBASE: - r = req == PT_GETFSBASE ? &td->td_pcb->pcb_fsbase : - &td->td_pcb->pcb_gsbase; + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + r = req == PT_GETFSBASE ? &pcb->pcb_fsbase : &pcb->pcb_gsbase; error = copyout(r, addr, sizeof(*r)); break; Modified: stable/11/sys/amd64/amd64/sys_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/sys_machdep.c Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/amd64/sys_machdep.c Mon Sep 11 08:48:36 2017 (r323431) @@ -256,39 +256,45 @@ sysarch(td, uap) error = amd64_set_ioperm(td, &iargs); break; case I386_GET_FSBASE: + update_pcb_bases(pcb); i386base = pcb->pcb_fsbase; error = copyout(&i386base, uap->parms, sizeof(i386base)); break; case I386_SET_FSBASE: error = copyin(uap->parms, &i386base, sizeof(i386base)); if (!error) { + set_pcb_flags(pcb, PCB_FULL_IRET); pcb->pcb_fsbase = i386base; td->td_frame->tf_fs = _ufssel; update_gdt_fsbase(td, i386base); } break; case I386_GET_GSBASE: + update_pcb_bases(pcb); i386base = pcb->pcb_gsbase; error = copyout(&i386base, uap->parms, sizeof(i386base)); break; case I386_SET_GSBASE: error = copyin(uap->parms, &i386base, sizeof(i386base)); if (!error) { + set_pcb_flags(pcb, PCB_FULL_IRET); pcb->pcb_gsbase = i386base; td->td_frame->tf_gs = _ugssel; update_gdt_gsbase(td, i386base); } break; case AMD64_GET_FSBASE: - error = copyout(&pcb->pcb_fsbase, uap->parms, sizeof(pcb->pcb_fsbase)); + update_pcb_bases(pcb); + error = copyout(&pcb->pcb_fsbase, uap->parms, + sizeof(pcb->pcb_fsbase)); break; case AMD64_SET_FSBASE: error = copyin(uap->parms, &a64base, sizeof(a64base)); if (!error) { if (a64base < VM_MAXUSER_ADDRESS) { - pcb->pcb_fsbase = a64base; set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_fsbase = a64base; td->td_frame->tf_fs = _ufssel; } else error = EINVAL; @@ -296,15 +302,17 @@ sysarch(td, uap) break; case AMD64_GET_GSBASE: - error = copyout(&pcb->pcb_gsbase, uap->parms, sizeof(pcb->pcb_gsbase)); + update_pcb_bases(pcb); + error = copyout(&pcb->pcb_gsbase, uap->parms, + sizeof(pcb->pcb_gsbase)); break; case AMD64_SET_GSBASE: error = copyin(uap->parms, &a64base, sizeof(a64base)); if (!error) { if (a64base < VM_MAXUSER_ADDRESS) { - pcb->pcb_gsbase = a64base; set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_gsbase = a64base; td->td_frame->tf_gs = _ugssel; } else error = EINVAL; Modified: stable/11/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/vm_machdep.c Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/amd64/vm_machdep.c Mon Sep 11 08:48:36 2017 (r323431) @@ -176,6 +176,7 @@ cpu_fork(td1, p2, td2, flags) /* Ensure that td1's pcb is up to date. */ fpuexit(td1); + update_pcb_bases(td1->td_pcb); /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); @@ -242,7 +243,7 @@ cpu_fork(td1, p2, td2, flags) pcb2->pcb_tssp = NULL; /* New segment registers. */ - set_pcb_flags(pcb2, PCB_FULL_IRET); + set_pcb_flags_raw(pcb2, PCB_FULL_IRET); /* Copy the LDT, if necessary. */ mdp1 = &td1->td_proc->p_md; @@ -437,13 +438,14 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Those not loaded individually below get their default * values here. */ + update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); - set_pcb_flags(pcb2, PCB_FULL_IRET); + set_pcb_flags_raw(pcb2, PCB_FULL_IRET); /* * Create a new fresh stack for the new thread. Modified: stable/11/sys/amd64/include/asmacros.h ============================================================================== --- stable/11/sys/amd64/include/asmacros.h Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/include/asmacros.h Mon Sep 11 08:48:36 2017 (r323431) @@ -177,7 +177,12 @@ movw %es,TF_ES(%rsp) ; \ movw %ds,TF_DS(%rsp) ; \ movl $TF_HASSEGS,TF_FLAGS(%rsp) ; \ - cld + cld ; \ + testb $SEL_RPL_MASK,TF_CS(%rsp) ; /* come from kernel ? */ \ + jz 2f ; /* yes, leave PCB_FULL_IRET alone */ \ + movq PCPU(CURPCB),%r8 ; \ + andl $~PCB_FULL_IRET,PCB_FLAGS(%r8) ; \ +2: #define POP_FRAME \ movq TF_RDI(%rsp),%rdi ; \ Modified: stable/11/sys/amd64/include/pcb.h ============================================================================== --- stable/11/sys/amd64/include/pcb.h Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/include/pcb.h Mon Sep 11 08:48:36 2017 (r323431) @@ -119,40 +119,15 @@ struct susppcb { #ifdef _KERNEL struct trapframe; -/* - * The pcb_flags is only modified by current thread, or by other threads - * when current thread is stopped. However, current thread may change it - * from the interrupt context in cpu_switch(), or in the trap handler. - * When we read-modify-write pcb_flags from C sources, compiler may generate - * code that is not atomic regarding the interrupt handler. If a trap or - * interrupt happens and any flag is modified from the handler, it can be - * clobbered with the cached value later. Therefore, we implement setting - * and clearing flags with single-instruction functions, which do not race - * with possible modification of the flags from the trap or interrupt context, - * because traps and interrupts are executed only on instruction boundary. - */ -static __inline void -set_pcb_flags(struct pcb *pcb, const u_int flags) -{ - - __asm __volatile("orl %1,%0" - : "=m" (pcb->pcb_flags) : "ir" (flags), "m" (pcb->pcb_flags) - : "cc"); -} - -static __inline void -clear_pcb_flags(struct pcb *pcb, const u_int flags) -{ - - __asm __volatile("andl %1,%0" - : "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags) - : "cc"); -} - +void clear_pcb_flags(struct pcb *pcb, const u_int flags); void makectx(struct trapframe *, struct pcb *); +void set_pcb_flags(struct pcb *pcb, const u_int flags); +void set_pcb_flags_raw(struct pcb *pcb, const u_int flags); int savectx(struct pcb *) __returns_twice; void resumectx(struct pcb *); +/* Ensure that pcb_gsbase and pcb_fsbase are up to date */ +#define update_pcb_bases(pcb) set_pcb_flags((pcb), PCB_FULL_IRET) #endif #endif /* _AMD64_PCB_H_ */ Modified: stable/11/sys/amd64/vmm/intel/vmx_msr.c ============================================================================== --- stable/11/sys/amd64/vmm/intel/vmx_msr.c Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/amd64/vmm/intel/vmx_msr.c Mon Sep 11 08:48:36 2017 (r323431) @@ -31,10 +31,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include #include #include @@ -356,7 +358,8 @@ vmx_msr_guest_enter(struct vmx *vmx, int vcpuid) { uint64_t *guest_msrs = vmx->guest_msrs[vcpuid]; - /* Save host MSRs (if any) and restore guest MSRs */ + /* Save host MSRs (in particular, KGSBASE) and restore guest MSRs */ + update_pcb_bases(curpcb); wrmsr(MSR_LSTAR, guest_msrs[IDX_MSR_LSTAR]); wrmsr(MSR_CSTAR, guest_msrs[IDX_MSR_CSTAR]); wrmsr(MSR_STAR, guest_msrs[IDX_MSR_STAR]); Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/sys/param.h Mon Sep 11 08:48:36 2017 (r323431) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, @@ -84,6 +84,8 @@ #define P_OSREL_SHUTDOWN_ENOTCONN 1100077 #define P_OSREL_MAP_GUARD 1200035 #define P_OSREL_MAP_GUARD_11 1101501 +#define P_OSREL_WRFSBASE 1200041 +#define P_OSREL_WRFSBASE_11 1101503 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Mon Sep 11 08:18:56 2017 (r323430) +++ stable/11/sys/x86/x86/identcpu.c Mon Sep 11 08:48:36 2017 (r323431) @@ -1423,18 +1423,15 @@ finishidentcpu(void) cpu_stdext_feature = regs[1]; /* - * Some hypervisors fail to filter out unsupported - * extended features. For now, disable the + * Some hypervisors failed to filter out unsupported + * extended features. Allow to disable the * extensions, activation of which requires setting a * bit in CR4, and which VM monitors do not support. */ - if (cpu_feature2 & CPUID2_HV) { - cpu_stdext_disable = CPUID_STDEXT_FSGSBASE | - CPUID_STDEXT_SMEP; - } else - cpu_stdext_disable = 0; + cpu_stdext_disable = 0; TUNABLE_INT_FETCH("hw.cpu_stdext_disable", &cpu_stdext_disable); cpu_stdext_feature &= ~cpu_stdext_disable; + cpu_stdext_feature2 = regs[2]; } From owner-svn-src-all@freebsd.org Mon Sep 11 09:39:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 787E6E00C91; Mon, 11 Sep 2017 09:39:37 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 45F627DE76; Mon, 11 Sep 2017 09:39:36 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2a02:c7f:1e13:cf00:3c1a:19f3:83ee:e4f0] (unknown [IPv6:2a02:c7f:1e13:cf00:3c1a:19f3:83ee:e4f0]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 3D87C4ECC6; Mon, 11 Sep 2017 09:39:00 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r323362 - in head/sys: conf dev/neta From: Andrew Turner In-Reply-To: <201709091154.v89Bs4b9094975@repo.freebsd.org> Date: Mon, 11 Sep 2017 10:38:57 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <30B40281-5114-4C72-A9F2-408342BA8216@fubar.geek.nz> References: <201709091154.v89Bs4b9094975@repo.freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 09:39:37 -0000 > On 9 Sep 2017, at 12:54, Marcin Wojtas wrote: >=20 > Author: mw > Date: Sat Sep 9 11:54:04 2017 > New Revision: 323362 > URL: https://svnweb.freebsd.org/changeset/base/323362 >=20 > Log: > Add support for Armada 3700 in the NETA driver >=20 > This patch enables using NETA driver on Marvell Armada 3700 SoC > by introducing new compatible string, modifying clock source > obtaining and also excluding unnecessary parts. > The driver is added as a build option for arm64 platforms as well. I=E2=80=99m getting the following when trying to build with gcc (I have = initial patches to build arm64 with gcc form ports). Andrew --- if_mvneta.o --- = /jenkins/workspace/FreeBSD-arm64-head-gcc/freebsd-head/sys/dev/neta/if_mvn= eta.c:101:1: error: function declaration isn't a prototype = [-Werror=3Dstrict-prototypes] mvneta_get_clk() ^~~~~~~~~~~~~~ = /jenkins/workspace/FreeBSD-arm64-head-gcc/freebsd-head/sys/dev/neta/if_mvn= eta.c: In function 'mvneta_detach': = /jenkins/workspace/FreeBSD-arm64-head-gcc/freebsd-head/sys/dev/neta/if_mvn= eta.c:834:16: warning: variable 'ifp' set but not used = [-Wunused-but-set-variable] struct ifnet *ifp; ^~~ From owner-svn-src-all@freebsd.org Mon Sep 11 10:00:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F3D1E01997 for ; Mon, 11 Sep 2017 10:00:14 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFCC37E7C9 for ; Mon, 11 Sep 2017 10:00:13 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-it0-x230.google.com with SMTP id v19so13198619ite.0 for ; Mon, 11 Sep 2017 03:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ByMVD8iT/6lwBdG2kJ4snoT87dtf0l+HFPpr/g8rqdw=; b=Z/jkkljUCigk4h0g+sr2s+T2BhdwHGdD4pAqmZJGiOC4hS7l9DeOBfNDQU9L3hl6CH RORgbuvv5M+1+j4GuwWH6FV7PZzWkhowxRk1ILHASH0njUgePhJ/KYprXUvtW1FkuDT6 HU/1GnYO0UnuErivEXkLOdeM3oIyLGx1uT2v/MEjJ2qv5in/AZRP3jGFX85Dx5DA8IA+ M6atLwNMLuupsffOj9iEwhFndPpXz8Kyg82TL9vnJGTUWBP2CpAEgTzaqFSNdHXRguT9 4voPW5JEmx/ZciD+KYnGz1bpegaQ8jDQ4VcSiiQRcF0HlJJOhHFJUOW/OTAQuidgea2B ZLOQ== 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:content-transfer-encoding; bh=ByMVD8iT/6lwBdG2kJ4snoT87dtf0l+HFPpr/g8rqdw=; b=h+PckarMcZ6nT0Q+d2oeK1E9rh/ejtk0cC1fAuFgRZ00gQEq+0e4aeHQ7TAb2IOhzh biIYzLVQeKenDYY6qNn6PMgigbUAl98EVL/DPCGJCfiW0PUsm1ARRgL/J8nwsQ7MKR9V HeR8WoETXDcUqOzBAsDJEdUOQsmKAwiugjdIGX0/zSLlUw67EdMr79nnHN1egO9Dl+z1 yGRkOFR2CzucMBHTzEm/Sjw+o0YX1MS1t9F6GtKDmYald2P1VrFD5T1qIjPIqzJycnPr MK10cKwvP9wU+INMrqgG0ZA9zdtFxJnlIum0y2778agvUpcmx7N2dy2Wq+KqjkWaMcYK cjNw== X-Gm-Message-State: AHPjjUhO3iBDdMSK2nhYipjibDd6P2lnMB5mC8xgiiqDqYDS1I3WhJJX 6TyhIoXKhXp3uoBZnhZomjdFVKNmmJeaFNe5l+gm7w== X-Google-Smtp-Source: ADKCNb5NL3I0P7M/IdX5k+Juw8VCEfJwGtd/VWxpWas8omMzDoGdXGqgpLV6S47vdMg+63bC+lWWhW5Mb2S7jHS7y68= X-Received: by 10.36.165.69 with SMTP id w5mr12971427iti.40.1505124013174; Mon, 11 Sep 2017 03:00:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.190.199 with HTTP; Mon, 11 Sep 2017 03:00:12 -0700 (PDT) In-Reply-To: <30B40281-5114-4C72-A9F2-408342BA8216@fubar.geek.nz> References: <201709091154.v89Bs4b9094975@repo.freebsd.org> <30B40281-5114-4C72-A9F2-408342BA8216@fubar.geek.nz> From: Marcin Wojtas Date: Mon, 11 Sep 2017 12:00:12 +0200 Message-ID: Subject: Re: svn commit: r323362 - in head/sys: conf dev/neta To: Andrew Turner Cc: Marcin Wojtas , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 10:00:14 -0000 2017-09-11 11:38 GMT+02:00 Andrew Turner : > >> On 9 Sep 2017, at 12:54, Marcin Wojtas wrote: >> >> Author: mw >> Date: Sat Sep 9 11:54:04 2017 >> New Revision: 323362 >> URL: https://svnweb.freebsd.org/changeset/base/323362 >> >> Log: >> Add support for Armada 3700 in the NETA driver >> >> This patch enables using NETA driver on Marvell Armada 3700 SoC >> by introducing new compatible string, modifying clock source >> obtaining and also excluding unnecessary parts. >> The driver is added as a build option for arm64 platforms as well. > > I=E2=80=99m getting the following when trying to build with gcc (I have i= nitial patches to build arm64 with gcc form ports). > > Andrew > > --- if_mvneta.o --- > /jenkins/workspace/FreeBSD-arm64-head-gcc/freebsd-head/sys/dev/neta/if_mv= neta.c:101:1: error: function declaration isn't a prototype [-Werror=3Dstri= ct-prototypes] > mvneta_get_clk() > ^~~~~~~~~~~~~~ > /jenkins/workspace/FreeBSD-arm64-head-gcc/freebsd-head/sys/dev/neta/if_mv= neta.c: In function 'mvneta_detach': > /jenkins/workspace/FreeBSD-arm64-head-gcc/freebsd-head/sys/dev/neta/if_mv= neta.c:834:16: warning: variable 'ifp' set but not used [-Wunused-but-set-v= ariable] > struct ifnet *ifp; > ^~~ > Can you apply below and confirm it helps? https://pastebin.com/8kfdnMz3 If yes, I'll issue a commit with fix. Marcin From owner-svn-src-all@freebsd.org Mon Sep 11 10:24:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 815B5E02C47; Mon, 11 Sep 2017 10:24:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id C235E7F463; Mon, 11 Sep 2017 10:24:05 +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 mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 1E4DF10793C; Mon, 11 Sep 2017 20:01:24 +1000 (AEST) Date: Mon, 11 Sep 2017 20:01:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: Ryan Libby , Bruce Evans , Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r323393 - in head/sys: sys vm In-Reply-To: Message-ID: <20170911193618.V1292@besplex.bde.org> References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=BmAKPIbiGlEMQsjAth0A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=6kGIvZw6iX1k4Y-7sg4_:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 10:24:06 -0000 On Mon, 11 Sep 2017, Mateusz Guzik wrote: > On Mon, Sep 11, 2017 at 10:24 AM, Ryan Libby wrote: > >> On Mon, Sep 11, 2017 at 12:30 AM, Mateusz Guzik wrote: >> [...] >>> That said, looking now at the struct I think its use should be retired >>> from the kernel. It can remain in headers for userspace use. More about this in another reply. >>> First, there is a bunch of counter(9) fields. I don't know the original >>> reasoning. I would expect these counters to be statically defined in a >>> per-cpu struct. Changing them to 64 bits was even larger ABI breakage (they could have been replaced by padding so that they read as 0's but don't break all following fields). >> The actual counter(9) counters are per-CPU. These are just offsets into >> the PCPU area. See r317061 / D10156 (recent work by glebius). > > I mean their ids are allocated on boot, even though these counters are > always present and could be resolved at compilation time. So in order > to update them you have to fetch the id, as opposed to having the code > just do the right thing. > > I.e. for stuff which is always there we should just have well known offsets > into per-cpu tables. But I'm not going to try to flame a patch in (or write > one). vmstat(1) has the necessary support to read the counters from dead kernels. systat(1) is simpler because it doesn't support dead kernels. It just uses the horrible GETSYSCTL() macro/implementation. vmstat uses the horrible GET_VM_STATS() macro/implementation instead. The horribleness of these includes different bad error handling. vmstat aborts if a sysctl no longer exists or has changed it size. This gives much the same breakage as an ABI change. systat only spams the window with an error message. This is relatively harmless. Sometimes the error message even remains visible so it explains why some fields are displayed as always 0. The change of the size for the counters was eventually fixed in both vmstat and systat by changing the kernel to use the application's size in some cases. I don't care about dead kernels. Thus, moving the fields doesn't break anything for me. It "only" takes about 10000 instructions per field read to handle the move automatically using sysctl(). Bruce From owner-svn-src-all@freebsd.org Mon Sep 11 10:41:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E825E036A7; Mon, 11 Sep 2017 10:41:43 +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 1588B7FBCC; Mon, 11 Sep 2017 10:41:43 +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 v8BAfgJ8074746; Mon, 11 Sep 2017 10:41:42 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BAfgWx074745; Mon, 11 Sep 2017 10:41:42 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201709111041.v8BAfgWx074745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Mon, 11 Sep 2017 10:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323432 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 323432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 10:41:43 -0000 Author: mw Date: Mon Sep 11 10:41:42 2017 New Revision: 323432 URL: https://svnweb.freebsd.org/changeset/base/323432 Log: Improve HW type checking in mv_ehci driver This patch adds hwtype parameter which keeps information about hardware revision of Marvell EHCI controller. It allows to replace multiple calls to ofw_bus_is_compatible with comparing hwtype value during driver initialization. Submitted by: Patryk Duda Suggested by: ian Obtained from: Semihalf Sponsored by: Semihalf Modified: head/sys/dev/usb/controller/ehci_mv.c Modified: head/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- head/sys/dev/usb/controller/ehci_mv.c Mon Sep 11 08:48:36 2017 (r323431) +++ head/sys/dev/usb/controller/ehci_mv.c Mon Sep 11 10:41:42 2017 (r323432) @@ -101,11 +101,17 @@ static void *ih_err; #define MV_USB_HOST_OVERFLOW (1 << 2) #define MV_USB_DEVICE_UNDERFLOW (1 << 3) +enum mv_ehci_hwtype { + HWTYPE_NONE = 0, + HWTYPE_MV_EHCI_V1, + HWTYPE_MV_EHCI_V2, +}; + static struct ofw_compat_data compat_data[] = { - {"mrvl,usb-ehci", true}, - {"marvell,orion-ehci", true}, - {"marvell,armada-3700-ehci", true}, - {NULL, false} + {"mrvl,usb-ehci", HWTYPE_MV_EHCI_V1}, + {"marvell,orion-ehci", HWTYPE_MV_EHCI_V2}, + {"marvell,armada-3700-ehci", HWTYPE_MV_EHCI_V2}, + {NULL, HWTYPE_NONE} }; static void @@ -139,6 +145,7 @@ static int mv_ehci_attach(device_t self) { ehci_softc_t *sc = device_get_softc(self); + enum mv_ehci_hwtype hwtype; bus_space_handle_t bsh; int err; int rid; @@ -149,6 +156,12 @@ mv_ehci_attach(device_t self) sc->sc_bus.devices_max = EHCI_MAX_DEVICES; sc->sc_bus.dma_bits = 32; + hwtype = ofw_bus_search_compatible(self, compat_data)->ocd_data; + if (hwtype == HWTYPE_NONE) { + device_printf(self, "Wrong HW type flag detected\n"); + return (ENXIO); + } + /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) { @@ -177,8 +190,7 @@ mv_ehci_attach(device_t self) device_get_name(self)); rid = 0; - if (!(ofw_bus_is_compatible(self, "marvell,orion-ehci") || - ofw_bus_is_compatible(self, "marvell,armada-3700-ehci"))) { + if (hwtype == HWTYPE_MV_EHCI_V1) { irq_err = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (irq_err == NULL) { @@ -211,8 +223,7 @@ mv_ehci_attach(device_t self) sprintf(sc->sc_vendor, "Marvell"); - if (!(ofw_bus_is_compatible(self, "marvell,orion-ehci") || - ofw_bus_is_compatible(self, "marvell,armada-3700-ehci"))) { + if (hwtype == HWTYPE_MV_EHCI_V1) { err = bus_setup_intr(self, irq_err, INTR_TYPE_BIO, err_intr, NULL, sc, &ih_err); if (err) { From owner-svn-src-all@freebsd.org Mon Sep 11 11:31:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 593F1E05EDD; Mon, 11 Sep 2017 11:31:45 +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 32E81815CF; Mon, 11 Sep 2017 11:31:45 +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 v8BBVhp8092149; Mon, 11 Sep 2017 11:31:43 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BBVhhT092145; Mon, 11 Sep 2017 11:31:43 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709111131.v8BBVhhT092145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 11 Sep 2017 11:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323433 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 323433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 11:31:45 -0000 Author: avg Date: Mon Sep 11 11:31:43 2017 New Revision: 323433 URL: https://svnweb.freebsd.org/changeset/base/323433 Log: MFV r323110: 8558 lwp_create() returns EAGAIN on system with more than 80K ZFS filesystems illumos/illumos-gate@216d7723a1a58124cf95c4950d51d5f99d3f4128 https://github.com/illumos/illumos-gate/commit/216d7723a1a58124cf95c4950d51d5f99d3f4128 https://www.illumos.org/issues/8558 On a system with more than 80K ZFS filesystems, we've seen cases where lwp_create() will start to fail by returning EAGAIN. The problem being, for each of those 80K ZFS filesystems, a taskq will be created for each dataset as part of the ZIL for each dataset. For each of these taskq's, a kernel thread will be created which results in 24KB being allocated for each thread. With enough of these 24KB allocations, we eventually exhaust the memory region set aside for these allocations. Currently, segkpsize is set to a value of 2GB, which means we can only support about 80K filesystems; 2GB / 24KB = ~80K. The lwp_create() failure comes into play due to the fact that LWP creation also allocates 24KB from this same region of memory. Thus, if we've exhausted this region of memory due to the number of ZIL taskq's, there won't be any memory avaible to allow the call to lwp_create() to succeed. FreeBSD note: I haven't created sysctl-s for the new ZIL clean parameters. Let's add them if anyone requires to tune them. Reviewed by: George Wilson Reviewed by: Sebastien Roy Approved by: Robert Mustacchi Author: Prakash Surya MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Sep 11 10:41:42 2017 (r323432) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Sep 11 11:31:43 2017 (r323433) @@ -137,6 +137,36 @@ uint64_t zfs_delay_scale = 1000 * 1000 * 1000 / 2000; */ int zfs_sync_taskq_batch_pct = 75; +/* + * These tunables determine the behavior of how zil_itxg_clean() is + * called via zil_clean() in the context of spa_sync(). When an itxg + * list needs to be cleaned, TQ_NOSLEEP will be used when dispatching. + * If the dispatch fails, the call to zil_itxg_clean() will occur + * synchronously in the context of spa_sync(), which can negatively + * impact the performance of spa_sync() (e.g. in the case of the itxg + * list having a large number of itxs that needs to be cleaned). + * + * Thus, these tunables can be used to manipulate the behavior of the + * taskq used by zil_clean(); they determine the number of taskq entries + * that are pre-populated when the taskq is first created (via the + * "zfs_zil_clean_taskq_minalloc" tunable) and the maximum number of + * taskq entries that are cached after an on-demand allocation (via the + * "zfs_zil_clean_taskq_maxalloc"). + * + * The idea being, we want to try reasonably hard to ensure there will + * already be a taskq entry pre-allocated by the time that it is needed + * by zil_clean(). This way, we can avoid the possibility of an + * on-demand allocation of a new taskq entry from failing, which would + * result in zil_itxg_clean() being called synchronously from zil_clean() + * (which can adversely affect performance of spa_sync()). + * + * Additionally, the number of threads used by the taskq can be + * configured via the "zfs_zil_clean_taskq_nthr_pct" tunable. + */ +int zfs_zil_clean_taskq_nthr_pct = 100; +int zfs_zil_clean_taskq_minalloc = 1024; +int zfs_zil_clean_taskq_maxalloc = 1024 * 1024; + #if defined(__FreeBSD__) && defined(_KERNEL) extern int zfs_vdev_async_write_active_max_dirty_percent; @@ -272,6 +302,12 @@ dsl_pool_open_impl(spa_t *spa, uint64_t txg) zfs_sync_taskq_batch_pct, minclsyspri, 1, INT_MAX, TASKQ_THREADS_CPU_PCT); + dp->dp_zil_clean_taskq = taskq_create("dp_zil_clean_taskq", + zfs_zil_clean_taskq_nthr_pct, minclsyspri, + zfs_zil_clean_taskq_minalloc, + zfs_zil_clean_taskq_maxalloc, + TASKQ_PREPOPULATE | TASKQ_THREADS_CPU_PCT); + mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&dp->dp_spaceavail_cv, NULL, CV_DEFAULT, NULL); @@ -422,6 +458,7 @@ dsl_pool_close(dsl_pool_t *dp) txg_list_destroy(&dp->dp_sync_tasks); txg_list_destroy(&dp->dp_dirty_dirs); + taskq_destroy(dp->dp_zil_clean_taskq); taskq_destroy(dp->dp_sync_taskq); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Sep 11 10:41:42 2017 (r323432) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Sep 11 11:31:43 2017 (r323433) @@ -122,6 +122,8 @@ typedef struct dsl_pool { txg_list_t dp_dirty_dirs; txg_list_t dp_sync_tasks; taskq_t *dp_sync_taskq; + taskq_t *dp_zil_clean_taskq; + txg_list_t dp_early_sync_tasks; /* * Protects administrative changes (properties, namespace) 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 Mon Sep 11 10:41:42 2017 (r323432) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Mon Sep 11 11:31:43 2017 (r323433) @@ -124,7 +124,6 @@ struct zilog { 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() */ - taskq_t *zl_clean_taskq; /* runs lwb and itx clean tasks */ 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 */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Sep 11 10:41:42 2017 (r323432) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Sep 11 11:31:43 2017 (r323433) @@ -1407,8 +1407,7 @@ zil_clean(zilog_t *zilog, uint64_t synced_txg) return; } ASSERT3U(itxg->itxg_txg, <=, synced_txg); - ASSERT(itxg->itxg_txg != 0); - ASSERT(zilog->zl_clean_taskq != NULL); + ASSERT3U(itxg->itxg_txg, !=, 0); clean_me = itxg->itxg_itxs; itxg->itxg_itxs = NULL; itxg->itxg_txg = 0; @@ -1419,7 +1418,9 @@ zil_clean(zilog_t *zilog, uint64_t synced_txg) * free it in-line. This should be rare. Note, using TQ_SLEEP * created a bad performance problem. */ - if (taskq_dispatch(zilog->zl_clean_taskq, + ASSERT3P(zilog->zl_dmu_pool, !=, NULL); + ASSERT3P(zilog->zl_dmu_pool->dp_zil_clean_taskq, !=, NULL); + if (taskq_dispatch(zilog->zl_dmu_pool->dp_zil_clean_taskq, (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == 0) zil_itxg_clean(clean_me); } @@ -1848,13 +1849,10 @@ zil_open(objset_t *os, zil_get_data_t *get_data) { zilog_t *zilog = dmu_objset_zil(os); - ASSERT(zilog->zl_clean_taskq == NULL); ASSERT(zilog->zl_get_data == NULL); ASSERT(list_is_empty(&zilog->zl_lwb_list)); zilog->zl_get_data = get_data; - zilog->zl_clean_taskq = taskq_create("zil_clean", 1, minclsyspri, - 2, 2, TASKQ_PREPOPULATE); return (zilog); } @@ -1888,8 +1886,6 @@ zil_close(zilog_t *zilog) zfs_dbgmsg("zil (%p) is dirty, txg %llu", zilog, txg); VERIFY(!zilog_is_dirty(zilog)); - taskq_destroy(zilog->zl_clean_taskq); - zilog->zl_clean_taskq = NULL; zilog->zl_get_data = NULL; /* From owner-svn-src-all@freebsd.org Mon Sep 11 12:08:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F0DDE08256; Mon, 11 Sep 2017 12:08:21 +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 4C1DB82D76; Mon, 11 Sep 2017 12:08:21 +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 v8BC8K3X008545; Mon, 11 Sep 2017 12:08:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BC8KP9008544; Mon, 11 Sep 2017 12:08:20 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709111208.v8BC8KP9008544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 11 Sep 2017 12:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323434 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 323434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 12:08:21 -0000 Author: avg Date: Mon Sep 11 12:08:20 2017 New Revision: 323434 URL: https://svnweb.freebsd.org/changeset/base/323434 Log: Revert r322601, Mark ZFS ABD inline functions static An alternative fix is to be merged from illumos shortly. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Mon Sep 11 11:31:43 2017 (r323433) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Mon Sep 11 12:08:20 2017 (r323434) @@ -61,7 +61,7 @@ typedef int abd_iter_func2_t(void *, void *, size_t, v extern boolean_t zfs_abd_scatter_enabled; -static inline boolean_t +inline boolean_t abd_is_linear(abd_t *abd) { return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0 ? B_TRUE : B_FALSE); @@ -110,31 +110,31 @@ void abd_zero_off(abd_t *, size_t, size_t); * Wrappers for calls with offsets of 0 */ -static inline void +inline void abd_copy(abd_t *dabd, abd_t *sabd, size_t size) { abd_copy_off(dabd, sabd, 0, 0, size); } -static inline void +inline void abd_copy_from_buf(abd_t *abd, const void *buf, size_t size) { abd_copy_from_buf_off(abd, buf, 0, size); } -static inline void +inline void abd_copy_to_buf(void* buf, abd_t *abd, size_t size) { abd_copy_to_buf_off(buf, abd, 0, size); } -static inline int +inline int abd_cmp_buf(abd_t *abd, const void *buf, size_t size) { return (abd_cmp_buf_off(abd, buf, 0, size)); } -static inline void +inline void abd_zero(abd_t *abd, size_t size) { abd_zero_off(abd, 0, size); From owner-svn-src-all@freebsd.org Mon Sep 11 12:15:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F6D0E0884F; Mon, 11 Sep 2017 12:15:50 +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 6071083273; Mon, 11 Sep 2017 12:15:50 +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 v8BCFnRa012516; Mon, 11 Sep 2017 12:15:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BCFnBW012514; Mon, 11 Sep 2017 12:15:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709111215.v8BCFnBW012514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 11 Sep 2017 12:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323435 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 12:15:50 -0000 Author: avg Date: Mon Sep 11 12:15:49 2017 New Revision: 323435 URL: https://svnweb.freebsd.org/changeset/base/323435 Log: MFV r323111: 8569 problem with inline functions in abd.h illumos/illumos-gate@37e84ab74e939caf52150fc3352081786ecc0c29 https://github.com/illumos/illumos-gate/commit/37e84ab74e939caf52150fc3352081786ecc0c29 https://www.illumos.org/issues/8569 C [C99] has peculiar rules for inline functions that are different from the C++ rules. Unlike C++ where inline is "fire and forget", in C a programmer must pay attention to the function's storage class / visibility. The main problem is with the case where a compiler decides to not inline a call to the function declared as inline. Some relevant links: - http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15831.html - http://www.drdobbs.com/the-new-c-inline-functions/184401540 The summary is that either the inline functions should be declared 'static inline' or one of the compilation units (.c files) must provide a callable externally visible function definition. In the former case, the compiler would automatically create a local non-inlined function instance in every compilation unit where it's needed. In the latter case the single external definition is used to satisfy any non-inlined calls in all compilation units. As things stand right now, we can get an undefined reference error under certain combinations of compilers and compiler options. For example, this is what I get on FreeBSD when compiling with clang 4.0.0 and -O1: In function `abd_free': /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c:385: undefined reference to `abd_is_linear' Reviewed by: Matt Ahrens Approved by: Robert Mustacchi Author: Andriy Gapon MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Mon Sep 11 12:08:20 2017 (r323434) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Mon Sep 11 12:15:49 2017 (r323435) @@ -157,6 +157,13 @@ extern vmem_t *zio_alloc_arena; kmem_cache_t *abd_chunk_cache; static kstat_t *abd_ksp; +extern inline boolean_t abd_is_linear(abd_t *abd); +extern inline void abd_copy(abd_t *dabd, abd_t *sabd, size_t size); +extern inline void abd_copy_from_buf(abd_t *abd, const void *buf, size_t size); +extern inline void abd_copy_to_buf(void* buf, abd_t *abd, size_t size); +extern inline int abd_cmp_buf(abd_t *abd, const void *buf, size_t size); +extern inline void abd_zero(abd_t *abd, size_t size); + static void * abd_alloc_chunk() { From owner-svn-src-all@freebsd.org Mon Sep 11 14:33:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34DDDE0EDBA; Mon, 11 Sep 2017 14:33:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F3823AA6; Mon, 11 Sep 2017 14:33:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BEX5UP071482; Mon, 11 Sep 2017 14:33:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BEX4Wj071477; Mon, 11 Sep 2017 14:33:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709111433.v8BEX4Wj071477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 11 Sep 2017 14:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323436 - in head: release/amd64 release/arm64 release/i386 release/powerpc sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: release/amd64 release/arm64 release/i386 release/powerpc sys/boot/efi/boot1 X-SVN-Commit-Revision: 323436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 14:33:06 -0000 Author: emaste Date: Mon Sep 11 14:33:04 2017 New Revision: 323436 URL: https://svnweb.freebsd.org/changeset/base/323436 Log: boot1: remove BOOT1_MAXSIZE default value This Makefile relies on Makefile.fat providing the correct value for BOOT1_MAXSIZE and BOOT1_OFFSET. Since BOOT1_OFFSET had no default value here the build would already fail if Makefile.fat did not provide correct values. Sponsored by: The FreeBSD Foundation Modified: head/release/amd64/make-memstick.sh head/release/arm64/make-memstick.sh head/release/i386/make-memstick.sh head/release/powerpc/make-memstick.sh head/sys/boot/efi/boot1/Makefile Modified: head/release/amd64/make-memstick.sh ============================================================================== --- head/release/amd64/make-memstick.sh Mon Sep 11 12:15:49 2017 (r323435) +++ head/release/amd64/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/arm64/make-memstick.sh ============================================================================== --- head/release/arm64/make-memstick.sh Mon Sep 11 12:15:49 2017 (r323435) +++ head/release/arm64/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/i386/make-memstick.sh ============================================================================== --- head/release/i386/make-memstick.sh Mon Sep 11 12:15:49 2017 (r323435) +++ head/release/i386/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/powerpc/make-memstick.sh ============================================================================== --- head/release/powerpc/make-memstick.sh Mon Sep 11 12:15:49 2017 (r323435) +++ head/release/powerpc/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) @@ -37,7 +37,7 @@ fi echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local rm -f ${tempfile} -makefs -B big ${tempfile} ${1} +makefs -B big -o version=2 ${tempfile} ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/sys/boot/efi/boot1/Makefile ============================================================================== --- head/sys/boot/efi/boot1/Makefile Mon Sep 11 12:15:49 2017 (r323435) +++ head/sys/boot/efi/boot1/Makefile Mon Sep 11 14:33:04 2017 (r323436) @@ -126,7 +126,6 @@ boot1.o: ${.CURDIR}/../../common/ufsread.c # created by generate-fat.sh .include "${.CURDIR}/Makefile.fat" -BOOT1_MAXSIZE?= 131072 boot1.efifat: boot1.efi @set -- `ls -l ${.ALLSRC}`; \ From owner-svn-src-all@freebsd.org Mon Sep 11 14:35:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA419E0EF6C; Mon, 11 Sep 2017 14:35:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4D6A3C6B; Mon, 11 Sep 2017 14:35:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BEZhhr071757; Mon, 11 Sep 2017 14:35:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BEZhf9071753; Mon, 11 Sep 2017 14:35:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709111435.v8BEZhf9071753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 11 Sep 2017 14:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323437 - in head/release: amd64 arm64 i386 powerpc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/release: amd64 arm64 i386 powerpc X-SVN-Commit-Revision: 323437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 14:35:45 -0000 Author: emaste Date: Mon Sep 11 14:35:43 2017 New Revision: 323437 URL: https://svnweb.freebsd.org/changeset/base/323437 Log: revert unintentional changes from r323436 Modified: head/release/amd64/make-memstick.sh head/release/arm64/make-memstick.sh head/release/i386/make-memstick.sh head/release/powerpc/make-memstick.sh Modified: head/release/amd64/make-memstick.sh ============================================================================== --- head/release/amd64/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) +++ head/release/amd64/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/arm64/make-memstick.sh ============================================================================== --- head/release/arm64/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) +++ head/release/arm64/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/i386/make-memstick.sh ============================================================================== --- head/release/i386/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) +++ head/release/i386/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/powerpc/make-memstick.sh ============================================================================== --- head/release/powerpc/make-memstick.sh Mon Sep 11 14:33:04 2017 (r323436) +++ head/release/powerpc/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) @@ -37,7 +37,7 @@ fi echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local rm -f ${tempfile} -makefs -B big -o version=2 ${tempfile} ${1} +makefs -B big ${tempfile} ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local From owner-svn-src-all@freebsd.org Mon Sep 11 14:41:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B470E0F56C; Mon, 11 Sep 2017 14:41:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 069D2634CD; Mon, 11 Sep 2017 14:41:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BEfwjP072874; Mon, 11 Sep 2017 14:41:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BEfv7p072870; Mon, 11 Sep 2017 14:41:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709111441.v8BEfv7p072870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 11 Sep 2017 14:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323438 - in head/release: amd64 arm64 i386 powerpc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/release: amd64 arm64 i386 powerpc X-SVN-Commit-Revision: 323438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 14:41:59 -0000 Author: emaste Date: Mon Sep 11 14:41:57 2017 New Revision: 323438 URL: https://svnweb.freebsd.org/changeset/base/323438 Log: make-memstick.sh: use UFSv2 There's not much practical difference as far as install media is concerned but newfs creates UFSv2 by default and it is sensible to use the contemporary UFS version. I also intend to change makefs to create UFSv2 by default (to match newfs) so we'll want make-memstick.sh to be explicit, rather than relying on the host tool's default. Reviewed by: andrew, gjb, jhibbits MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12231 Modified: head/release/amd64/make-memstick.sh head/release/arm64/make-memstick.sh head/release/i386/make-memstick.sh head/release/powerpc/make-memstick.sh Modified: head/release/amd64/make-memstick.sh ============================================================================== --- head/release/amd64/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) +++ head/release/amd64/make-memstick.sh Mon Sep 11 14:41:57 2017 (r323438) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/arm64/make-memstick.sh ============================================================================== --- head/release/arm64/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) +++ head/release/arm64/make-memstick.sh Mon Sep 11 14:41:57 2017 (r323438) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/i386/make-memstick.sh ============================================================================== --- head/release/i386/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) +++ head/release/i386/make-memstick.sh Mon Sep 11 14:41:57 2017 (r323438) @@ -32,7 +32,7 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local -makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: head/release/powerpc/make-memstick.sh ============================================================================== --- head/release/powerpc/make-memstick.sh Mon Sep 11 14:35:43 2017 (r323437) +++ head/release/powerpc/make-memstick.sh Mon Sep 11 14:41:57 2017 (r323438) @@ -37,7 +37,7 @@ fi echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local rm -f ${tempfile} -makefs -B big ${tempfile} ${1} +makefs -B big -o version=2 ${tempfile} ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local From owner-svn-src-all@freebsd.org Mon Sep 11 15:18:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D651E111E4; Mon, 11 Sep 2017 15:18:44 +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 3CA7964974; Mon, 11 Sep 2017 15:18:44 +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 v8BFIh9Q088758; Mon, 11 Sep 2017 15:18:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BFIhqf088757; Mon, 11 Sep 2017 15:18:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709111518.v8BFIhqf088757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 11 Sep 2017 15:18:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323439 - head/usr.bin/ktrdump X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/ktrdump X-SVN-Commit-Revision: 323439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 15:18:44 -0000 Author: markj Date: Mon Sep 11 15:18:43 2017 New Revision: 323439 URL: https://svnweb.freebsd.org/changeset/base/323439 Log: Provide an error message if KTR symbols in a vmcore cannot be resolved. libkvm does not set an error string in this case, so we were previously failing silently. MFC after: 1 week Modified: head/usr.bin/ktrdump/ktrdump.c Modified: head/usr.bin/ktrdump/ktrdump.c ============================================================================== --- head/usr.bin/ktrdump/ktrdump.c Mon Sep 11 14:41:57 2017 (r323438) +++ head/usr.bin/ktrdump/ktrdump.c Mon Sep 11 15:18:43 2017 (r323439) @@ -98,6 +98,7 @@ main(int ac, char **av) char *p; int version; int entries; + int count; int index, index2; int parm; int in; @@ -184,8 +185,12 @@ main(int ac, char **av) */ caph_cache_catpages(); - if (kvm_nlist(kd, nl) != 0 || - kvm_read(kd, nl[0].n_value, &version, sizeof(version)) == -1) + count = kvm_nlist(kd, nl); + if (count == -1) + errx(1, "%s", kvm_geterr(kd)); + if (count > 0) + errx(1, "failed to resolve ktr symbols"); + if (kvm_read(kd, nl[0].n_value, &version, sizeof(version)) == -1) errx(1, "%s", kvm_geterr(kd)); if (version != KTR_VERSION) errx(1, "ktr version mismatch"); From owner-svn-src-all@freebsd.org Mon Sep 11 15:31:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B737E11FAF; Mon, 11 Sep 2017 15:31:30 +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 4494965488; Mon, 11 Sep 2017 15:31:30 +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 v8BFVTJK095132; Mon, 11 Sep 2017 15:31:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BFVT5N095131; Mon, 11 Sep 2017 15:31:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709111531.v8BFVT5N095131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 15:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323440 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 323440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 15:31:30 -0000 Author: ian Date: Mon Sep 11 15:31:29 2017 New Revision: 323440 URL: https://svnweb.freebsd.org/changeset/base/323440 Log: MFC r321586: Add a debug sysctl that lets you see i2c bus traffic through this device. Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_i2c.c Mon Sep 11 15:18:43 2017 (r323439) +++ stable/11/sys/arm/freescale/imx/imx_i2c.c Mon Sep 11 15:31:29 2017 (r323440) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -139,8 +140,18 @@ struct i2c_softc { int rb_pinctl_idx; gpio_pin_t rb_sclpin; gpio_pin_t rb_sdapin; + u_int debug; + u_int slave; }; +#define DEVICE_DEBUGF(sc, lvl, fmt, args...) \ + if ((lvl) <= (sc)->debug) \ + device_printf((sc)->dev, fmt, ##args) + +#define DEBUGF(sc, lvl, fmt, args...) \ + if ((lvl) <= (sc)->debug) \ + printf(fmt, ##args) + static phandle_t i2c_get_node(device_t, device_t); static int i2c_probe(device_t); static int i2c_attach(device_t); @@ -384,6 +395,12 @@ i2c_attach(device_t dev) return (ENXIO); } + /* Set up debug-enable sysctl. */ + SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), + OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->debug, 0, + "Enable debug; 1=reads/writes, 2=add starts/stops"); + /* * Set up for bus recovery using gpio pins, if the pinctrl and gpio * properties are present. This is optional. If all the config data is @@ -451,6 +468,8 @@ i2c_repeated_start(device_t dev, u_char slave, int tim DELAY(1); i2c_write_reg(sc, I2C_STATUS_REG, 0x0); i2c_write_reg(sc, I2C_DATA_REG, slave); + sc->slave = slave; + DEVICE_DEBUGF(sc, 2, "rstart 0x%02x\n", sc->slave); error = wait_for_xfer(sc, true); return (i2c_error_handler(sc, error)); } @@ -473,6 +492,8 @@ i2c_start_ll(device_t dev, u_char slave, int timeout) return (i2c_error_handler(sc, error)); i2c_write_reg(sc, I2C_STATUS_REG, 0); i2c_write_reg(sc, I2C_DATA_REG, slave); + sc->slave = slave; + DEVICE_DEBUGF(sc, 2, "start 0x%02x\n", sc->slave); error = wait_for_xfer(sc, true); return (i2c_error_handler(sc, error)); } @@ -512,6 +533,7 @@ i2c_stop(device_t dev) i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN); wait_for_busbusy(sc, false); i2c_write_reg(sc, I2C_CONTROL_REG, 0); + DEVICE_DEBUGF(sc, 2, "stop 0x%02x\n", sc->slave); return (IIC_NOERR); } @@ -523,6 +545,8 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_c sc = device_get_softc(dev); + DEVICE_DEBUGF(sc, 1, "reset\n"); + /* * Look up the divisor that gives the nearest speed that doesn't exceed * the configured value for the bus. @@ -568,6 +592,7 @@ i2c_read(device_t dev, char *buf, int len, int *read, sc = device_get_softc(dev); *read = 0; + DEVICE_DEBUGF(sc, 1, "read 0x%02x len %d: ", sc->slave, len); if (len) { if (len == 1) i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | @@ -599,9 +624,11 @@ i2c_read(device_t dev, char *buf, int len, int *read, } } reg = i2c_read_reg(sc, I2C_DATA_REG); + DEBUGF(sc, 1, "0x%02x ", reg); *buf++ = reg; (*read)++; } + DEBUGF(sc, 1, "\n"); return (i2c_error_handler(sc, error)); } @@ -616,13 +643,15 @@ i2c_write(device_t dev, const char *buf, int len, int error = 0; *sent = 0; + DEVICE_DEBUGF(sc, 1, "write 0x%02x len %d: ", sc->slave, len); while (*sent < len) { + DEBUGF(sc, 1, "0x%02x ", *buf); i2c_write_reg(sc, I2C_STATUS_REG, 0x0); i2c_write_reg(sc, I2C_DATA_REG, *buf++); if ((error = wait_for_xfer(sc, true)) != IIC_NOERR) break; (*sent)++; } - + DEBUGF(sc, 1, "\n"); return (i2c_error_handler(sc, error)); } From owner-svn-src-all@freebsd.org Mon Sep 11 15:52:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CCE3E1319C; Mon, 11 Sep 2017 15:52:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 696DE661C1; Mon, 11 Sep 2017 15:52:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BFqOSa005609; Mon, 11 Sep 2017 15:52:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BFqOAi005604; Mon, 11 Sep 2017 15:52:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201709111552.v8BFqOAi005604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 11 Sep 2017 15:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323443 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 323443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 15:52:25 -0000 Author: kevans Date: Mon Sep 11 15:52:24 2017 New Revision: 323443 URL: https://svnweb.freebsd.org/changeset/base/323443 Log: bsdgrep: add a primitive literal matcher to unbreak fgrep in some scenarios MFC r322825: bsdgrep: add some additional tests for fgrep Previously added tests only check that fgrep is somewhat sane and works. Add some more tests that check that the implementation is basically functional and not producing incorrect results with various flags. MFC r322826: bsdgrep: add a primitive literal matcher fgrep/grep -F will error out at runtime if compiled with a regex(3) that does not define REG_NOSPEC or REG_LITERAL. glibc is one such regex(3) implementation, and as it turns out they don't support literal matching at all. Provide a primitive literal matcher for use with glibc and other implementations that don't support literal matching so that we don't completely lose fgrep/grep -F if compiled against libgnuregex on stable/10, stable/11, or other systems that we don't necessarily support. This is a wholly unoptimized implementation with no plans to optimize it as of now. This is due to both its use-case being primarily on unsupported systems in the near-distant future and that it's reinventing the wheel that we already have available as a feature of regex(3). PR: 222201 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Mon Sep 11 15:38:51 2017 (r323442) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Mon Sep 11 15:52:24 2017 (r323443) @@ -685,6 +685,59 @@ matchall_body() atf_check -s exit:1 grep "" test1 } + +atf_test_case fgrep_multipattern +fgrep_multipattern_head() +{ + atf_set "descr" "Check proper behavior with multiple patterns supplied to fgrep" +} +fgrep_multipattern_body() +{ + printf "Foo\nBar\nBaz" > test1 + + atf_check -o inline:"Foo\nBaz\n" grep -F -e "Foo" -e "Baz" test1 + atf_check -o inline:"Foo\nBaz\n" grep -F -e "Baz" -e "Foo" test1 + atf_check -o inline:"Bar\nBaz\n" grep -F -e "Bar" -e "Baz" test1 +} + +atf_test_case fgrep_icase +fgrep_icase_head() +{ + atf_set "descr" "Check proper handling of -i supplied to fgrep" +} +fgrep_icase_body() +{ + printf "Foo\nBar\nBaz" > test1 + + atf_check -o inline:"Foo\nBaz\n" grep -Fi -e "foo" -e "baz" test1 + atf_check -o inline:"Foo\nBaz\n" grep -Fi -e "baz" -e "foo" test1 + atf_check -o inline:"Bar\nBaz\n" grep -Fi -e "bar" -e "baz" test1 + atf_check -o inline:"Bar\nBaz\n" grep -Fi -e "BAR" -e "bAz" test1 +} + +atf_test_case fgrep_oflag +fgrep_oflag_head() +{ + atf_set "descr" "Check proper handling of -o supplied to fgrep" +} +fgrep_oflag_body() +{ + printf "abcdefghi\n" > test1 + + atf_check -o inline:"a\n" grep -Fo "a" test1 + atf_check -o inline:"i\n" grep -Fo "i" test1 + atf_check -o inline:"abc\n" grep -Fo "abc" test1 + atf_check -o inline:"fgh\n" grep -Fo "fgh" test1 + atf_check -o inline:"cde\n" grep -Fo "cde" test1 + atf_check -o inline:"bcd\n" grep -Fo -e "bcd" -e "cde" test1 + atf_check -o inline:"bcd\nefg\n" grep -Fo -e "bcd" -e "efg" test1 + + atf_check -s exit:1 grep -Fo "xabc" test1 + atf_check -s exit:1 grep -Fo "abcx" test1 + atf_check -s exit:1 grep -Fo "xghi" test1 + atf_check -s exit:1 grep -Fo "ghix" test1 + atf_check -s exit:1 grep -Fo "abcdefghiklmnopqrstuvwxyz" test1 +} # End FreeBSD atf_init_test_cases() @@ -726,5 +779,8 @@ atf_init_test_cases() atf_add_test_case mmap atf_add_test_case mmap_eof_not_eol atf_add_test_case matchall + atf_add_test_case fgrep_multipattern + atf_add_test_case fgrep_icase + atf_add_test_case fgrep_oflag # End FreeBSD } Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Mon Sep 11 15:38:51 2017 (r323442) +++ stable/11/usr.bin/grep/grep.c Mon Sep 11 15:52:24 2017 (r323443) @@ -721,12 +721,19 @@ main(int argc, char *argv[]) case GREP_BASIC: break; case GREP_FIXED: + /* + * regex(3) implementations that support fixed-string searches generally + * define either REG_NOSPEC or REG_LITERAL. Set the appropriate flag + * here. If neither are defined, GREP_FIXED later implies that the + * internal literal matcher should be used. Other cflags that have + * the same interpretation as REG_NOSPEC and REG_LITERAL should be + * similarly added here, and grep.h should be amended to take this into + * consideration when defining WITH_INTERNAL_NOSPEC. + */ #if defined(REG_NOSPEC) cflags |= REG_NOSPEC; #elif defined(REG_LITERAL) cflags |= REG_LITERAL; -#else - errx(2, "literal expressions not supported at compile time"); #endif break; case GREP_EXTENDED: @@ -743,7 +750,11 @@ main(int argc, char *argv[]) r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); /* Don't process any patterns if we have a blank one */ +#ifdef WITH_INTERNAL_NOSPEC + if (!matchall && grepbehave != GREP_FIXED) { +#else if (!matchall) { +#endif /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { #ifndef WITHOUT_FASTMATCH Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Mon Sep 11 15:38:51 2017 (r323442) +++ stable/11/usr.bin/grep/grep.h Mon Sep 11 15:52:24 2017 (r323443) @@ -57,6 +57,10 @@ extern const char *errstr[]; #define GREP_BASIC 1 #define GREP_EXTENDED 2 +#if !defined(REG_NOSPEC) && !defined(REG_LITERAL) +#define WITH_INTERNAL_NOSPEC +#endif + #define BINFILE_BIN 0 #define BINFILE_SKIP 1 #define BINFILE_TEXT 2 Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Mon Sep 11 15:38:51 2017 (r323442) +++ stable/11/usr.bin/grep/util.c Mon Sep 11 15:52:24 2017 (r323443) @@ -70,7 +70,10 @@ struct parsec { bool binary; /* Binary file? */ }; - +#ifdef WITH_INTERNAL_NOSPEC +static int litexec(const struct pat *pat, const char *string, + size_t nmatch, regmatch_t pmatch[]); +#endif static int procline(struct parsec *pc); static void printline(struct parsec *pc, int sep); static void printline_metadata(struct str *line, int sep); @@ -350,6 +353,67 @@ procfile(const char *fn) return (c); } +#ifdef WITH_INTERNAL_NOSPEC +/* + * Internal implementation of literal string search within a string, modeled + * after regexec(3), for use when the regex(3) implementation doesn't offer + * either REG_NOSPEC or REG_LITERAL. This does not apply in the default FreeBSD + * config, but in other scenarios such as building against libgnuregex or on + * some non-FreeBSD OSes. + */ +static int +litexec(const struct pat *pat, const char *string, size_t nmatch, + regmatch_t pmatch[]) +{ + char *(*strstr_fn)(const char *, const char *); + char *sub, *subject; + const char *search; + size_t idx, n, ofs, stringlen; + + if (cflags & REG_ICASE) + strstr_fn = strcasestr; + else + strstr_fn = strstr; + idx = 0; + ofs = pmatch[0].rm_so; + stringlen = pmatch[0].rm_eo; + if (ofs >= stringlen) + return (REG_NOMATCH); + subject = strndup(string, stringlen); + if (subject == NULL) + return (REG_ESPACE); + for (n = 0; ofs < stringlen;) { + search = (subject + ofs); + if ((unsigned long)pat->len > strlen(search)) + break; + sub = strstr_fn(search, pat->pat); + /* + * Ignoring the empty string possibility due to context: grep optimizes + * for empty patterns and will never reach this point. + */ + if (sub == NULL) + break; + ++n; + /* Fill in pmatch if necessary */ + if (nmatch > 0) { + pmatch[idx].rm_so = ofs + (sub - search); + pmatch[idx].rm_eo = pmatch[idx].rm_so + pat->len; + if (++idx == nmatch) + break; + ofs = pmatch[idx].rm_so + 1; + } else + /* We only needed to know if we match or not */ + break; + } + free(subject); + if (n > 0 && nmatch > 0) + for (n = idx; n < nmatch; ++n) + pmatch[n].rm_so = pmatch[n].rm_eo = -1; + + return (n > 0 ? 0 : REG_NOMATCH); +} +#endif /* WITH_INTERNAL_NOSPEC */ + #define iswword(x) (iswalnum((x)) || (x) == L'_') /* @@ -400,6 +464,11 @@ procline(struct parsec *pc) for (i = 0; i < patterns; i++) { pmatch.rm_so = st; pmatch.rm_eo = pc->ln.len; +#ifdef WITH_INTERNAL_NOSPEC + if (grepbehave == GREP_FIXED) + r = litexec(&pattern[i], pc->ln.dat, 1, &pmatch); + else +#endif #ifndef WITHOUT_FASTMATCH if (fg_pattern[i].pattern) r = fastexec(&fg_pattern[i], From owner-svn-src-all@freebsd.org Mon Sep 11 17:01:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68CAFE168F4; Mon, 11 Sep 2017 17:01:28 +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 42B2E68862; Mon, 11 Sep 2017 17:01: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 v8BH1Rdl030586; Mon, 11 Sep 2017 17:01:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BH1RKP030583; Mon, 11 Sep 2017 17:01:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709111701.v8BH1RKP030583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 17:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323446 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/iicbus X-SVN-Commit-Revision: 323446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 17:01:28 -0000 Author: ian Date: Mon Sep 11 17:01:26 2017 New Revision: 323446 URL: https://svnweb.freebsd.org/changeset/base/323446 Log: MFC r321583, r321584: Add a pair of convenience routines for doing simple "register" read/writes on i2c devices, where the "register" can be any length. Add support for tracking nested calls to iicbus_request/release_bus(). Usually it is sufficient to use iicbus_transfer_excl(), or one of the higher-level convenience functions that use it, to reserve the bus for the duration of each register access. Occasionally it is important that a series of accesses or read-modify-write operations must be done without any other intervening access to the device, to prevent corrupting state. Modified: stable/11/sys/dev/iicbus/iicbus.h stable/11/sys/dev/iicbus/iiconf.c stable/11/sys/dev/iicbus/iiconf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/iicbus.h ============================================================================== --- stable/11/sys/dev/iicbus/iicbus.h Mon Sep 11 15:59:20 2017 (r323445) +++ stable/11/sys/dev/iicbus/iicbus.h Mon Sep 11 17:01:26 2017 (r323446) @@ -39,6 +39,7 @@ struct iicbus_softc { device_t dev; /* Myself */ device_t owner; /* iicbus owner device structure */ + u_int owncount; /* iicbus ownership nesting count */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ u_char strict; /* deny operations that violate the Modified: stable/11/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.c Mon Sep 11 15:59:20 2017 (r323445) +++ stable/11/sys/dev/iicbus/iiconf.c Mon Sep 11 17:01:26 2017 (r323446) @@ -113,26 +113,30 @@ iicbus_request_bus(device_t bus, device_t dev, int how IICBUS_LOCK(sc); - while ((error == 0) && (sc->owner != NULL)) + while (error == 0 && sc->owner != NULL && sc->owner != dev) error = iicbus_poll(sc, how); if (error == 0) { - sc->owner = dev; - /* - * Drop the lock around the call to the bus driver. - * This call should be allowed to sleep in the IIC_WAIT case. - * Drivers might also need to grab locks that would cause LOR - * if our lock is held. - */ - IICBUS_UNLOCK(sc); - /* Ask the underlying layers if the request is ok */ - error = IICBUS_CALLBACK(device_get_parent(bus), - IIC_REQUEST_BUS, (caddr_t)&how); - IICBUS_LOCK(sc); - - if (error != 0) { - sc->owner = NULL; - wakeup_one(sc); + ++sc->owncount; + if (sc->owner == NULL) { + sc->owner = dev; + /* + * Drop the lock around the call to the bus driver, it + * should be allowed to sleep in the IIC_WAIT case. + * Drivers might also need to grab locks that would + * cause a LOR if our lock is held. + */ + IICBUS_UNLOCK(sc); + /* Ask the underlying layers if the request is ok */ + error = IICBUS_CALLBACK(device_get_parent(bus), + IIC_REQUEST_BUS, (caddr_t)&how); + IICBUS_LOCK(sc); + + if (error != 0) { + sc->owner = NULL; + sc->owncount = 0; + wakeup_one(sc); + } } } @@ -150,7 +154,6 @@ int iicbus_release_bus(device_t bus, device_t dev) { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - int error; IICBUS_LOCK(sc); @@ -159,26 +162,16 @@ iicbus_release_bus(device_t bus, device_t dev) return (IIC_EBUSBSY); } - /* - * Drop the lock around the call to the bus driver. - * This call should be allowed to sleep in the IIC_WAIT case. - * Drivers might also need to grab locks that would cause LOR - * if our lock is held. - */ - IICBUS_UNLOCK(sc); - /* Ask the underlying layers if the release is ok */ - error = IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); - - if (error == 0) { + if (--sc->owncount == 0) { + /* Drop the lock while informing the low-level driver. */ + IICBUS_UNLOCK(sc); + IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); IICBUS_LOCK(sc); sc->owner = NULL; - - /* wakeup a waiting thread */ wakeup_one(sc); - IICBUS_UNLOCK(sc); } - - return (error); + IICBUS_UNLOCK(sc); + return (0); } /* @@ -469,4 +462,56 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs if (error != 0 && started) iicbus_stop(bus); return (error); +} + +int +iicdev_readfrom(device_t slavedev, uint8_t regaddr, void *buffer, + uint16_t buflen, int waithow) +{ + struct iic_msg msgs[2]; + uint8_t slaveaddr; + + /* + * Two transfers back to back with a repeat-start between them; first we + * write the address-within-device, then we read from the device. + */ + slaveaddr = iicbus_get_addr(slavedev); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®addr; + + msgs[1].slave = slaveaddr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = buflen; + msgs[1].buf = buffer; + + return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); +} + +int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer, + uint16_t buflen, int waithow) +{ + struct iic_msg msgs[2]; + uint8_t slaveaddr; + + /* + * Two transfers back to back with no stop or start between them; first + * we write the address then we write the data to that address, all in a + * single transfer from two scattered buffers. + */ + slaveaddr = iicbus_get_addr(slavedev); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®addr; + + msgs[1].slave = slaveaddr; + msgs[1].flags = IIC_M_WR | IIC_M_NOSTART; + msgs[1].len = buflen; + msgs[1].buf = buffer; + + return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); } Modified: stable/11/sys/dev/iicbus/iiconf.h ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.h Mon Sep 11 15:59:20 2017 (r323445) +++ stable/11/sys/dev/iicbus/iiconf.h Mon Sep 11 17:01:26 2017 (r323446) @@ -133,6 +133,16 @@ int iicbus_transfer_excl(device_t bus, struct iic_msg int how); int iicbus_transfer_gen(device_t bus, struct iic_msg *msgs, uint32_t nmsgs); +/* + * Simple register read/write routines, but the "register" can be any size. + * The transfers are done with iicbus_transfer_excl(). Reads use a repeat-start + * between sending the address and reading; writes use a single start/stop. + */ +int iicdev_readfrom(device_t _slavedev, uint8_t _regaddr, void *_buffer, + uint16_t _buflen, int _waithow); +int iicdev_writeto(device_t _slavedev, uint8_t _regaddr, void *_buffer, + uint16_t _buflen, int _waithow); + #define IICBUS_MODVER 1 #define IICBUS_MINVER 1 #define IICBUS_MAXVER 1 From owner-svn-src-all@freebsd.org Mon Sep 11 17:32:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F853E186C4; Mon, 11 Sep 2017 17:32: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 B97C66A1CA; Mon, 11 Sep 2017 17:32: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 v8BHWRjh046526; Mon, 11 Sep 2017 17:32:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BHWRgq046517; Mon, 11 Sep 2017 17:32:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709111732.v8BHWRgq046517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 17:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323447 - in stable/11: share/man/man9 sys/amd64/amd64 sys/isa sys/kern sys/sys sys/x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: share/man/man9 sys/amd64/amd64 sys/isa sys/kern sys/sys sys/x86/isa X-SVN-Commit-Revision: 323447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 17:32:29 -0000 Author: ian Date: Mon Sep 11 17:32:26 2017 New Revision: 323447 URL: https://svnweb.freebsd.org/changeset/base/323447 Log: MFC r320901-r320902, r320996-r320997, r321002, r321048, r321400, r321743, r321745 r320901: Protect access to the AT realtime clock with its own mutex. The mutex protecting access to the registered realtime clock should not be overloaded to protect access to the atrtc hardware, which might not even be the registered rtc. More importantly, the resettodr mutex needs to be eliminated to remove locking/sleeping restrictions on clock drivers, and that can't happen if MD code for amd64 depends on it. This change moves the protection into what's really being protected: access to the atrtc date and time registers. This change also adds protection when the clock is accessed from xentimer_settime(), which bypasses the resettodr locking. Differential Revision: https://reviews.freebsd.org/D11483 r320902: Support multiple realtime clocks, and remove locking/sleeping restrictions on clock drivers. This tracks multiple concurrent realtime clock drivers in a list sorted by clock resolution. When system time changes (and periodically) the clock_settime() methods of all registered clocks are invoked. To initialize system time, each driver is tried in turn from best to worst resolution, until one succesfully returns a valid time. The code no longer holds a mutex while calling the clock_settime() and clock_gettime() methods of the registered clocks. This allows clock drivers to do whatever kind of locking or sleeping is necessary (this is especially important for i2c clock chips since i2c drivers often need to sleep). A new clock_register_flags() function allows the clock driver to pass flags. The flags currently defined help support drivers that use their own techniques to avoid roundoff errors (prevents the 4/5 rounding done by the subr_rtc code). A driver which may need to wait for resources (such as bus ownership) may pass a flag to indicate that it will obtain system time for itself after waiting for resources; this is merely an optimization to avoid the common code retrieving a timespec that will never get used. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11484 r320996: Allow setting debug.clocktime as a tunable. Print 64-bit time_t correctly on 32-bit systems. r320997: Minor optimization: instead of converting between days and years using loops that start in 1970, assume most conversions are going to be for recent dates and use a precomputed number of days through the end of 2016. r321002: Revert r320997. There are reports of it getting the wrong results, so clearly my testing was insuffficent, and it's best to just revert it until I get it straightened out. r321048: Minor optimization: instead of converting between days and years using loops that start in 1970, assume most conversions are going to be for recent dates and use a precomputed number of days through the end of 2016. This is a do-over of r320997, hopefully this time with 100% more workiness. The first attempt had an off-by-one error, but instead of just adding another mysterious +1 adjustment, this rearranges the relationship between recent_base_year and recent_base_days so that the latter is the number of days that occurred before the start of the associated year (instead of the count thru the end of that year). This makes the recent_base stuff work more like the original loop logic that didn't need any +1 adjustments. r321400: Add common code to support realtime clocks that store year without century. Most realtime clocks store the year as 2 BCD digits. Some add a century bit to extend the range another hundred years. Every clock driver has its own code to determine the century and pass a full year value to clock_ct_to_ts(). Now clock drivers can just convert BCD to bin and store the result in the clocktime struct and let the common code figure out the century. Clocks with a century bit can just add 100 to year if the century bit is on. r321743: Add taskqueue_enqueue_timeout_sbt(), because sometimes you want more control over the scheduling precision than 'ticks' can offer, and because sometimes you're already working with sbintime_t units and it's dumb to convert them to ticks just so they can get converted back to sbintime_t under the hood. r321745: Add clock_schedule(), a feature that allows realtime clock drivers to request that their clock_settime() methods be called at a given offset from top-of-second. This adds a timeout_task to the rtc_instance so that each clock can be separately added to taskqueue_thread with the scheduling it prefers, instead of looping through all the clocks at once with a single task on taskqueue_thread. If a driver doesn't call clock_schedule() the default is the old behavior: clock_settime() is queued immediately. Modified: stable/11/share/man/man9/taskqueue.9 stable/11/sys/amd64/amd64/efirt.c stable/11/sys/isa/rtc.h stable/11/sys/kern/subr_clock.c stable/11/sys/kern/subr_rtc.c stable/11/sys/kern/subr_taskqueue.c stable/11/sys/sys/clock.h stable/11/sys/sys/taskqueue.h stable/11/sys/x86/isa/atrtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/taskqueue.9 ============================================================================== --- stable/11/share/man/man9/taskqueue.9 Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/share/man/man9/taskqueue.9 Mon Sep 11 17:32:26 2017 (r323447) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2016 +.Dd July 30, 2017 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -82,6 +82,8 @@ struct timeout_task; .Ft int .Fn taskqueue_enqueue_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task" "int ticks" .Ft int +.Fn taskqueue_enqueue_timeout_sbt "struct taskqueue *queue" "struct timeout_task *timeout_task" "sbintime_t sbt" "sbintime_t pr" "int flags" +.Ft int .Fn taskqueue_cancel "struct taskqueue *queue" "struct task *task" "u_int *pendp" .Ft int .Fn taskqueue_cancel_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task" "u_int *pendp" @@ -211,8 +213,17 @@ is called on the task pointer passed to .Pp The .Fn taskqueue_enqueue_timeout -is used to schedule the enqueue after the specified amount of +function is used to schedule the enqueue after the specified number of .Va ticks . +The +.Fn taskqueue_enqueue_timeout_sbt +function provides finer control over the scheduling based on +.Va sbt , +.Va pr , +and +.Va flags , +as detailed in +.Xr timeout 9 . Only non-fast task queues can be used for .Va timeout_task scheduling. @@ -483,6 +494,7 @@ be created with a dedicated processing thread. .Xr ithread 9 , .Xr kthread 9 , .Xr swi 9 +.Xr timeout 9 .Sh HISTORY This interface first appeared in .Fx 5.0 . Modified: stable/11/sys/amd64/amd64/efirt.c ============================================================================== --- stable/11/sys/amd64/amd64/efirt.c Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/amd64/amd64/efirt.c Mon Sep 11 17:32:26 2017 (r323447) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -444,7 +445,7 @@ efi_get_time_locked(struct efi_tm *tm) efi_status status; int error; - mtx_assert(&resettodr_lock, MA_OWNED); + mtx_assert(&atrtc_time_lock, MA_OWNED); error = efi_enter(); if (error != 0) return (error); @@ -461,9 +462,9 @@ efi_get_time(struct efi_tm *tm) if (efi_runtime == NULL) return (ENXIO); - mtx_lock(&resettodr_lock); + mtx_lock(&atrtc_time_lock); error = efi_get_time_locked(tm); - mtx_unlock(&resettodr_lock); + mtx_unlock(&atrtc_time_lock); return (error); } @@ -486,7 +487,7 @@ efi_set_time_locked(struct efi_tm *tm) efi_status status; int error; - mtx_assert(&resettodr_lock, MA_OWNED); + mtx_assert(&atrtc_time_lock, MA_OWNED); error = efi_enter(); if (error != 0) return (error); @@ -503,9 +504,9 @@ efi_set_time(struct efi_tm *tm) if (efi_runtime == NULL) return (ENXIO); - mtx_lock(&resettodr_lock); + mtx_lock(&atrtc_time_lock); error = efi_set_time_locked(tm); - mtx_unlock(&resettodr_lock); + mtx_unlock(&atrtc_time_lock); return (error); } Modified: stable/11/sys/isa/rtc.h ============================================================================== --- stable/11/sys/isa/rtc.h Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/isa/rtc.h Mon Sep 11 17:32:26 2017 (r323447) @@ -113,6 +113,7 @@ #ifdef _KERNEL extern struct mtx clock_lock; +extern struct mtx atrtc_time_lock; extern int atrtcclock_disable; int rtcin(int reg); void atrtc_restore(void); Modified: stable/11/sys/kern/subr_clock.c ============================================================================== --- stable/11/sys/kern/subr_clock.c Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/kern/subr_clock.c Mon Sep 11 17:32:26 2017 (r323447) @@ -72,7 +72,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, adjkerntz, CTLTYPE_INT "Local offset from UTC in seconds"); static int ct_debug; -SYSCTL_INT(_debug, OID_AUTO, clocktime, CTLFLAG_RW, +SYSCTL_INT(_debug, OID_AUTO, clocktime, CTLFLAG_RWTUN, &ct_debug, 0, "Enable printing of clocktime debugging"); static int wall_cmos_clock; @@ -97,6 +97,13 @@ static const int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +/* + * Optimization: using a precomputed count of days between POSIX_BASE_YEAR and + * some recent year avoids lots of unnecessary loop iterations in conversion. + * recent_base_days is the number of days before the start of recent_base_year. + */ +static const int recent_base_year = 2017; +static const int recent_base_days = 17167; /* * This inline avoids some unnecessary modulo operations @@ -135,18 +142,27 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * { int i, year, days; - year = ct->year; - if (ct_debug) { printf("ct_to_ts("); print_ct(ct); printf(")"); } + /* + * Many realtime clocks store the year as 2-digit BCD; pivot on 70 to + * determine century. Some clocks have a "century bit" and drivers do + * year += 100, so interpret values between 70-199 as relative to 1900. + */ + year = ct->year; + if (year < 70) + year += 2000; + else if (year < 200) + year += 1900; + /* Sanity checks. */ if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 || ct->day > days_in_month(year, ct->mon) || - ct->hour > 23 || ct->min > 59 || ct->sec > 59 || + ct->hour > 23 || ct->min > 59 || ct->sec > 59 || year < 1970 || (sizeof(time_t) == 4 && year > 2037)) { /* time_t overflow */ if (ct_debug) printf(" = EINVAL\n"); @@ -157,8 +173,14 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * * Compute days since start of time * First from years, then from months. */ - days = 0; - for (i = POSIX_BASE_YEAR; i < year; i++) + if (year >= recent_base_year) { + i = recent_base_year; + days = recent_base_days; + } else { + i = POSIX_BASE_YEAR; + days = 0; + } + for (; i < year; i++) days += days_in_year(i); /* Months */ @@ -171,7 +193,7 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * ts->tv_nsec = ct->nsec; if (ct_debug) - printf(" = %ld.%09ld\n", (long)ts->tv_sec, (long)ts->tv_nsec); + printf(" = %jd.%09ld\n", (intmax_t)ts->tv_sec, ts->tv_nsec); return (0); } @@ -188,8 +210,14 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->dow = day_of_week(days); - /* Subtract out whole years, counting them in i. */ - for (year = POSIX_BASE_YEAR; days >= days_in_year(year); year++) + /* Subtract out whole years. */ + if (days >= recent_base_days) { + year = recent_base_year; + days -= recent_base_days; + } else { + year = POSIX_BASE_YEAR; + } + for (; days >= days_in_year(year); year++) days -= days_in_year(year); ct->year = year; @@ -209,8 +237,8 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->sec = rsec; ct->nsec = ts->tv_nsec; if (ct_debug) { - printf("ts_to_ct(%ld.%09ld) = ", - (long)ts->tv_sec, (long)ts->tv_nsec); + printf("ts_to_ct(%jd.%09ld) = ", + (intmax_t)ts->tv_sec, ts->tv_nsec); print_ct(ct); printf("\n"); } Modified: stable/11/sys/kern/subr_rtc.c ============================================================================== --- stable/11/sys/kern/subr_rtc.c Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/kern/subr_rtc.c Mon Sep 11 17:32:26 2017 (r323447) @@ -63,8 +63,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include +#include #include +#include #ifdef FFCLOCK #include #endif @@ -72,116 +74,249 @@ __FBSDID("$FreeBSD$"); #include "clock_if.h" -static device_t clock_dev = NULL; -static long clock_res; -static struct timespec clock_adj; -struct mtx resettodr_lock; -MTX_SYSINIT(resettodr_init, &resettodr_lock, "tod2rl", MTX_DEF); - /* XXX: should be kern. now, it's no longer machdep. */ static int disable_rtc_set; SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, 0, "Disallow adjusting time-of-day clock"); +/* + * An instance of a realtime clock. A list of these tracks all the registered + * clocks in the system. + * + * The resadj member is used to apply a "resolution adjustment" equal to half + * the clock's resolution, which is useful mainly on clocks with a whole-second + * resolution. Because the clock truncates the fractional part, adding half the + * resolution performs 4/5 rounding. The same adjustment is applied to the + * times returned from clock_gettime(), because the fraction returned will + * always be zero, but on average the actual fraction at the time of the call + * should be about .5. + */ +struct rtc_instance { + device_t clockdev; + int resolution; + int flags; + u_int schedns; + struct timespec resadj; + struct timeout_task + stask; + LIST_ENTRY(rtc_instance) + rtc_entries; +}; + +/* + * Clocks are updated using a task running on taskqueue_thread. + */ +static void settime_task_func(void *arg, int pending); + +/* + * Registered clocks are kept in a list which is sorted by resolution; the more + * accurate clocks get the first shot at providing the time. + */ +LIST_HEAD(rtc_listhead, rtc_instance); +static struct rtc_listhead rtc_list = LIST_HEAD_INITIALIZER(rtc_list); +static struct sx rtc_list_lock; +SX_SYSINIT(rtc_list_lock_init, &rtc_list_lock, "rtc list"); + +/* + * On the task thread, invoke the clock_settime() method of the clock. Do so + * holding no locks, so that clock drivers are free to do whatever kind of + * locking or sleeping they need to. + */ +static void +settime_task_func(void *arg, int pending) +{ + struct timespec ts; + struct rtc_instance *rtc; + + rtc = arg; + if (!(rtc->flags & CLOCKF_SETTIME_NO_TS)) { + getnanotime(&ts); + if (!(rtc->flags & CLOCKF_SETTIME_NO_ADJ)) { + ts.tv_sec -= utc_offset(); + timespecadd(&ts, &rtc->resadj); + } + } else { + ts.tv_sec = 0; + ts.tv_nsec = 0; + } + CLOCK_SETTIME(rtc->clockdev, &ts); +} + void -clock_register(device_t dev, long res) /* res has units of microseconds */ +clock_register_flags(device_t clockdev, long resolution, int flags) { + struct rtc_instance *rtc, *newrtc; - if (clock_dev != NULL) { - if (clock_res <= res) { - if (bootverbose) - device_printf(dev, "not installed as " - "time-of-day clock: clock %s has higher " - "resolution\n", device_get_name(clock_dev)); - return; + newrtc = malloc(sizeof(*newrtc), M_DEVBUF, M_WAITOK); + newrtc->clockdev = clockdev; + newrtc->resolution = (int)resolution; + newrtc->flags = flags; + newrtc->schedns = 0; + newrtc->resadj.tv_sec = newrtc->resolution / 2 / 1000000; + newrtc->resadj.tv_nsec = newrtc->resolution / 2 % 1000000 * 1000; + TIMEOUT_TASK_INIT(taskqueue_thread, &newrtc->stask, 0, + settime_task_func, newrtc); + + sx_xlock(&rtc_list_lock); + if (LIST_EMPTY(&rtc_list)) { + LIST_INSERT_HEAD(&rtc_list, newrtc, rtc_entries); + } else { + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if (rtc->resolution > newrtc->resolution) { + LIST_INSERT_BEFORE(rtc, newrtc, rtc_entries); + break; + } else if (LIST_NEXT(rtc, rtc_entries) == NULL) { + LIST_INSERT_AFTER(rtc, newrtc, rtc_entries); + break; + } } - if (bootverbose) - device_printf(clock_dev, "removed as " - "time-of-day clock: clock %s has higher " - "resolution\n", device_get_name(dev)); } - clock_dev = dev; - clock_res = res; - clock_adj.tv_sec = res / 2 / 1000000; - clock_adj.tv_nsec = res / 2 % 1000000 * 1000; - if (bootverbose) - device_printf(dev, "registered as a time-of-day clock " - "(resolution %ldus, adjustment %jd.%09jds)\n", res, - (intmax_t)clock_adj.tv_sec, (intmax_t)clock_adj.tv_nsec); + sx_xunlock(&rtc_list_lock); + + device_printf(clockdev, + "registered as a time-of-day clock, resolution %d.%6.6ds\n", + newrtc->resolution / 1000000, newrtc->resolution % 1000000); } -/* - * inittodr and settodr derived from the i386 versions written - * by Christoph Robitschko , reintroduced and - * updated by Chris Stenton 8/10/94 - */ +void +clock_register(device_t dev, long res) +{ + clock_register_flags(dev, res, 0); +} + +void +clock_unregister(device_t clockdev) +{ + struct rtc_instance *rtc, *tmp; + + sx_xlock(&rtc_list_lock); + LIST_FOREACH_SAFE(rtc, &rtc_list, rtc_entries, tmp) { + if (rtc->clockdev == clockdev) { + LIST_REMOVE(rtc, rtc_entries); + break; + } + } + sx_xunlock(&rtc_list_lock); + if (rtc != NULL) { + taskqueue_cancel_timeout(taskqueue_thread, &rtc->stask, NULL); + taskqueue_drain_timeout(taskqueue_thread, &rtc->stask); + free(rtc, M_DEVBUF); + } +} + +void +clock_schedule(device_t clockdev, u_int offsetns) +{ + struct rtc_instance *rtc; + + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if (rtc->clockdev == clockdev) { + rtc->schedns = offsetns; + break; + } + } + sx_xunlock(&rtc_list_lock); +} + /* - * Initialize the time of day register, based on the time base which is, e.g. - * from a filesystem. + * Initialize the system time. Must be called from a context which does not + * restrict any locking or sleeping that clock drivers may need to do. + * + * First attempt to get the time from a registered realtime clock. The clocks + * are queried in order of resolution until one provides the time. If no clock + * can provide the current time, use the 'base' time provided by the caller, if + * non-zero. The 'base' time is potentially highly inaccurate, such as the last + * known good value of the system clock, or even a filesystem last-updated + * timestamp. It is used to prevent system time from appearing to move + * backwards in logs. */ void inittodr(time_t base) { struct timespec ts; + struct rtc_instance *rtc; int error; - if (clock_dev == NULL) { - printf("warning: no time-of-day clock registered, system time " - "will not be set accurately\n"); - goto wrong_time; + error = ENXIO; + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if ((error = CLOCK_GETTIME(rtc->clockdev, &ts)) != 0) + continue; + if (ts.tv_sec < 0 || ts.tv_nsec < 0) { + error = EINVAL; + continue; + } + if (!(rtc->flags & CLOCKF_GETTIME_NO_ADJ)) { + timespecadd(&ts, &rtc->resadj); + ts.tv_sec += utc_offset(); + } + if (bootverbose) + device_printf(rtc->clockdev, + "providing initial system time\n"); + break; } - /* XXX: We should poll all registered RTCs in case of failure */ - mtx_lock(&resettodr_lock); - error = CLOCK_GETTIME(clock_dev, &ts); - mtx_unlock(&resettodr_lock); - if (error != 0 && error != EINVAL) { - printf("warning: clock_gettime failed (%d), the system time " - "will not be set accurately\n", error); - goto wrong_time; + sx_xunlock(&rtc_list_lock); + + /* + * Do not report errors from each clock; it is expected that some clocks + * cannot provide results in some situations. Only report problems when + * no clocks could provide the time. + */ + if (error != 0) { + switch (error) { + case ENXIO: + printf("Warning: no time-of-day clock registered, "); + break; + case EINVAL: + printf("Warning: bad time from time-of-day clock, "); + break; + default: + printf("Error reading time-of-day clock (%d), ", error); + break; + } + printf("system time will not be set accurately\n"); + ts.tv_sec = (base > 0) ? base : -1; + ts.tv_nsec = 0; } - if (error == EINVAL || ts.tv_sec < 0) { - printf("Invalid time in real time clock.\n" - "Check and reset the date immediately!\n"); - goto wrong_time; - } - ts.tv_sec += utc_offset(); - timespecadd(&ts, &clock_adj); - tc_setclock(&ts); + if (ts.tv_sec >= 0) { + tc_setclock(&ts); #ifdef FFCLOCK - ffclock_reset_clock(&ts); + ffclock_reset_clock(&ts); #endif - return; - -wrong_time: - if (base > 0) { - ts.tv_sec = base; - ts.tv_nsec = 0; - tc_setclock(&ts); } } /* - * Write system time back to RTC + * Write system time back to all registered clocks, unless disabled by admin. + * This can be called from a context that restricts locking and/or sleeping; the + * actual updating is done asynchronously on a task thread. */ void resettodr(void) { - struct timespec ts; - int error; + struct timespec now; + struct rtc_instance *rtc; + sbintime_t sbt; + long waitns; - if (disable_rtc_set || clock_dev == NULL) + if (disable_rtc_set) return; - getnanotime(&ts); - timespecadd(&ts, &clock_adj); - ts.tv_sec -= utc_offset(); - /* XXX: We should really set all registered RTCs */ - mtx_lock(&resettodr_lock); - error = CLOCK_SETTIME(clock_dev, &ts); - mtx_unlock(&resettodr_lock); - if (error != 0) - printf("warning: clock_settime failed (%d), time-of-day clock " - "not adjusted to system time\n", error); + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if (rtc->schedns != 0) { + getnanotime(&now); + waitns = rtc->schedns - now.tv_nsec; + if (waitns < 0) + waitns += 1000000000; + sbt = nstosbt(waitns); + } else + sbt = 0; + taskqueue_enqueue_timeout_sbt(taskqueue_thread, + &rtc->stask, -sbt, 0, C_PREL(31)); + } + sx_xunlock(&rtc_list_lock); } Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/kern/subr_taskqueue.c Mon Sep 11 17:32:26 2017 (r323447) @@ -289,8 +289,8 @@ taskqueue_timeout_func(void *arg) } int -taskqueue_enqueue_timeout(struct taskqueue *queue, - struct timeout_task *timeout_task, int ticks) +taskqueue_enqueue_timeout_sbt(struct taskqueue *queue, + struct timeout_task *timeout_task, sbintime_t sbt, sbintime_t pr, int flags) { int res; @@ -304,7 +304,7 @@ taskqueue_enqueue_timeout(struct taskqueue *queue, /* Do nothing */ TQ_UNLOCK(queue); res = -1; - } else if (ticks == 0) { + } else if (sbt == 0) { taskqueue_enqueue_locked(queue, &timeout_task->t); /* The lock is released inside. */ } else { @@ -313,16 +313,25 @@ taskqueue_enqueue_timeout(struct taskqueue *queue, } else { queue->tq_callouts++; timeout_task->f |= DT_CALLOUT_ARMED; - if (ticks < 0) - ticks = -ticks; /* Ignore overflow. */ + if (sbt < 0) + sbt = -sbt; /* Ignore overflow. */ } - if (ticks > 0) { - callout_reset(&timeout_task->c, ticks, - taskqueue_timeout_func, timeout_task); + if (sbt > 0) { + callout_reset_sbt(&timeout_task->c, sbt, pr, + taskqueue_timeout_func, timeout_task, flags); } TQ_UNLOCK(queue); } return (res); +} + +int +taskqueue_enqueue_timeout(struct taskqueue *queue, + struct timeout_task *ttask, int ticks) +{ + + return (taskqueue_enqueue_timeout_sbt(queue, ttask, ticks * tick_sbt, + 0, 0)); } static void Modified: stable/11/sys/sys/clock.h ============================================================================== --- stable/11/sys/sys/clock.h Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/sys/clock.h Mon Sep 11 17:32:26 2017 (r323447) @@ -54,7 +54,6 @@ */ extern int tz_minuteswest; extern int tz_dsttime; -extern struct mtx resettodr_lock; int utc_offset(void); @@ -76,7 +75,42 @@ struct clocktime { int clock_ct_to_ts(struct clocktime *, struct timespec *); void clock_ts_to_ct(struct timespec *, struct clocktime *); -void clock_register(device_t, long); + +/* + * Time-of-day clock functions and flags. These functions might sleep. + * + * clock_register and clock_unregister() do what they say. Upon return from + * unregister, the clock's methods are not running and will not be called again. + * + * clock_schedule() requests that a registered clock's clock_settime() calls + * happen at the given offset into the second. The default is 0, meaning no + * specific scheduling. To schedule the call as soon after top-of-second as + * possible, specify 1. Each clock has its own schedule, but taskqueue_thread + * is shared by many tasks; the timing of the call is not guaranteed. + * + * Flags: + * + * CLOCKF_SETTIME_NO_TS + * Do not pass a timespec to clock_settime(), the driver obtains its own time + * and applies its own adjustments (this flag implies CLOCKF_SETTIME_NO_ADJ). + * + * CLOCKF_SETTIME_NO_ADJ + * Do not apply utc offset and resolution/accuracy adjustments to the value + * passed to clock_settime(), the driver applies them itself. + * + * CLOCKF_GETTIME_NO_ADJ + * Do not apply utc offset and resolution/accuracy adjustments to the value + * returned from clock_gettime(), the driver has already applied them. + */ + +#define CLOCKF_SETTIME_NO_TS 0x00000001 +#define CLOCKF_SETTIME_NO_ADJ 0x00000002 +#define CLOCKF_GETTIME_NO_ADJ 0x00000004 + +void clock_register(device_t _clockdev, long _resolution_us); +void clock_register_flags(device_t _clockdev, long _resolution_us, int _flags); +void clock_schedule(device_t clockdev, u_int _offsetns); +void clock_unregister(device_t _clockdev); /* * BCD to decimal and decimal to BCD. Modified: stable/11/sys/sys/taskqueue.h ============================================================================== --- stable/11/sys/sys/taskqueue.h Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/sys/taskqueue.h Mon Sep 11 17:32:26 2017 (r323447) @@ -79,6 +79,9 @@ int taskqueue_start_threads_cpuset(struct taskqueue ** int taskqueue_enqueue(struct taskqueue *queue, struct task *task); int taskqueue_enqueue_timeout(struct taskqueue *queue, struct timeout_task *timeout_task, int ticks); +int taskqueue_enqueue_timeout_sbt(struct taskqueue *queue, + struct timeout_task *timeout_task, sbintime_t sbt, sbintime_t pr, + int flags); int taskqueue_poll_is_busy(struct taskqueue *queue, struct task *task); int taskqueue_cancel(struct taskqueue *queue, struct task *task, u_int *pendp); Modified: stable/11/sys/x86/isa/atrtc.c ============================================================================== --- stable/11/sys/x86/isa/atrtc.c Mon Sep 11 17:01:26 2017 (r323446) +++ stable/11/sys/x86/isa/atrtc.c Mon Sep 11 17:32:26 2017 (r323447) @@ -53,9 +53,17 @@ __FBSDID("$FreeBSD$"); #include #include "clock_if.h" +/* + * clock_lock protects low-level access to individual hardware registers. + * atrtc_time_lock protects the entire sequence of accessing multiple registers + * to read or write the date and time. + */ #define RTC_LOCK do { if (!kdb_active) mtx_lock_spin(&clock_lock); } while (0) #define RTC_UNLOCK do { if (!kdb_active) mtx_unlock_spin(&clock_lock); } while (0) +struct mtx atrtc_time_lock; +MTX_SYSINIT(atrtc_lock_init, &atrtc_time_lock, "atrtc", MTX_DEF); + int atrtcclock_disable = 0; static int rtc_reg = -1; @@ -158,6 +166,8 @@ atrtc_set(struct timespec *ts) clock_ts_to_ct(ts, &ct); + mtx_lock(&atrtc_time_lock); + /* Disable RTC updates and interrupts. */ writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); @@ -176,6 +186,8 @@ atrtc_set(struct timespec *ts) /* Re-enable RTC updates and interrupts. */ writertc(RTC_STATUSB, rtc_statusb); rtcin(RTC_INTR); + + mtx_unlock(&atrtc_time_lock); } /********************************************************************** @@ -347,6 +359,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) * to make sure that no more than 240us pass after we start reading, * and try again if so. */ + mtx_lock(&atrtc_time_lock); while (rtcin(RTC_STATUSA) & RTCSA_TUP) continue; critical_enter(); @@ -364,6 +377,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) ct.year += (ct.year < 80 ? 2000 : 1900); #endif critical_exit(); + mtx_unlock(&atrtc_time_lock); /* Set dow = -1 because some clocks don't set it correctly. */ ct.dow = -1; return (clock_ct_to_ts(&ct, ts)); From owner-svn-src-all@freebsd.org Mon Sep 11 17:39:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0594E18C02; Mon, 11 Sep 2017 17:39:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D98C6A47B; Mon, 11 Sep 2017 17:39:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BHdLFf046859; Mon, 11 Sep 2017 17:39:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BHdLSZ046858; Mon, 11 Sep 2017 17:39:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709111739.v8BHdLSZ046858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 11 Sep 2017 17:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323448 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 323448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 17:39:22 -0000 Author: emaste Date: Mon Sep 11 17:39:21 2017 New Revision: 323448 URL: https://svnweb.freebsd.org/changeset/base/323448 Log: Ignore error return from newaliases(1) This was originally added as "exit $SUCCESS" but with nothing to set the SUCCESS variable. Thus it became an exit with no argument, which just exits with the status of the preceding command. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/bsdinstall/scripts/config Modified: head/usr.sbin/bsdinstall/scripts/config ============================================================================== --- head/usr.sbin/bsdinstall/scripts/config Mon Sep 11 17:32:26 2017 (r323447) +++ head/usr.sbin/bsdinstall/scripts/config Mon Sep 11 17:39:21 2017 (r323448) @@ -53,7 +53,7 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot # Set up other things from installed config chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 -exit $SUCCESS +exit 0 ################################################################################ # END From owner-svn-src-all@freebsd.org Mon Sep 11 18:11:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1AB7E1A933; Mon, 11 Sep 2017 18:11: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 7F14B6B955; Mon, 11 Sep 2017 18:11: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 v8BIBrkd062965; Mon, 11 Sep 2017 18:11:53 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIBr8r062964; Mon, 11 Sep 2017 18:11:53 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709111811.v8BIBr8r062964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 11 Sep 2017 18:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323449 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 323449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:11:54 -0000 Author: cem Date: Mon Sep 11 18:11:53 2017 New Revision: 323449 URL: https://svnweb.freebsd.org/changeset/base/323449 Log: Decode new AMD SVM feature bits on family 17h Sponsored by: Dell EMC Isilon Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Mon Sep 11 17:39:21 2017 (r323448) +++ head/sys/x86/x86/identcpu.c Mon Sep 11 18:11:53 2017 (r323449) @@ -2152,9 +2152,27 @@ print_svm_info(void) "\011" "\012" "\013PauseFilter" /* PAUSE intercept filter */ - "\014" + "\014EncryptedMcodePatch" "\015PauseFilterThreshold" /* PAUSE filter threshold */ "\016AVIC" /* virtual interrupt controller */ + "\017" + "\020V_VMSAVE_VMLOAD" + "\021vGIF" + "\022" + "\023" + "\024" + "\025" + "\026" + "\027" + "\030" + "\031" + "\032" + "\033" + "\034" + "\035" + "\036" + "\037" + "\040" ); printf("\nRevision=%d, ASIDs=%d", regs[0] & 0xff, regs[1]); } From owner-svn-src-all@freebsd.org Mon Sep 11 18:29:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9A59E1BA51; Mon, 11 Sep 2017 18:29:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9792E6C3D7; Mon, 11 Sep 2017 18:29:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BIT9rp067408; Mon, 11 Sep 2017 18:29:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIT9B2067407; Mon, 11 Sep 2017 18:29:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709111829.v8BIT9B2067407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Sep 2017 18:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323450 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 323450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:29:10 -0000 Author: kib Date: Mon Sep 11 18:29:09 2017 New Revision: 323450 URL: https://svnweb.freebsd.org/changeset/base/323450 Log: Fix ioapic acpi id matching on PCI attach and rid calculation. Sponsored by: The FreeBSD Foundation MFC after: 11 days Modified: head/sys/x86/x86/io_apic.c Modified: head/sys/x86/x86/io_apic.c ============================================================================== --- head/sys/x86/x86/io_apic.c Mon Sep 11 18:11:53 2017 (r323449) +++ head/sys/x86/x86/io_apic.c Mon Sep 11 18:29:09 2017 (r323450) @@ -997,7 +997,7 @@ ioapic_pci_attach(device_t dev) } /* Then by apic id */ STAILQ_FOREACH(io, &ioapic_list, io_next) { - if (io->io_id == apic_id) + if (io->io_apic_id == apic_id) goto found; } mtx_unlock_spin(&icu_lock); @@ -1017,13 +1017,13 @@ found: io->pci_dev = dev; io->pci_wnd = res; if (bootverbose && (io->io_paddr != (vm_paddr_t)rman_get_start(res) || - io->io_id != apic_id)) { + io->io_apic_id != apic_id)) { device_printf(dev, "pci%d:%d:%d:%d pci BAR0@%jx id %d " "MADT id %d paddr@%jx\n", pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev), (uintmax_t)rman_get_start(res), apic_id, - io->io_id, (uintmax_t)io->io_paddr); + io->io_apic_id, (uintmax_t)io->io_paddr); } mtx_unlock_spin(&icu_lock); return (0); @@ -1051,7 +1051,7 @@ ioapic_get_rid(u_int apic_id, uint16_t *ridp) mtx_lock_spin(&icu_lock); STAILQ_FOREACH(io, &ioapic_list, io_next) { - if (io->io_id == apic_id) + if (io->io_apic_id == apic_id) break; } mtx_unlock_spin(&icu_lock); From owner-svn-src-all@freebsd.org Mon Sep 11 18:30:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B96DBE1BD50; Mon, 11 Sep 2017 18:30:51 +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 939696C5AB; Mon, 11 Sep 2017 18:30:51 +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 v8BIUoNO067540; Mon, 11 Sep 2017 18:30:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIUoYo067539; Mon, 11 Sep 2017 18:30:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709111830.v8BIUoYo067539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 11 Sep 2017 18:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323451 - stable/11/sys/dev/ntb/ntb_hw X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 323451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:30:51 -0000 Author: mav Date: Mon Sep 11 18:30:50 2017 New Revision: 323451 URL: https://svnweb.freebsd.org/changeset/base/323451 Log: MFC r322980: Fix fake interrupt when set doorbell is unmasked. Since the doorbell bit is already set when interrupt handler is called, the event was not propagated to upper layer. It was working normally because present code was not using masking actively, but that is going to change. Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c Mon Sep 11 18:29:09 2017 (r323450) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c Mon Sep 11 18:30:50 2017 (r323451) @@ -253,7 +253,8 @@ struct ntb_softc { uint64_t db_valid_mask; uint64_t db_link_mask; uint64_t db_mask; - uint64_t fake_db_bell; /* NTB_SB01BASE_LOCKUP*/ + uint64_t fake_db; /* NTB_SB01BASE_LOCKUP*/ + uint64_t force_db; /* NTB_SB01BASE_LOCKUP*/ int last_ts; /* ticks @ last irq */ @@ -1206,10 +1207,11 @@ intel_ntb_db_clear_mask(device_t dev, uint64_t bits) (uintmax_t)ntb->db_valid_mask)); DB_MASK_LOCK(ntb); - ibits = ntb->fake_db_bell & ntb->db_mask & bits; + ibits = ntb->fake_db & ntb->db_mask & bits; ntb->db_mask &= ~bits; if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { /* Simulate fake interrupts if unmasked DB bits are set. */ + ntb->force_db |= ibits; for (i = 0; i < XEON_NONLINK_DB_MSIX_BITS; i++) { if ((ibits & intel_ntb_db_vector_mask(dev, i)) != 0) swi_sched(ntb->int_info[i].tag, 0); @@ -1226,7 +1228,7 @@ intel_ntb_db_read(device_t dev) struct ntb_softc *ntb = device_get_softc(dev); if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) - return (ntb->fake_db_bell); + return (ntb->fake_db); return (db_ioread(ntb, ntb->self_reg->db_bell)); } @@ -1243,7 +1245,7 @@ intel_ntb_db_clear(device_t dev, uint64_t bits) if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { DB_MASK_LOCK(ntb); - ntb->fake_db_bell &= ~bits; + ntb->fake_db &= ~bits; DB_MASK_UNLOCK(ntb); return; } @@ -1291,11 +1293,16 @@ intel_ntb_interrupt(struct ntb_softc *ntb, uint32_t ve (vec_mask & ntb->db_link_mask) == 0) { DB_MASK_LOCK(ntb); - /* Do not report same DB events again if not cleared yet. */ - vec_mask &= ~ntb->fake_db_bell; + /* + * Do not report same DB events again if not cleared yet, + * unless the mask was just cleared for them and this + * interrupt handler call can be the consequence of it. + */ + vec_mask &= ~ntb->fake_db | ntb->force_db; + ntb->force_db &= ~vec_mask; /* Update our internal doorbell register. */ - ntb->fake_db_bell |= vec_mask; + ntb->fake_db |= vec_mask; /* Do not report masked DB events. */ vec_mask &= ~ntb->db_mask; @@ -1512,7 +1519,7 @@ intel_ntb_xeon_init_dev(struct ntb_softc *ntb) ntb->xlat_reg = &xeon_sec_xlat; if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { - ntb->fake_db_bell = 0; + ntb->force_db = ntb->fake_db = 0; ntb->msix_mw_idx = (ntb->mw_count + g_ntb_msix_idx) % ntb->mw_count; intel_ntb_printf(2, "Setting up MSIX mw idx %d means %u\n", From owner-svn-src-all@freebsd.org Mon Sep 11 18:31:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A340E1BE11; Mon, 11 Sep 2017 18:31:52 +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 260586C877; Mon, 11 Sep 2017 18:31:52 +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 v8BIVpwj069761; Mon, 11 Sep 2017 18:31:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIVpjq069760; Mon, 11 Sep 2017 18:31:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709111831.v8BIVpjq069760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 11 Sep 2017 18:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323452 - stable/11/sys/dev/ntb X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ntb X-SVN-Commit-Revision: 323452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:31:52 -0000 Author: mav Date: Mon Sep 11 18:31:51 2017 New Revision: 323452 URL: https://svnweb.freebsd.org/changeset/base/323452 Log: MFC r322981: Mask doorbells while processing them. This fixes interrupt storms on hardware using legacy level-triggered interrupts, since doorbell processing could take time after interrupt handler completion, that triggered extra interrupts in a loop. Modified: stable/11/sys/dev/ntb/ntb_transport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:30:50 2017 (r323451) +++ stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:31:51 2017 (r323452) @@ -835,6 +835,7 @@ static void ntb_transport_rxc_db(void *arg, int pending __unused) { struct ntb_transport_qp *qp = arg; + uint64_t qp_mask = 1ull << qp->qp_num; int rc; CTR0(KTR_NTB, "RX: transport_rx"); @@ -843,11 +844,13 @@ again: ; CTR1(KTR_NTB, "RX: process_rxc returned %d", rc); - if ((ntb_db_read(qp->dev) & (1ull << qp->qp_num)) != 0) { + if ((ntb_db_read(qp->dev) & qp_mask) != 0) { /* If db is set, clear it and check queue once more. */ - ntb_db_clear(qp->dev, 1ull << qp->qp_num); + ntb_db_clear(qp->dev, qp_mask); goto again; } + if (qp->link_is_up) + ntb_db_clear_mask(qp->dev, qp_mask); } static int @@ -1009,6 +1012,8 @@ ntb_transport_doorbell_callback(void *data, uint32_t v vec_mask &= nt->qp_bitmap; if ((vec_mask & (vec_mask - 1)) != 0) vec_mask &= ntb_db_read(nt->dev); + if (vec_mask != 0) + ntb_db_set_mask(nt->dev, vec_mask); while (vec_mask != 0) { qp_num = ffsll(vec_mask) - 1; From owner-svn-src-all@freebsd.org Mon Sep 11 18:48:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A330CE1CAFA; Mon, 11 Sep 2017 18:48:11 +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 4C76B6D1E8; Mon, 11 Sep 2017 18:48:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BImA5F075705; Mon, 11 Sep 2017 18:48:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIm9xr075694; Mon, 11 Sep 2017 18:48:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709111848.v8BIm9xr075694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 11 Sep 2017 18:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323453 - in stable/11: share/man/man4 sys/amd64/conf sys/conf sys/dev/ntb/ntb_hw sys/i386/conf sys/modules/ntb sys/modules/ntb/ntb_hw sys/modules/ntb/ntb_hw_intel sys/modules/ntb/ntb_h... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/amd64/conf sys/conf sys/dev/ntb/ntb_hw sys/i386/conf sys/modules/ntb sys/modules/ntb/ntb_hw sys/modules/ntb/ntb_hw_intel sys/modules/ntb/ntb_hw_plx X-SVN-Commit-Revision: 323453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:48:11 -0000 Author: mav Date: Mon Sep 11 18:48:09 2017 New Revision: 323453 URL: https://svnweb.freebsd.org/changeset/base/323453 Log: MFC r323032, r323053, r323058, r323059, r323084, r323114, r323127: Add NTB driver for PLX/Avago/Broadcom PCIe switches. This driver supports both NTB-to-NTB and NTB-to-Root Port modes (though the second with predictable complications on hot-plug and reboot events). I tested it with PEX 8717 and PEX 8733 chips, but expect it should work with many other compatible ones too. It supports up to two NT bridges per chip, each of which can have up to 2 64-bit or 4 32-bit memory windows, 6 or 12 scratchpad registers and 16 doorbells. There are also 4 DMA engines in those chips, but they are not yet supported. While there, rename Intel NTB driver from generic ntb_hw(4) to more specific ntb_hw_intel(4), so now it is on par with this new ntb_hw_plx(4) driver and alike to Linux naming. Added: stable/11/share/man/man4/ntb.4 - copied, changed from r323032, head/share/man/man4/ntb.4 stable/11/share/man/man4/ntb_hw_intel.4 - copied unchanged from r323032, head/share/man/man4/ntb_hw_intel.4 stable/11/share/man/man4/ntb_hw_plx.4 - copied unchanged from r323032, head/share/man/man4/ntb_hw_plx.4 stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c - copied unchanged from r323032, head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.h - copied unchanged from r323032, head/sys/dev/ntb/ntb_hw/ntb_hw_intel.h stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c - copied, changed from r323032, head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c stable/11/sys/modules/ntb/ntb_hw_intel/ - copied from r323032, head/sys/modules/ntb/ntb_hw_intel/ stable/11/sys/modules/ntb/ntb_hw_plx/ - copied from r323032, head/sys/modules/ntb/ntb_hw_plx/ Deleted: stable/11/share/man/man4/ntb_hw.4 stable/11/sys/dev/ntb/ntb_hw/ntb_hw.c stable/11/sys/dev/ntb/ntb_hw/ntb_regs.h stable/11/sys/modules/ntb/ntb_hw/ Modified: stable/11/share/man/man4/Makefile stable/11/share/man/man4/if_ntb.4 stable/11/share/man/man4/ntb_transport.4 stable/11/sys/amd64/conf/NOTES stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/i386/conf/NOTES stable/11/sys/modules/ntb/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Mon Sep 11 18:31:51 2017 (r323452) +++ stable/11/share/man/man4/Makefile Mon Sep 11 18:48:09 2017 (r323453) @@ -383,7 +383,9 @@ MAN= aac.4 \ ng_vlan.4 \ nmdm.4 \ nsp.4 \ - ${_ntb_hw.4} \ + ${_ntb.4} \ + ${_ntb_hw_intel.4} \ + ${_ntb_hw_plx.4} \ ${_ntb_transport.4} \ ${_if_ntb.4} \ null.4 \ @@ -707,7 +709,6 @@ MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 MLINKS+=${_nfe.4} ${_if_nfe.4} MLINKS+=nge.4 if_nge.4 -MLINKS+=${_ntb_hw.4} ${_ntb.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=ow.4 onewire.4 MLINKS+=patm.4 if_patm.4 @@ -853,7 +854,8 @@ _xnb.4= xnb.4 _if_ntb.4= if_ntb.4 _ioat.4= ioat.4 _ntb.4= ntb.4 -_ntb_hw.4= ntb_hw.4 +_ntb_hw_intel.4= ntb_hw_intel.4 +_ntb_hw_plx.4= ntb_hw_plx.4 _ntb_transport.4=ntb_transport.4 _qlxge.4= qlxge.4 _qlxgb.4= qlxgb.4 Modified: stable/11/share/man/man4/if_ntb.4 ============================================================================== --- stable/11/share/man/man4/if_ntb.4 Mon Sep 11 18:31:51 2017 (r323452) +++ stable/11/share/man/man4/if_ntb.4 Mon Sep 11 18:48:09 2017 (r323453) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2016 +.Dd September 2, 2017 .Dt IF_NTB 4 .Os .Sh NAME @@ -35,6 +35,8 @@ To compile this driver into your kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device ntb" +.Cd "device ntb_transport" .Cd "device if_ntb" .Ed .Pp @@ -48,7 +50,7 @@ The following tunables are settable from the .Xr loader 8 : .Bl -ohang .It Va hw.if_ntb.num_queues -Number of transport queues to use per interface. +Limits maximal number of queues per interface. Default is unlimited. .El .Sh DESCRIPTION @@ -56,12 +58,10 @@ The .Nm driver attaches on top of the .Xr ntb_transport 4 -driver to utilize its resources to create virtual Ethernet interface between -the systems. -Interface capabilities depend on the underlying transport. -Typical MTU is about 64KB to reduce overhead. -By default one queue is used, but more may be configured. -The MAC address for interface is randomly generated. +driver to utilize one or more of its packet queues to create virtual +Ethernet network interface between the systems. +Typical MTU for the interface is about 64KB to reduce overhead. +Default MAC address for the interface is randomly generated. .Pp The .Nm Copied and modified: stable/11/share/man/man4/ntb.4 (from r323032, head/share/man/man4/ntb.4) ============================================================================== --- head/share/man/man4/ntb.4 Wed Aug 30 21:16:32 2017 (r323032, copy source) +++ stable/11/share/man/man4/ntb.4 Mon Sep 11 18:48:09 2017 (r323453) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 30, 2017 +.Dd September 2, 2017 .Dt NTB 4 .Os .Sh NAME @@ -51,19 +51,19 @@ The following tunables are settable from the Driver debug level. The default value is 0, higher means more verbose. .It Va hint.ntb_hw. Ns Ar X Ns Va .config -Configures NTB resources split between several consumer devices. -Configuration of multiple consumer devices separated by commas. -Each device can be configured as: "[][:[:[:]]]", where: +Configures a set of NTB functions, separated by commas, +and their resource allocation. +Each function can be configured as: "[][:[:[:]]]", where: .Va name -is a name of the driver which should attach the device (empty means any), +is a name of the driver to attach (empty means any), .Va mw is a number of memory windows to allocate (empty means all available), .Va spad is a number of scratchpad registers to allocate (empty means all available), .Va db is a number of doorbells to allocate (empty means all available). -The default configuration is empty string, which means single device -with all available resources allowing any driver attachment. +The default configuration is empty string, which means single function +with all available resources, allowing any driver to attach. .El .Sh DESCRIPTION Non-Transparent Bridges allow to connect two computer systems with PCIe @@ -72,7 +72,7 @@ scratchpad registers and interrupts. The .Nm subsystem uses those resources provided in generic way by hardware drivers -and splits them between multiple consumer drivers, according to specified +and splits them between several functions, according to specified configuration. .Sh SEE ALSO .Xr if_ntb 4 , Copied: stable/11/share/man/man4/ntb_hw_intel.4 (from r323032, head/share/man/man4/ntb_hw_intel.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/ntb_hw_intel.4 Mon Sep 11 18:48:09 2017 (r323453, copy of r323032, head/share/man/man4/ntb_hw_intel.4) @@ -0,0 +1,97 @@ +.\" +.\" Copyright (c) 2016-2017 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 30, 2017 +.Dt NTB_HW_INTEL 4 +.Os +.Sh NAME +.Nm ntb_hw_intel +.Nd Intel(R) Non-Transparent Bridge driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ntb" +.Cd "device ntb_hw_intel" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ntb_hw_intel_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm ntb_hw_intel +driver provides support for the Non-Transparent Bridge (NTB) hardware in +Intel Xeon E3/E5 and S1200 processor families, which allow one of their PCIe +ports to be switched from transparent to non-transparent bridge mode. +In this mode bridge looks not as a PCI bridge, but as PCI endpoint device. +The driver hides hardware details, exposing memory windows, scratchpads +and doorbells of the other side via hardware independent KPI to +.Xr ntb 4 +subsystem. +.Pp +The hardware provides 2 or 3 memory windows to the other system's memory, +16 scratchpad registers and 14 or 34 doorbells to interrupt the other system. +On Xeon processors one of memory windows is typically consumed by the driver +itself to workaround multiple hardware erratas. +.Sh CONFIGURATION +The NTB configuration should be set by BIOS. +It includes enabling NTB, choosing between NTB-to-NTB (back-to-back) or +NTB-to-Root Port mode, +enabling split BAR mode (one of two 64-bit BARs can be split into two 32-bit +ones) and configuring BAR sizes in bits (from 12 to 29/39) for both NTB sides. +.Pp +The recommended configuration is NTB-to-NTB mode, split bar is enabled and +all BAR sizes are set to 20 (1 MiB). +This needs to be done on both systems. +.Sh SEE ALSO +.Xr if_ntb 4 , +.Xr ntb_transport 4 , +.Xr ntb 4 , +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Carl Delsey Aq Mt carl@FreeBSD.org . +Later improvements were done by +.An Conrad E. Meyer Aq Mt cem@FreeBSD.org +and +.An Alexander Motin Aq Mt mav@FreeBSD.org . +.Sh BUGS +NTB-to-Root Port mode is not yet supported, but it doesn't look very useful. +.Pp +On Xeon v2/v3/v4 processors split BAR mode should be enabled to allow +SB01BASE_LOCKUP errata workaround to be applied by the driver. +.Pp +There is no way to protect your system from malicious behavior on the other +system once the link is brought up. +Anyone with root or kernel access on the other system can read or write to +any location on your system. +In other words, only connect two systems that completely trust each other. Copied: stable/11/share/man/man4/ntb_hw_plx.4 (from r323032, head/share/man/man4/ntb_hw_plx.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/ntb_hw_plx.4 Mon Sep 11 18:48:09 2017 (r323453, copy of r323032, head/share/man/man4/ntb_hw_plx.4) @@ -0,0 +1,118 @@ +.\" +.\" Copyright (c) 2017 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 30, 2017 +.Dt NTB_HW_PLX 4 +.Os +.Sh NAME +.Nm ntb_hw_plx +.Nd PLX/Avago/Broadcom Non-Transparent Bridge driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ntb" +.Cd "device ntb_hw_plx" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ntb_hw_plx_load="YES" +.Ed +.Pp +The following tunables are settable from the +.Xr loader 8 : +.Bl -ohang +.It Va hint.ntb_hw. Ns Ar X Ns Va .b2b +Being set to 1 (default) tells the driver attached to Virtual Interface of the +NTB that it works in NTB-to-NTB (back-to-back) mode, 0 -- NTB-to-Root Port. +Driver attached to Link Interface (visible from Root Port side) switches to +NTB-to-Root Port mode automatically, but one attached to Virtual Interface +can't detect what is on the other side and require external knowledge. +.El +.Sh DESCRIPTION +The +.Nm +driver provides support for the Non-Transparent Bridge (NTB) hardware in +PLX PCIe bridge chips, which allow up to two of their PCIe ports to be +switched from transparent to non-transparent bridge mode. +In this mode bridge looks not as a PCI bridge, but as PCI endpoint device. +The driver hides hardware details, exposing memory windows, scratchpads +and doorbells of the other side via hardware independent KPI to +.Xr ntb 4 +subsystem. +.Pp +Each PLX NTB provides up to 2 64-bit or 4 32-bit memory windows to the +other system's memory, 6 or 12 scratchpad registers and 16 doorbells to +interrupt the other system. +In NTB-to-NTB mode one of memory windows (or half of it, if bigger then 1MB) +is consumed by the driver itself to access scratchpad and doorbell registers +of the other side. +.Sh HARDWARE +The following PLX/Avago/Broadcom chips are supported by the +.Nm +driver: +.Pp +.Bl -bullet -compact +.It +PEX 8713 +.It +PEX 8717 +.It +PEX 8725 +.It +PEX 8733 +.It +PEX 8749 +.El +.Pp +, but it may also work with other compatible ones. +.Sh CONFIGURATION +The basic chip configuration should be done by serial EEPROM or via i2c. +It includes enabling NTB on one or both sides (choosing between NTB-to-NTB +(back-to-back) and NTB-to-Root Port modes) and configuring BARs sizes. +.Pp +The recommended mode is NTB-to-NTB mode, since while NTB-to-Root Port is +generally supported by the driver, it require PCI hotplug handling on the +Root Port, that may be difficult or cause different kinds of problems. +.Sh SEE ALSO +.Xr if_ntb 4 , +.Xr ntb_transport 4 , +.Xr ntb 4 , +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Alexander Motin Aq Mt mav@FreeBSD.org . +.Sh BUGS +There is no way to protect your system from malicious behavior on the other +system once the link is brought up. +Anyone with root or kernel access on the other system can read or write to +any location on your system. +In other words, only connect two systems that completely trust each other. Modified: stable/11/share/man/man4/ntb_transport.4 ============================================================================== --- stable/11/share/man/man4/ntb_transport.4 Mon Sep 11 18:31:51 2017 (r323452) +++ stable/11/share/man/man4/ntb_transport.4 Mon Sep 11 18:48:09 2017 (r323453) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2016 Alexander Motin +.\" Copyright (c) 2016-2017 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,14 +25,21 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2016 +.Dd September 2, 2017 .Dt NTB_TRANSPORT 4 .Os .Sh NAME .Nm ntb_transport .Nd Packet-oriented transport for Non-Transparent Bridges .Sh SYNOPSIS -To load the driver as a module at boot, place the following line in +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ntb" +.Cd "device ntb_transport" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent ntb_transport_load="YES" @@ -45,28 +52,44 @@ The following tunables are settable from the Driver debug level. The default value is 0, higher means more verbose. .It Va hint.ntb_transport. Ns Ar X Ns Va .config -Configures queues allocation for consumer devices, separated by commas. -Each device can be configured as: "[:]", where: +Configures a set of the transport consumers, separated by commas. +Each consumer can be configured as: "[][:]", where: .Va name -is a name of the driver which should attach the device (empty means any), +is a name of the driver to attach (empty means any), .Va queues -is a number of queues to allocate (empty means automatic), -The default configuration is empty string, which means single device -with one queue per memory window allowing any driver attachment. +is a number of queues to allocate (empty means automatic). +The default configuration is empty string, which means single consumer +with one queue per memory window, allowing any driver to attach. .El .Sh DESCRIPTION The .Nm driver attaches on top of the .Nm ntb -driver to utilize its resources to create set of bidirectional queues, +driver to utilize its resources to create a set of bidirectional queues, delivering packets between the systems. -The primary purpose of this is to be used by +The primary purpose of this driver is to be used by .Nm if_ntb network interface, but other consumers may also be developed using KPI. +.Pp +Each +.Nm +require from underlying +.Nm ntb +instance: +.Bl -bullet -compact +.It +1 or more memory windows; +.It +6 scratchpads, plus 2 more for each additional memory window; +.It +1 doorbell for each memory window or configured queue. +.El .Sh SEE ALSO .Xr if_ntb 4 , -.Xr ntb_hw 4 +.Xr ntb 4 , +.Xr ntb_hw_intel 4 , +.Xr ntb_hw_plx 4 .Sh AUTHORS .An -nosplit The Modified: stable/11/sys/amd64/conf/NOTES ============================================================================== --- stable/11/sys/amd64/conf/NOTES Mon Sep 11 18:31:51 2017 (r323452) +++ stable/11/sys/amd64/conf/NOTES Mon Sep 11 18:48:09 2017 (r323453) @@ -402,9 +402,14 @@ device iwn6000g2bfw device iwn6050fw device wpifw -# Intel Non-Transparent Bridge (NTB) hardware -device ntb_hw # Hardware Abstraction Layer for the NTB -device if_ntb # Simulated ethernet device using the NTB +# +# Non-Transparent Bridge (NTB) drivers +# +device if_ntb # Virtual NTB network interface +device ntb_transport # NTB packet transport driver +device ntb # NTB hardware interface +device ntb_hw_intel # Intel NTB hardware driver +device ntb_hw_plx # PLX NTB hardware driver # #XXX this stores pointers in a 32bit field that is defined by the hardware Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Mon Sep 11 18:31:51 2017 (r323452) +++ stable/11/sys/conf/files.amd64 Mon Sep 11 18:48:09 2017 (r323453) @@ -324,10 +324,11 @@ dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyper dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb -dev/ntb/ntb_transport.c optional if_ntb -dev/ntb/ntb.c optional if_ntb | ntb_hw -dev/ntb/ntb_if.m optional if_ntb | ntb_hw -dev/ntb/ntb_hw/ntb_hw.c optional ntb_hw +dev/ntb/ntb_transport.c optional ntb_transport | if_ntb +dev/ntb/ntb.c optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw +dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/nvd/nvd.c optional nvd nvme dev/nvme/nvme.c optional nvme dev/nvme/nvme_ctrlr.c optional nvme Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Mon Sep 11 18:31:51 2017 (r323452) +++ stable/11/sys/conf/files.i386 Mon Sep 11 18:48:09 2017 (r323453) @@ -294,10 +294,11 @@ dev/mse/mse_isa.c optional mse isa dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb -dev/ntb/ntb_transport.c optional if_ntb -dev/ntb/ntb.c optional if_ntb | ntb_hw -dev/ntb/ntb_if.m optional if_ntb | ntb_hw -dev/ntb/ntb_hw/ntb_hw.c optional ntb_hw +dev/ntb/ntb_transport.c optional ntb_transport | if_ntb +dev/ntb/ntb.c optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw +dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/nvd/nvd.c optional nvd nvme dev/nvme/nvme.c optional nvme dev/nvme/nvme_ctrlr.c optional nvme Copied: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c (from r323032, head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Sep 11 18:48:09 2017 (r323453, copy of r323032, head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c) @@ -0,0 +1,3121 @@ +/*- + * Copyright (c) 2016 Alexander Motin + * Copyright (C) 2013 Intel Corporation + * Copyright (C) 2015 EMC Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The Non-Transparent Bridge (NTB) is a device that allows you to connect + * two or more systems using a PCI-e links, providing remote memory access. + * + * This module contains a driver for NTB hardware in Intel Xeon/Atom CPUs. + * + * NOTE: Much of the code in this module is shared with Linux. Any patches may + * be picked up and redistributed in Linux with a dual GPL/BSD license. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ntb_hw_intel.h" +#include "../ntb.h" + +#define MAX_MSIX_INTERRUPTS MAX(XEON_DB_COUNT, ATOM_DB_COUNT) + +#define NTB_HB_TIMEOUT 1 /* second */ +#define ATOM_LINK_RECOVERY_TIME 500 /* ms */ +#define BAR_HIGH_MASK (~((1ull << 12) - 1)) + +#define NTB_MSIX_VER_GUARD 0xaabbccdd +#define NTB_MSIX_RECEIVED 0xe0f0e0f0 + +/* + * PCI constants could be somewhere more generic, but aren't defined/used in + * pci.c. + */ +#define PCI_MSIX_ENTRY_SIZE 16 +#define PCI_MSIX_ENTRY_LOWER_ADDR 0 +#define PCI_MSIX_ENTRY_UPPER_ADDR 4 +#define PCI_MSIX_ENTRY_DATA 8 + +enum ntb_device_type { + NTB_XEON, + NTB_ATOM +}; + +/* ntb_conn_type are hardware numbers, cannot change. */ +enum ntb_conn_type { + NTB_CONN_TRANSPARENT = 0, + NTB_CONN_B2B = 1, + NTB_CONN_RP = 2, +}; + +enum ntb_b2b_direction { + NTB_DEV_USD = 0, + NTB_DEV_DSD = 1, +}; + +enum ntb_bar { + NTB_CONFIG_BAR = 0, + NTB_B2B_BAR_1, + NTB_B2B_BAR_2, + NTB_B2B_BAR_3, + NTB_MAX_BARS +}; + +enum { + NTB_MSIX_GUARD = 0, + NTB_MSIX_DATA0, + NTB_MSIX_DATA1, + NTB_MSIX_DATA2, + NTB_MSIX_OFS0, + NTB_MSIX_OFS1, + NTB_MSIX_OFS2, + NTB_MSIX_DONE, + NTB_MAX_MSIX_SPAD +}; + +/* Device features and workarounds */ +#define HAS_FEATURE(ntb, feature) \ + (((ntb)->features & (feature)) != 0) + +struct ntb_hw_info { + uint32_t device_id; + const char *desc; + enum ntb_device_type type; + uint32_t features; +}; + +struct ntb_pci_bar_info { + bus_space_tag_t pci_bus_tag; + bus_space_handle_t pci_bus_handle; + int pci_resource_id; + struct resource *pci_resource; + vm_paddr_t pbase; + caddr_t vbase; + vm_size_t size; + vm_memattr_t map_mode; + + /* Configuration register offsets */ + uint32_t psz_off; + uint32_t ssz_off; + uint32_t pbarxlat_off; +}; + +struct ntb_int_info { + struct resource *res; + int rid; + void *tag; +}; + +struct ntb_vec { + struct ntb_softc *ntb; + uint32_t num; + unsigned masked; +}; + +struct ntb_reg { + uint32_t ntb_ctl; + uint32_t lnk_sta; + uint8_t db_size; + unsigned mw_bar[NTB_MAX_BARS]; +}; + +struct ntb_alt_reg { + uint32_t db_bell; + uint32_t db_mask; + uint32_t spad; +}; + +struct ntb_xlat_reg { + uint32_t bar0_base; + uint32_t bar2_base; + uint32_t bar4_base; + uint32_t bar5_base; + + uint32_t bar2_xlat; + uint32_t bar4_xlat; + uint32_t bar5_xlat; + + uint32_t bar2_limit; + uint32_t bar4_limit; + uint32_t bar5_limit; +}; + +struct ntb_b2b_addr { + uint64_t bar0_addr; + uint64_t bar2_addr64; + uint64_t bar4_addr64; + uint64_t bar4_addr32; + uint64_t bar5_addr32; +}; + +struct ntb_msix_data { + uint32_t nmd_ofs; + uint32_t nmd_data; +}; + +struct ntb_softc { + /* ntb.c context. Do not move! Must go first! */ + void *ntb_store; + + device_t device; + enum ntb_device_type type; + uint32_t features; + + struct ntb_pci_bar_info bar_info[NTB_MAX_BARS]; + struct ntb_int_info int_info[MAX_MSIX_INTERRUPTS]; + uint32_t allocated_interrupts; + + struct ntb_msix_data peer_msix_data[XEON_NONLINK_DB_MSIX_BITS]; + struct ntb_msix_data msix_data[XEON_NONLINK_DB_MSIX_BITS]; + bool peer_msix_good; + bool peer_msix_done; + struct ntb_pci_bar_info *peer_lapic_bar; + struct callout peer_msix_work; + + struct callout heartbeat_timer; + struct callout lr_timer; + + struct ntb_vec *msix_vec; + + uint32_t ppd; + enum ntb_conn_type conn_type; + enum ntb_b2b_direction dev_type; + + /* Offset of peer bar0 in B2B BAR */ + uint64_t b2b_off; + /* Memory window used to access peer bar0 */ +#define B2B_MW_DISABLED UINT8_MAX + uint8_t b2b_mw_idx; + uint32_t msix_xlat; + uint8_t msix_mw_idx; + + uint8_t mw_count; + uint8_t spad_count; + uint8_t db_count; + uint8_t db_vec_count; + uint8_t db_vec_shift; + + /* Protects local db_mask. */ +#define DB_MASK_LOCK(sc) mtx_lock_spin(&(sc)->db_mask_lock) +#define DB_MASK_UNLOCK(sc) mtx_unlock_spin(&(sc)->db_mask_lock) +#define DB_MASK_ASSERT(sc,f) mtx_assert(&(sc)->db_mask_lock, (f)) + struct mtx db_mask_lock; + + volatile uint32_t ntb_ctl; + volatile uint32_t lnk_sta; + + uint64_t db_valid_mask; + uint64_t db_link_mask; + uint64_t db_mask; + uint64_t fake_db; /* NTB_SB01BASE_LOCKUP*/ + uint64_t force_db; /* NTB_SB01BASE_LOCKUP*/ + + int last_ts; /* ticks @ last irq */ + + const struct ntb_reg *reg; + const struct ntb_alt_reg *self_reg; + const struct ntb_alt_reg *peer_reg; + const struct ntb_xlat_reg *xlat_reg; +}; + +#ifdef __i386__ +static __inline uint64_t +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset) +{ + + return (bus_space_read_4(tag, handle, offset) | + ((uint64_t)bus_space_read_4(tag, handle, offset + 4)) << 32); +} + +static __inline void +bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset, uint64_t val) +{ + + bus_space_write_4(tag, handle, offset, val); + bus_space_write_4(tag, handle, offset + 4, val >> 32); +} +#endif + +#define intel_ntb_bar_read(SIZE, bar, offset) \ + bus_space_read_ ## SIZE (ntb->bar_info[(bar)].pci_bus_tag, \ + ntb->bar_info[(bar)].pci_bus_handle, (offset)) +#define intel_ntb_bar_write(SIZE, bar, offset, val) \ + bus_space_write_ ## SIZE (ntb->bar_info[(bar)].pci_bus_tag, \ + ntb->bar_info[(bar)].pci_bus_handle, (offset), (val)) +#define intel_ntb_reg_read(SIZE, offset) \ + intel_ntb_bar_read(SIZE, NTB_CONFIG_BAR, offset) +#define intel_ntb_reg_write(SIZE, offset, val) \ + intel_ntb_bar_write(SIZE, NTB_CONFIG_BAR, offset, val) +#define intel_ntb_mw_read(SIZE, offset) \ + intel_ntb_bar_read(SIZE, intel_ntb_mw_to_bar(ntb, ntb->b2b_mw_idx), \ + offset) +#define intel_ntb_mw_write(SIZE, offset, val) \ + intel_ntb_bar_write(SIZE, intel_ntb_mw_to_bar(ntb, ntb->b2b_mw_idx), \ + offset, val) + +static int intel_ntb_probe(device_t device); +static int intel_ntb_attach(device_t device); +static int intel_ntb_detach(device_t device); +static uint64_t intel_ntb_db_valid_mask(device_t dev); +static void intel_ntb_spad_clear(device_t dev); +static uint64_t intel_ntb_db_vector_mask(device_t dev, uint32_t vector); +static bool intel_ntb_link_is_up(device_t dev, enum ntb_speed *speed, + enum ntb_width *width); +static int intel_ntb_link_enable(device_t dev, enum ntb_speed speed, + enum ntb_width width); +static int intel_ntb_link_disable(device_t dev); +static int intel_ntb_spad_read(device_t dev, unsigned int idx, uint32_t *val); +static int intel_ntb_peer_spad_write(device_t dev, unsigned int idx, uint32_t val); + +static unsigned intel_ntb_user_mw_to_idx(struct ntb_softc *, unsigned uidx); +static inline enum ntb_bar intel_ntb_mw_to_bar(struct ntb_softc *, unsigned mw); +static inline bool bar_is_64bit(struct ntb_softc *, enum ntb_bar); +static inline void bar_get_xlat_params(struct ntb_softc *, enum ntb_bar, + uint32_t *base, uint32_t *xlat, uint32_t *lmt); +static int intel_ntb_map_pci_bars(struct ntb_softc *ntb); +static int intel_ntb_mw_set_wc_internal(struct ntb_softc *, unsigned idx, + vm_memattr_t); +static void print_map_success(struct ntb_softc *, struct ntb_pci_bar_info *, + const char *); +static int map_mmr_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar); +static int map_memory_window_bar(struct ntb_softc *ntb, + struct ntb_pci_bar_info *bar); +static void intel_ntb_unmap_pci_bar(struct ntb_softc *ntb); +static int intel_ntb_remap_msix(device_t, uint32_t desired, uint32_t avail); +static int intel_ntb_init_isr(struct ntb_softc *ntb); +static int intel_ntb_setup_legacy_interrupt(struct ntb_softc *ntb); +static int intel_ntb_setup_msix(struct ntb_softc *ntb, uint32_t num_vectors); +static void intel_ntb_teardown_interrupts(struct ntb_softc *ntb); +static inline uint64_t intel_ntb_vec_mask(struct ntb_softc *, uint64_t db_vector); +static void intel_ntb_interrupt(struct ntb_softc *, uint32_t vec); +static void ndev_vec_isr(void *arg); +static void ndev_irq_isr(void *arg); +static inline uint64_t db_ioread(struct ntb_softc *, uint64_t regoff); +static inline void db_iowrite(struct ntb_softc *, uint64_t regoff, uint64_t); +static inline void db_iowrite_raw(struct ntb_softc *, uint64_t regoff, uint64_t); +static int intel_ntb_create_msix_vec(struct ntb_softc *ntb, uint32_t num_vectors); +static void intel_ntb_free_msix_vec(struct ntb_softc *ntb); +static void intel_ntb_get_msix_info(struct ntb_softc *ntb); +static void intel_ntb_exchange_msix(void *); +static struct ntb_hw_info *intel_ntb_get_device_info(uint32_t device_id); +static void intel_ntb_detect_max_mw(struct ntb_softc *ntb); +static int intel_ntb_detect_xeon(struct ntb_softc *ntb); +static int intel_ntb_detect_atom(struct ntb_softc *ntb); +static int intel_ntb_xeon_init_dev(struct ntb_softc *ntb); +static int intel_ntb_atom_init_dev(struct ntb_softc *ntb); +static void intel_ntb_teardown_xeon(struct ntb_softc *ntb); +static void configure_atom_secondary_side_bars(struct ntb_softc *ntb); +static void xeon_reset_sbar_size(struct ntb_softc *, enum ntb_bar idx, + enum ntb_bar regbar); +static void xeon_set_sbar_base_and_limit(struct ntb_softc *, + uint64_t base_addr, enum ntb_bar idx, enum ntb_bar regbar); +static void xeon_set_pbar_xlat(struct ntb_softc *, uint64_t base_addr, + enum ntb_bar idx); +static int xeon_setup_b2b_mw(struct ntb_softc *, + const struct ntb_b2b_addr *addr, const struct ntb_b2b_addr *peer_addr); +static inline bool link_is_up(struct ntb_softc *ntb); +static inline bool _xeon_link_is_up(struct ntb_softc *ntb); +static inline bool atom_link_is_err(struct ntb_softc *ntb); +static inline enum ntb_speed intel_ntb_link_sta_speed(struct ntb_softc *); +static inline enum ntb_width intel_ntb_link_sta_width(struct ntb_softc *); +static void atom_link_hb(void *arg); +static void recover_atom_link(void *arg); +static bool intel_ntb_poll_link(struct ntb_softc *ntb); +static void save_bar_parameters(struct ntb_pci_bar_info *bar); +static void intel_ntb_sysctl_init(struct ntb_softc *); +static int sysctl_handle_features(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_link_admin(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_link_status_human(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_link_status(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_register(SYSCTL_HANDLER_ARGS); + +static unsigned g_ntb_hw_debug_level; +SYSCTL_UINT(_hw_ntb, OID_AUTO, debug_level, CTLFLAG_RWTUN, + &g_ntb_hw_debug_level, 0, "ntb_hw log level -- higher is more verbose"); +#define intel_ntb_printf(lvl, ...) do { \ + if ((lvl) <= g_ntb_hw_debug_level) { \ + device_printf(ntb->device, __VA_ARGS__); \ + } \ +} while (0) + +#define _NTB_PAT_UC 0 +#define _NTB_PAT_WC 1 +#define _NTB_PAT_WT 4 +#define _NTB_PAT_WP 5 +#define _NTB_PAT_WB 6 +#define _NTB_PAT_UCM 7 +static unsigned g_ntb_mw_pat = _NTB_PAT_UC; +SYSCTL_UINT(_hw_ntb, OID_AUTO, default_mw_pat, CTLFLAG_RDTUN, + &g_ntb_mw_pat, 0, "Configure the default memory window cache flags (PAT): " + "UC: " __XSTRING(_NTB_PAT_UC) ", " + "WC: " __XSTRING(_NTB_PAT_WC) ", " + "WT: " __XSTRING(_NTB_PAT_WT) ", " + "WP: " __XSTRING(_NTB_PAT_WP) ", " + "WB: " __XSTRING(_NTB_PAT_WB) ", " + "UC-: " __XSTRING(_NTB_PAT_UCM)); + +static inline vm_memattr_t +intel_ntb_pat_flags(void) +{ + + switch (g_ntb_mw_pat) { + case _NTB_PAT_WC: + return (VM_MEMATTR_WRITE_COMBINING); + case _NTB_PAT_WT: + return (VM_MEMATTR_WRITE_THROUGH); + case _NTB_PAT_WP: + return (VM_MEMATTR_WRITE_PROTECTED); + case _NTB_PAT_WB: + return (VM_MEMATTR_WRITE_BACK); + case _NTB_PAT_UCM: + return (VM_MEMATTR_WEAK_UNCACHEABLE); + case _NTB_PAT_UC: + /* FALLTHROUGH */ + default: + return (VM_MEMATTR_UNCACHEABLE); + } +} + +/* + * Well, this obviously doesn't belong here, but it doesn't seem to exist + * anywhere better yet. + */ +static inline const char * +intel_ntb_vm_memattr_to_str(vm_memattr_t pat) +{ + + switch (pat) { + case VM_MEMATTR_WRITE_COMBINING: + return ("WRITE_COMBINING"); + case VM_MEMATTR_WRITE_THROUGH: + return ("WRITE_THROUGH"); + case VM_MEMATTR_WRITE_PROTECTED: + return ("WRITE_PROTECTED"); + case VM_MEMATTR_WRITE_BACK: + return ("WRITE_BACK"); + case VM_MEMATTR_WEAK_UNCACHEABLE: + return ("UNCACHED"); + case VM_MEMATTR_UNCACHEABLE: + return ("UNCACHEABLE"); + default: + return ("UNKNOWN"); + } +} + +static int g_ntb_msix_idx = 1; +SYSCTL_INT(_hw_ntb, OID_AUTO, msix_mw_idx, CTLFLAG_RDTUN, &g_ntb_msix_idx, + 0, "Use this memory window to access the peer MSIX message complex on " + "certain Xeon-based NTB systems, as a workaround for a hardware errata. " + "Like b2b_mw_idx, negative values index from the last available memory " + "window. (Applies on Xeon platforms with SB01BASE_LOCKUP errata.)"); + +static int g_ntb_mw_idx = -1; +SYSCTL_INT(_hw_ntb, OID_AUTO, b2b_mw_idx, CTLFLAG_RDTUN, &g_ntb_mw_idx, + 0, "Use this memory window to access the peer NTB registers. A " + "non-negative value starts from the first MW index; a negative value " + "starts from the last MW index. The default is -1, i.e., the last " + "available memory window. Both sides of the NTB MUST set the same " + "value here! (Applies on Xeon platforms with SDOORBELL_LOCKUP errata.)"); + +/* Hardware owns the low 16 bits of features. */ +#define NTB_BAR_SIZE_4K (1 << 0) +#define NTB_SDOORBELL_LOCKUP (1 << 1) +#define NTB_SB01BASE_LOCKUP (1 << 2) +#define NTB_B2BDOORBELL_BIT14 (1 << 3) +/* Software/configuration owns the top 16 bits. */ +#define NTB_SPLIT_BAR (1ull << 16) + +#define NTB_FEATURES_STR \ + "\20\21SPLIT_BAR4\04B2B_DOORBELL_BIT14\03SB01BASE_LOCKUP" \ + "\02SDOORBELL_LOCKUP\01BAR_SIZE_4K" + +static struct ntb_hw_info pci_ids[] = { + /* XXX: PS/SS IDs left out until they are supported. */ + { 0x0C4E8086, "BWD Atom Processor S1200 Non-Transparent Bridge B2B", + NTB_ATOM, 0 }, + + { 0x37258086, "JSF Xeon C35xx/C55xx Non-Transparent Bridge B2B", + NTB_XEON, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 }, + { 0x3C0D8086, "SNB Xeon E5/Core i7 Non-Transparent Bridge B2B", + NTB_XEON, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 }, + { 0x0E0D8086, "IVT Xeon E5 V2 Non-Transparent Bridge B2B", NTB_XEON, + NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | + NTB_SB01BASE_LOCKUP | NTB_BAR_SIZE_4K }, + { 0x2F0D8086, "HSX Xeon E5 V3 Non-Transparent Bridge B2B", NTB_XEON, + NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | + NTB_SB01BASE_LOCKUP }, + { 0x6F0D8086, "BDX Xeon E5 V4 Non-Transparent Bridge B2B", NTB_XEON, + NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | + NTB_SB01BASE_LOCKUP }, + + { 0x00000000, NULL, NTB_ATOM, 0 } +}; + +static const struct ntb_reg atom_reg = { + .ntb_ctl = ATOM_NTBCNTL_OFFSET, + .lnk_sta = ATOM_LINK_STATUS_OFFSET, + .db_size = sizeof(uint64_t), + .mw_bar = { NTB_B2B_BAR_1, NTB_B2B_BAR_2 }, +}; + +static const struct ntb_alt_reg atom_pri_reg = { + .db_bell = ATOM_PDOORBELL_OFFSET, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Sep 11 18:50:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71F38E1CE0A; Mon, 11 Sep 2017 18:50:10 +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 3EA916D4BA; Mon, 11 Sep 2017 18:50:10 +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 v8BIo97g075870; Mon, 11 Sep 2017 18:50:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIo951075869; Mon, 11 Sep 2017 18:50:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709111850.v8BIo951075869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 11 Sep 2017 18:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323454 - stable/11/sys/dev/ntb X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ntb X-SVN-Commit-Revision: 323454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:50:10 -0000 Author: mav Date: Mon Sep 11 18:50:09 2017 New Revision: 323454 URL: https://svnweb.freebsd.org/changeset/base/323454 Log: MFC r323074: Clear doorbell bits after masking them before processing. In theory this allows to avoid one more expensive doorbell register read later in some scenarios. But in practice it also significantly increases packet rate on PLX hardware, that I can't explain yet, possibly work- arounding some interrupt delays. Modified: stable/11/sys/dev/ntb/ntb_transport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:48:09 2017 (r323453) +++ stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:50:09 2017 (r323454) @@ -1012,8 +1012,10 @@ ntb_transport_doorbell_callback(void *data, uint32_t v vec_mask &= nt->qp_bitmap; if ((vec_mask & (vec_mask - 1)) != 0) vec_mask &= ntb_db_read(nt->dev); - if (vec_mask != 0) + if (vec_mask != 0) { ntb_db_set_mask(nt->dev, vec_mask); + ntb_db_clear(nt->dev, vec_mask); + } while (vec_mask != 0) { qp_num = ffsll(vec_mask) - 1; From owner-svn-src-all@freebsd.org Mon Sep 11 18:50:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06BFEE1CEC6; Mon, 11 Sep 2017 18:50:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4ECC6D600; Mon, 11 Sep 2017 18:50:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8BIob2D075947; Mon, 11 Sep 2017 18:50:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIoagf075942; Mon, 11 Sep 2017 18:50:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709111850.v8BIoagf075942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 11 Sep 2017 18:50:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323455 - in stable/11/sys/dev/ntb: . ntb_hw X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev/ntb: . ntb_hw X-SVN-Commit-Revision: 323455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:50:38 -0000 Author: mav Date: Mon Sep 11 18:50:36 2017 New Revision: 323455 URL: https://svnweb.freebsd.org/changeset/base/323455 Log: MFC r323126: Make NTB drivers report more info via NewBus methods. Modified: stable/11/sys/dev/ntb/ntb.c stable/11/sys/dev/ntb/ntb.h stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c stable/11/sys/dev/ntb/ntb_transport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/ntb.c ============================================================================== --- stable/11/sys/dev/ntb/ntb.c Mon Sep 11 18:50:09 2017 (r323454) +++ stable/11/sys/dev/ntb/ntb.c Mon Sep 11 18:50:36 2017 (r323455) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Alexander Motin + * Copyright (c) 2016-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,13 +43,15 @@ SYSCTL_NODE(_hw, OID_AUTO, ntb, CTLFLAG_RW, 0, "NTB sy struct ntb_child { device_t dev; + int function; int enabled; int mwoff; int mwcnt; int spadoff; int spadcnt; int dboff; - int dbmask; + int dbcnt; + uint64_t dbmask; void *ctx; const struct ntb_ctx_ops *ctx_ops; struct rmlock ctx_lock; @@ -98,11 +100,13 @@ ntb_register_device(device_t dev) } nc = malloc(sizeof(*nc), M_DEVBUF, M_WAITOK | M_ZERO); + nc->function = i; nc->mwoff = mwu; nc->mwcnt = mw; nc->spadoff = spadu; nc->spadcnt = spad; nc->dboff = dbu; + nc->dbcnt = db; nc->dbmask = (db == 0) ? 0 : (0xffffffffffffffff >> (64 - db)); rm_init(&nc->ctx_lock, "ntb ctx"); nc->dev = device_add_child(dev, name, -1); @@ -160,6 +164,45 @@ ntb_unregister_device(device_t dev) free(nc, M_DEVBUF); } return (error); +} + +int +ntb_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen) +{ + struct ntb_child *nc = device_get_ivars(child); + + snprintf(buf, buflen, "function=%d", nc->function); + return (0); +} + +int +ntb_print_child(device_t dev, device_t child) +{ + struct ntb_child *nc = device_get_ivars(child); + int retval; + + retval = bus_print_child_header(dev, child); + if (nc->mwcnt > 0) { + printf(" mw %d", nc->mwoff); + if (nc->mwcnt > 1) + printf("-%d", nc->mwoff + nc->mwcnt - 1); + } + if (nc->spadcnt > 0) { + printf(" spad %d", nc->spadoff); + if (nc->spadcnt > 1) + printf("-%d", nc->spadoff + nc->spadcnt - 1); + } + if (nc->dbcnt > 0) { + printf(" db %d", nc->dboff); + if (nc->dbcnt > 1) + printf("-%d", nc->dboff + nc->dbcnt - 1); + } + retval += printf(" at function %d", nc->function); + retval += bus_print_child_domain(dev, child); + retval += bus_print_child_footer(dev, child); + + return (retval); } void Modified: stable/11/sys/dev/ntb/ntb.h ============================================================================== --- stable/11/sys/dev/ntb/ntb.h Mon Sep 11 18:50:09 2017 (r323454) +++ stable/11/sys/dev/ntb/ntb.h Mon Sep 11 18:50:36 2017 (r323455) @@ -36,6 +36,9 @@ SYSCTL_DECL(_hw_ntb); int ntb_register_device(device_t ntb); int ntb_unregister_device(device_t ntb); +int ntb_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen); +int ntb_print_child(device_t dev, device_t child); /* * ntb_link_event() - notify driver context of a change in link status Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Sep 11 18:50:09 2017 (r323454) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Sep 11 18:50:36 2017 (r323455) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Alexander Motin + * Copyright (c) 2016-2017 Alexander Motin * Copyright (C) 2013 Intel Corporation * Copyright (C) 2015 EMC Corporation * All rights reserved. @@ -3085,6 +3085,9 @@ static device_method_t ntb_intel_methods[] = { DEVMETHOD(device_probe, intel_ntb_probe), DEVMETHOD(device_attach, intel_ntb_attach), DEVMETHOD(device_detach, intel_ntb_detach), + /* Bus interface */ + DEVMETHOD(bus_child_location_str, ntb_child_location_str), + DEVMETHOD(bus_print_child, ntb_print_child), /* NTB interface */ DEVMETHOD(ntb_link_is_up, intel_ntb_link_is_up), DEVMETHOD(ntb_link_enable, intel_ntb_link_enable), Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Mon Sep 11 18:50:09 2017 (r323454) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Mon Sep 11 18:50:36 2017 (r323455) @@ -914,6 +914,9 @@ static device_method_t ntb_plx_methods[] = { DEVMETHOD(device_probe, ntb_plx_probe), DEVMETHOD(device_attach, ntb_plx_attach), DEVMETHOD(device_detach, ntb_plx_detach), + /* Bus interface */ + DEVMETHOD(bus_child_location_str, ntb_child_location_str), + DEVMETHOD(bus_print_child, ntb_print_child), /* NTB interface */ DEVMETHOD(ntb_link_is_up, ntb_plx_link_is_up), DEVMETHOD(ntb_link_enable, ntb_plx_link_enable), Modified: stable/11/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:50:09 2017 (r323454) +++ stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:50:36 2017 (r323455) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Alexander Motin + * Copyright (c) 2016-2017 Alexander Motin * Copyright (C) 2013 Intel Corporation * Copyright (C) 2015 EMC Corporation * All rights reserved. @@ -188,6 +188,7 @@ struct ntb_transport_mw { struct ntb_transport_child { device_t dev; + int consumer; int qpoff; int qpcnt; struct ntb_transport_child *next; @@ -343,9 +344,6 @@ ntb_transport_attach(device_t dev) KASSERT(db_bitmap == (1 << db_count) - 1, ("Doorbells are not sequential (%jx).\n", db_bitmap)); - device_printf(dev, "%d memory windows, %d scratchpads, " - "%d doorbells\n", nt->mw_count, spad_count, db_count); - if (nt->mw_count == 0) { device_printf(dev, "At least 1 memory window required.\n"); return (ENXIO); @@ -409,6 +407,7 @@ ntb_transport_attach(device_t dev) } nc = malloc(sizeof(*nc), M_DEVBUF, M_WAITOK | M_ZERO); + nc->consumer = i; nc->qpoff = qpu; nc->qpcnt = qp; nc->dev = device_add_child(dev, name, -1); @@ -496,6 +495,35 @@ ntb_transport_detach(device_t dev) return (0); } +static int +ntb_transport_print_child(device_t dev, device_t child) +{ + struct ntb_transport_child *nc = device_get_ivars(child); + int retval; + + retval = bus_print_child_header(dev, child); + if (nc->qpcnt > 0) { + printf(" queue %d", nc->qpoff); + if (nc->qpcnt > 1) + printf("-%d", nc->qpoff + nc->qpcnt - 1); + } + retval += printf(" at consumer %d", nc->consumer); + retval += bus_print_child_domain(dev, child); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +static int +ntb_transport_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen) +{ + struct ntb_transport_child *nc = device_get_ivars(child); + + snprintf(buf, buflen, "consumer=%d", nc->consumer); + return (0); +} + int ntb_transport_queue_count(device_t dev) { @@ -1552,6 +1580,9 @@ static device_method_t ntb_transport_methods[] = { DEVMETHOD(device_probe, ntb_transport_probe), DEVMETHOD(device_attach, ntb_transport_attach), DEVMETHOD(device_detach, ntb_transport_detach), + /* Bus interface */ + DEVMETHOD(bus_child_location_str, ntb_transport_child_location_str), + DEVMETHOD(bus_print_child, ntb_transport_print_child), DEVMETHOD_END }; From owner-svn-src-all@freebsd.org Mon Sep 11 18:51:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A9B4E1CF88; Mon, 11 Sep 2017 18:51:03 +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 44C946D86D; Mon, 11 Sep 2017 18:51:03 +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 v8BIp2XM078815; Mon, 11 Sep 2017 18:51:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BIp2WV078813; Mon, 11 Sep 2017 18:51:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709111851.v8BIp2WV078813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 11 Sep 2017 18:51:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323456 - in stable/11/sys/dev/ntb: . ntb_hw X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev/ntb: . ntb_hw X-SVN-Commit-Revision: 323456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 18:51:03 -0000 Author: mav Date: Mon Sep 11 18:51:02 2017 New Revision: 323456 URL: https://svnweb.freebsd.org/changeset/base/323456 Log: MFC r323128: Increase negotiation polling period from 10ms to 100ms. There is no big need to burn CPU if other side may be not there yet. For example, the PLX hardware by default enables the NTB link up on reset, not dependig on driver to do it. In case of Intel hardware this also reduces race between MSI-X workaround negotiation and upper layers, using the same scratchpad registers in different time. Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c stable/11/sys/dev/ntb/ntb_transport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Sep 11 18:50:36 2017 (r323455) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Sep 11 18:51:02 2017 (r323456) @@ -2689,7 +2689,7 @@ reschedule: ntb->lnk_sta = pci_read_config(ntb->device, ntb->reg->lnk_sta, 2); if (_xeon_link_is_up(ntb)) { callout_reset(&ntb->peer_msix_work, - hz * (ntb->peer_msix_good ? 2 : 1) / 100, + hz * (ntb->peer_msix_good ? 2 : 1) / 10, intel_ntb_exchange_msix, ntb); } else intel_ntb_spad_clear(ntb->device); Modified: stable/11/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:50:36 2017 (r323455) +++ stable/11/sys/dev/ntb/ntb_transport.c Mon Sep 11 18:51:02 2017 (r323456) @@ -250,7 +250,7 @@ enum { #define QP_TO_MW(nt, qp) ((qp) % nt->mw_count) #define NTB_QP_DEF_NUM_ENTRIES 100 -#define NTB_LINK_DOWN_TIMEOUT 10 +#define NTB_LINK_DOWN_TIMEOUT 100 static int ntb_transport_probe(device_t dev); static int ntb_transport_attach(device_t dev); From owner-svn-src-all@freebsd.org Mon Sep 11 19:00:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92951E1DDA0; Mon, 11 Sep 2017 19:00:54 +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 6231F6E3C3; Mon, 11 Sep 2017 19:00:54 +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 v8BJ0rar083796; Mon, 11 Sep 2017 19:00:53 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BJ0r9p083795; Mon, 11 Sep 2017 19:00:53 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201709111900.v8BJ0r9p083795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Mon, 11 Sep 2017 19:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323457 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 323457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 19:00:54 -0000 Author: mw Date: Mon Sep 11 19:00:53 2017 New Revision: 323457 URL: https://svnweb.freebsd.org/changeset/base/323457 Log: Expand Marvell NIC description in arm64 GENERIC config Suggested by: emaste Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Mon Sep 11 18:51:02 2017 (r323456) +++ head/sys/arm64/conf/GENERIC Mon Sep 11 19:00:53 2017 (r323457) @@ -127,7 +127,7 @@ device axgbe # AMD Opteron A1100 integrated NIC device em # Intel PRO/1000 Gigabit Ethernet Family device ix # Intel 10Gb Ethernet Family device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet -device neta # Marvell NETA Controller +device neta # Marvell Armada 370/38x/XP/3700 NIC device smc # SMSC LAN91C111 device vnic # Cavium ThunderX NIC device al_eth # Annapurna Alpine Ethernet NIC From owner-svn-src-all@freebsd.org Mon Sep 11 19:07:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FA1EE1E37E; Mon, 11 Sep 2017 19:07:43 +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 5EE2A6E982; Mon, 11 Sep 2017 19:07:43 +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 v8BJ7glC084070; Mon, 11 Sep 2017 19:07:42 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BJ7gr5084069; Mon, 11 Sep 2017 19:07:42 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201709111907.v8BJ7gr5084069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Mon, 11 Sep 2017 19:07:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323458 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 323458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 19:07:43 -0000 Author: kibab Date: Mon Sep 11 19:07:42 2017 New Revision: 323458 URL: https://svnweb.freebsd.org/changeset/base/323458 Log: Add MMCCAM-enabled kernel config for arm64 Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D12114 Added: head/sys/arm64/conf/GENERIC-MMCCAM (contents, props changed) Added: head/sys/arm64/conf/GENERIC-MMCCAM ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/conf/GENERIC-MMCCAM Mon Sep 11 19:07:42 2017 (r323458) @@ -0,0 +1,22 @@ +# +# GENERIC-MMCCAM +# +# Custom kernel for arm64 plus MMCCAM as opposed to the prior MMC stack. It is +# present to keep it building in tree since it wouldn't work in LINT. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include GENERIC + +# Add CAMDEBUG stuff +options CAMDEBUG +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) + +# pass(4) device +device pass +options MMCCAM + +nodevice mmc +nodevice mmcsd From owner-svn-src-all@freebsd.org Mon Sep 11 19:07:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC1CE1E3DF; Mon, 11 Sep 2017 19:07:54 +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 7EBF76EA2E; Mon, 11 Sep 2017 19:07:54 +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 v8BJ7reK084120; Mon, 11 Sep 2017 19:07:53 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BJ7rCS084119; Mon, 11 Sep 2017 19:07:53 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201709111907.v8BJ7rCS084119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Mon, 11 Sep 2017 19:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323459 - head/sys/modules/uart X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/modules/uart X-SVN-Commit-Revision: 323459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 19:07:54 -0000 Author: mw Date: Mon Sep 11 19:07:53 2017 New Revision: 323459 URL: https://svnweb.freebsd.org/changeset/base/323459 Log: Restore alphabetical order in UART Makefile Commit r323359 introduced new Marvell UART controller driver and by mistake it broke correct order in the Makefile. Fix this. Reported by: emaste Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Mon Sep 11 19:07:42 2017 (r323458) +++ head/sys/modules/uart/Makefile Mon Sep 11 19:07:53 2017 (r323459) @@ -33,8 +33,8 @@ KMOD= uart SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ uart_core.c ${uart_cpu_machine} uart_dbg.c \ - ${uart_dev_lpc} uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ - uart_dev_z8530.c ${uart_dev_mvebu} \ + ${uart_dev_lpc} ${uart_dev_mvebu} uart_dev_ns8250.c uart_dev_quicc.c \ + uart_dev_sab82532.c uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c SRCS+= acpi_if.h bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} \ From owner-svn-src-all@freebsd.org Mon Sep 11 20:33:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DA10E22D19; Mon, 11 Sep 2017 20:33:22 +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 E0E9471899; Mon, 11 Sep 2017 20:33:21 +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 v8BKXKdE020466; Mon, 11 Sep 2017 20:33:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BKXKOh020465; Mon, 11 Sep 2017 20:33:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112033.v8BKXKOh020465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 20:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323461 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 323461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 20:33:22 -0000 Author: ian Date: Mon Sep 11 20:33:20 2017 New Revision: 323461 URL: https://svnweb.freebsd.org/changeset/base/323461 Log: MFC r321876: In xdev-links, when installing symlinks to the cross-compiler pieces that includes the OS version (armv6-freebsd12.0-cc, etc), use the OS version of the compiler/world source code, not the version of the build host machine. Modified: stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Mon Sep 11 19:57:04 2017 (r323460) +++ stable/11/Makefile.inc1 Mon Sep 11 20:33:20 2017 (r323461) @@ -2554,9 +2554,6 @@ CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/u CD2MAKE+= BUILD_TOOLS_META=.NOMETA .endif XDDESTDIR=${DESTDIR}/${XDTP} -.if !defined(OSREL) -OSREL!= uname -r | sed -e 's/[-(].*//' -.endif .ORDER: xdev-build xdev-install xdev-links xdev: xdev-build xdev-install .PHONY @@ -2650,7 +2647,7 @@ xdev-links: .PHONY ln -sf ../../${XDTP}/usr/bin/$$i \ ../../../../usr/bin/${XDDIR}-$$i; \ ln -sf ../../${XDTP}/usr/bin/$$i \ - ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ + ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \ done .else xdev xdev-build xdev-install xdev-links: .PHONY From owner-svn-src-all@freebsd.org Mon Sep 11 20:41:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39372E23272; Mon, 11 Sep 2017 20:41: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 06FC471EA0; Mon, 11 Sep 2017 20:41:26 +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 v8BKfQIY020775; Mon, 11 Sep 2017 20:41:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BKfQbv020774; Mon, 11 Sep 2017 20:41:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709112041.v8BKfQbv020774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 11 Sep 2017 20:41:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323462 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 323462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 20:41:27 -0000 Author: cem Date: Mon Sep 11 20:41:25 2017 New Revision: 323462 URL: https://svnweb.freebsd.org/changeset/base/323462 Log: x86 MCA: Extract CMCI support predicate into function On AMD, the MCG_CAP feature bit is reserved -- not explicitly zero. Do not use it to determine CMCI support. Reviewed by: avg, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12320 Modified: head/sys/x86/x86/mca.c Modified: head/sys/x86/x86/mca.c ============================================================================== --- head/sys/x86/x86/mca.c Mon Sep 11 20:33:20 2017 (r323461) +++ head/sys/x86/x86/mca.c Mon Sep 11 20:41:25 2017 (r323462) @@ -149,6 +149,18 @@ amd_thresholding_supported(void) } #endif +static inline bool +cmci_supported(uint64_t mcg_cap) +{ + /* + * MCG_CAP_CMCI_P bit is reserved in AMD documentation. Until + * it is defined, do not use it to check for CMCI support. + */ + if (cpu_vendor_id != CPU_VENDOR_INTEL) + return (false); + return ((mcg_cap & MCG_CAP_CMCI_P) != 0); +} + static int sysctl_positive_int(SYSCTL_HANDLER_ARGS) { @@ -322,7 +334,7 @@ mca_log(const struct mca_record *rec) printf("UNCOR "); else { printf("COR "); - if (rec->mr_mcg_cap & MCG_CAP_CMCI_P) + if (cmci_supported(rec->mr_mcg_cap)) printf("(%lld) ", ((long long)rec->mr_status & MC_STATUS_COR_COUNT) >> 38); } @@ -873,7 +885,7 @@ mca_setup(uint64_t mcg_cap) "force_scan", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, sysctl_mca_scan, "I", "Force an immediate scan for machine checks"); #ifdef DEV_APIC - if (mcg_cap & MCG_CAP_CMCI_P) + if (cmci_supported(mcg_cap)) cmci_setup(); else if (amd_thresholding_supported()) amd_thresholding_setup(); @@ -1104,7 +1116,7 @@ _mca_init(int boot) wrmsr(MSR_MC_CTL(i), ctl); #ifdef DEV_APIC - if (mcg_cap & MCG_CAP_CMCI_P) { + if (cmci_supported(mcg_cap)) { if (boot) cmci_monitor(i); else From owner-svn-src-all@freebsd.org Mon Sep 11 20:42:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01C91E2344C; Mon, 11 Sep 2017 20:42:09 +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 D2AB072066; Mon, 11 Sep 2017 20:42:08 +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 v8BKg8Bj023994; Mon, 11 Sep 2017 20:42:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BKg7HM023992; Mon, 11 Sep 2017 20:42:07 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709112042.v8BKg7HM023992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 11 Sep 2017 20:42:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323463 - in head/sys/x86: include x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/x86: include x86 X-SVN-Commit-Revision: 323463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 20:42:09 -0000 Author: cem Date: Mon Sep 11 20:42:07 2017 New Revision: 323463 URL: https://svnweb.freebsd.org/changeset/base/323463 Log: MCA: Rename AMD MISC bits/masks They apply to all AMD MCAi_MISC0 registers, not just MCA4 (NB). No functional change. Sponsored by: Dell EMC Isilon Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/mca.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Mon Sep 11 20:41:25 2017 (r323462) +++ head/sys/x86/include/specialreg.h Mon Sep 11 20:42:07 2017 (r323463) @@ -715,22 +715,22 @@ #define MC_CTL2_THRESHOLD 0x0000000000007fff #define MC_CTL2_CMCI_EN 0x0000000040000000 #define MC_AMDNB_BANK 4 -#define MC_MISC_AMDNB_VAL 0x8000000000000000 /* Counter presence valid */ -#define MC_MISC_AMDNB_CNTP 0x4000000000000000 /* Counter present */ -#define MC_MISC_AMDNB_LOCK 0x2000000000000000 /* Register locked */ -#define MC_MISC_AMDNB_INTP 0x1000000000000000 /* Int. type can generate interrupts */ -#define MC_MISC_AMDNB_LVT_MASK 0x00f0000000000000 /* Extended LVT offset */ -#define MC_MISC_AMDNB_LVT_SHIFT 52 -#define MC_MISC_AMDNB_CNTEN 0x0008000000000000 /* Counter enabled */ -#define MC_MISC_AMDNB_INT_MASK 0x0006000000000000 /* Interrupt type */ -#define MC_MISC_AMDNB_INT_LVT 0x0002000000000000 /* Interrupt via Extended LVT */ -#define MC_MISC_AMDNB_INT_SMI 0x0004000000000000 /* SMI */ -#define MC_MISC_AMDNB_OVERFLOW 0x0001000000000000 /* Counter overflow */ -#define MC_MISC_AMDNB_CNT_MASK 0x00000fff00000000 /* Counter value */ -#define MC_MISC_AMDNB_CNT_SHIFT 32 -#define MC_MISC_AMDNB_CNT_MAX 0xfff -#define MC_MISC_AMDNB_PTR_MASK 0x00000000ff000000 /* Pointer to additional registers */ -#define MC_MISC_AMDNB_PTR_SHIFT 24 +#define MC_MISC_AMD_VAL 0x8000000000000000 /* Counter presence valid */ +#define MC_MISC_AMD_CNTP 0x4000000000000000 /* Counter present */ +#define MC_MISC_AMD_LOCK 0x2000000000000000 /* Register locked */ +#define MC_MISC_AMD_INTP 0x1000000000000000 /* Int. type can generate interrupts */ +#define MC_MISC_AMD_LVT_MASK 0x00f0000000000000 /* Extended LVT offset */ +#define MC_MISC_AMD_LVT_SHIFT 52 +#define MC_MISC_AMD_CNTEN 0x0008000000000000 /* Counter enabled */ +#define MC_MISC_AMD_INT_MASK 0x0006000000000000 /* Interrupt type */ +#define MC_MISC_AMD_INT_LVT 0x0002000000000000 /* Interrupt via Extended LVT */ +#define MC_MISC_AMD_INT_SMI 0x0004000000000000 /* SMI */ +#define MC_MISC_AMD_OVERFLOW 0x0001000000000000 /* Counter overflow */ +#define MC_MISC_AMD_CNT_MASK 0x00000fff00000000 /* Counter value */ +#define MC_MISC_AMD_CNT_SHIFT 32 +#define MC_MISC_AMD_CNT_MAX 0xfff +#define MC_MISC_AMD_PTR_MASK 0x00000000ff000000 /* Pointer to additional registers */ +#define MC_MISC_AMD_PTR_SHIFT 24 /* * The following four 3-byte registers control the non-cacheable regions. Modified: head/sys/x86/x86/mca.c ============================================================================== --- head/sys/x86/x86/mca.c Mon Sep 11 20:41:25 2017 (r323462) +++ head/sys/x86/x86/mca.c Mon Sep 11 20:42:07 2017 (r323463) @@ -649,17 +649,17 @@ amd_thresholding_update(enum scan_mode mode, int bank, ("%s: unexpected bank %d", __func__, bank)); cc = &amd_et_state[PCPU_GET(cpuid)]; misc = rdmsr(MSR_MC_MISC(bank)); - count = (misc & MC_MISC_AMDNB_CNT_MASK) >> MC_MISC_AMDNB_CNT_SHIFT; - count = count - (MC_MISC_AMDNB_CNT_MAX - cc->cur_threshold); + count = (misc & MC_MISC_AMD_CNT_MASK) >> MC_MISC_AMD_CNT_SHIFT; + count = count - (MC_MISC_AMD_CNT_MAX - cc->cur_threshold); new_threshold = update_threshold(mode, valid, cc->last_intr, count, - cc->cur_threshold, MC_MISC_AMDNB_CNT_MAX); + cc->cur_threshold, MC_MISC_AMD_CNT_MAX); cc->cur_threshold = new_threshold; - misc &= ~MC_MISC_AMDNB_CNT_MASK; - misc |= (uint64_t)(MC_MISC_AMDNB_CNT_MAX - cc->cur_threshold) - << MC_MISC_AMDNB_CNT_SHIFT; - misc &= ~MC_MISC_AMDNB_OVERFLOW; + misc &= ~MC_MISC_AMD_CNT_MASK; + misc |= (uint64_t)(MC_MISC_AMD_CNT_MAX - cc->cur_threshold) + << MC_MISC_AMD_CNT_SHIFT; + misc &= ~MC_MISC_AMD_OVERFLOW; wrmsr(MSR_MC_MISC(bank), misc); if (mode == CMCI && valid) cc->last_intr = time_uptime; @@ -971,15 +971,15 @@ amd_thresholding_start(struct amd_et_state *cc) KASSERT(amd_elvt >= 0, ("ELVT offset is not set")); misc = rdmsr(MSR_MC_MISC(MC_AMDNB_BANK)); - misc &= ~MC_MISC_AMDNB_INT_MASK; - misc |= MC_MISC_AMDNB_INT_LVT; - misc &= ~MC_MISC_AMDNB_LVT_MASK; - misc |= (uint64_t)amd_elvt << MC_MISC_AMDNB_LVT_SHIFT; - misc &= ~MC_MISC_AMDNB_CNT_MASK; - misc |= (uint64_t)(MC_MISC_AMDNB_CNT_MAX - cc->cur_threshold) - << MC_MISC_AMDNB_CNT_SHIFT; - misc &= ~MC_MISC_AMDNB_OVERFLOW; - misc |= MC_MISC_AMDNB_CNTEN; + misc &= ~MC_MISC_AMD_INT_MASK; + misc |= MC_MISC_AMD_INT_LVT; + misc &= ~MC_MISC_AMD_LVT_MASK; + misc |= (uint64_t)amd_elvt << MC_MISC_AMD_LVT_SHIFT; + misc &= ~MC_MISC_AMD_CNT_MASK; + misc |= (uint64_t)(MC_MISC_AMD_CNT_MAX - cc->cur_threshold) + << MC_MISC_AMD_CNT_SHIFT; + misc &= ~MC_MISC_AMD_OVERFLOW; + misc |= MC_MISC_AMD_CNTEN; wrmsr(MSR_MC_MISC(MC_AMDNB_BANK), misc); } @@ -992,15 +992,15 @@ amd_thresholding_init(void) /* The counter must be valid and present. */ misc = rdmsr(MSR_MC_MISC(MC_AMDNB_BANK)); - if ((misc & (MC_MISC_AMDNB_VAL | MC_MISC_AMDNB_CNTP)) != - (MC_MISC_AMDNB_VAL | MC_MISC_AMDNB_CNTP)) { + if ((misc & (MC_MISC_AMD_VAL | MC_MISC_AMD_CNTP)) != + (MC_MISC_AMD_VAL | MC_MISC_AMD_CNTP)) { printf("%s: 0x%jx: !valid | !present\n", __func__, (uintmax_t)misc); return; } /* The register should not be locked. */ - if ((misc & MC_MISC_AMDNB_LOCK) != 0) { + if ((misc & MC_MISC_AMD_LOCK) != 0) { printf("%s: 0x%jx: locked\n", __func__, (uintmax_t)misc); return; } @@ -1009,7 +1009,7 @@ amd_thresholding_init(void) * If counter is enabled then either the firmware or another CPU * has already claimed it. */ - if ((misc & MC_MISC_AMDNB_CNTEN) != 0) { + if ((misc & MC_MISC_AMD_CNTEN) != 0) { printf("%s: 0x%jx: count already enabled\n", __func__, (uintmax_t)misc); return; From owner-svn-src-all@freebsd.org Mon Sep 11 21:32:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AE35E009B1; Mon, 11 Sep 2017 21:32:37 +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 073E373C9A; Mon, 11 Sep 2017 21:32:36 +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 v8BLWZ5Q045210; Mon, 11 Sep 2017 21:32:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BLWZ7X045206; Mon, 11 Sep 2017 21:32:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112132.v8BLWZ7X045206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 21:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323464 - in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 323464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 21:32:37 -0000 Author: ian Date: Mon Sep 11 21:32:35 2017 New Revision: 323464 URL: https://svnweb.freebsd.org/changeset/base/323464 Log: MFC r322465: Add config_intrhook_oneshot(): schedule an intrhook function and unregister it automatically after it runs. The config_intrhook mechanism allows a driver to stall the boot process until device(s) required for booting are available, by not allowing system inits to proceed until all intrhook functions have been unregistered. Virtually all existing code simply unregisters from within the hook function when it gets called. This new function makes that common usage more convenient. Instead of allocating and filling in a struct, passing it to a function that might (in theory) fail, and checking the return code, now a driver can simply call this cannot-fail routine, passing just the intrhook function and its arg. Differential Revision: https://reviews.freebsd.org/D11963 Modified: stable/11/share/man/man9/Makefile stable/11/share/man/man9/config_intrhook.9 stable/11/sys/kern/subr_autoconf.c stable/11/sys/sys/kernel.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Mon Sep 11 20:42:07 2017 (r323463) +++ stable/11/share/man/man9/Makefile Mon Sep 11 21:32:35 2017 (r323464) @@ -630,7 +630,8 @@ MLINKS+=condvar.9 cv_broadcast.9 \ condvar.9 cv_wait_unlock.9 \ condvar.9 cv_wmesg.9 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ - config_intrhook.9 config_intrhook_establish.9 + config_intrhook.9 config_intrhook_establish.9 \ + config_intrhook.9 config_intrhook_oneshot.9 MLINKS+=contigmalloc.9 contigfree.9 MLINKS+=casuword.9 casueword.9 \ casuword.9 casueword32.9 \ Modified: stable/11/share/man/man9/config_intrhook.9 ============================================================================== --- stable/11/share/man/man9/config_intrhook.9 Mon Sep 11 20:42:07 2017 (r323463) +++ stable/11/share/man/man9/config_intrhook.9 Mon Sep 11 21:32:35 2017 (r323464) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2006 +.Dd August 10, 2017 .Dt CONFIG_INTRHOOK 9 .Os .Sh NAME @@ -35,10 +35,13 @@ but before root is mounted .Sh SYNOPSIS .In sys/kernel.h +.Vt typedef void (*ich_func_t)(void *arg); .Ft int .Fn config_intrhook_establish "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_disestablish "struct intr_config_hook *hook" +.Ft void +.Fn config_intrhook_oneshot "ich_func_t func" "void *arg" .Sh DESCRIPTION The .Fn config_intrhook_establish @@ -51,6 +54,18 @@ The .Fn config_intrhook_disestablish function removes the entry from the hook queue. .Pp +The +.Fn config_intrhook_oneshot +function schedules a function to be run as described for +.Fn config_intrhook_establish ; +the entry is automatically removed from the hook queue +after that function runs. +This is appropriate when additional device configuration must be done +after interrupts are enabled, but there is no need to stall the +boot process after that. +This function allocates memory using M_WAITOK; do not call this while +holding any non-sleepable locks. +.Pp Before root is mounted, all the previously established hooks are run. The boot process is then stalled until all handlers remove their hook @@ -71,8 +86,8 @@ This structure is defined as follows: .Bd -literal struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */ - void (*ich_func)(void *arg); /* function to call */ - void *ich_arg; /* Argument to call */ + ich_func_t ich_func; /* function to call */ + void *ich_arg; /* Argument to call */ }; .Ed .Pp Modified: stable/11/sys/kern/subr_autoconf.c ============================================================================== --- stable/11/sys/kern/subr_autoconf.c Mon Sep 11 20:42:07 2017 (r323463) +++ stable/11/sys/kern/subr_autoconf.c Mon Sep 11 21:32:35 2017 (r323464) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -63,6 +64,27 @@ MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, static void run_interrupt_driven_config_hooks(void); /* + * Private data and a shim function for implementing config_interhook_oneshot(). + */ +struct oneshot_config_hook { + struct intr_config_hook + och_hook; /* Must be first */ + ich_func_t och_func; + void *och_arg; +}; + +static void +config_intrhook_oneshot_func(void *arg) +{ + struct oneshot_config_hook *ohook; + + ohook = arg; + ohook->och_func(ohook->och_arg); + config_intrhook_disestablish(&ohook->och_hook); + free(ohook, M_DEVBUF); +} + +/* * If we wait too long for an interrupt-driven config hook to return, print * a diagnostic. */ @@ -181,6 +203,22 @@ config_intrhook_establish(struct intr_config_hook *hoo /* XXX Sufficient for modules loaded after initial config??? */ run_interrupt_driven_config_hooks(); return (0); +} + +/* + * Register a hook function that is automatically unregistered after it runs. + */ +void +config_intrhook_oneshot(ich_func_t func, void *arg) +{ + struct oneshot_config_hook *ohook; + + ohook = malloc(sizeof(*ohook), M_DEVBUF, M_WAITOK); + ohook->och_func = func; + ohook->och_arg = arg; + ohook->och_hook.ich_func = config_intrhook_oneshot_func; + ohook->och_hook.ich_arg = ohook; + config_intrhook_establish(&ohook->och_hook); } void Modified: stable/11/sys/sys/kernel.h ============================================================================== --- stable/11/sys/sys/kernel.h Mon Sep 11 20:42:07 2017 (r323463) +++ stable/11/sys/sys/kernel.h Mon Sep 11 21:32:35 2017 (r323464) @@ -400,13 +400,16 @@ struct tunable_str { #define TUNABLE_STR_FETCH(path, var, size) \ getenv_string((path), (var), (size)) +typedef void (*ich_func_t)(void *_arg); + struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links; - void (*ich_func)(void *arg); - void *ich_arg; + ich_func_t ich_func; + void *ich_arg; }; int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); +void config_intrhook_oneshot(ich_func_t _func, void *_arg); #endif /* !_SYS_KERNEL_H_*/ From owner-svn-src-all@freebsd.org Mon Sep 11 21:49:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 628A8E017B1; Mon, 11 Sep 2017 21:49:40 +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 20DFE74441; Mon, 11 Sep 2017 21:49:40 +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 v8BLncYU049329; Mon, 11 Sep 2017 21:49:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BLncAs049328; Mon, 11 Sep 2017 21:49:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112149.v8BLncAs049328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 21:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323465 - head/usr.sbin/i2c X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/usr.sbin/i2c X-SVN-Commit-Revision: 323465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 21:49:40 -0000 Author: ian Date: Mon Sep 11 21:49:38 2017 New Revision: 323465 URL: https://svnweb.freebsd.org/changeset/base/323465 Log: Make i2c -s (device scan) work on hardware that supports only full xfers. The existing scan code is based on sending an i2c START condition and if there is no error it assumes there is a device at that i2c address. Some i2c controllers don't support sending individual start/stop signals on the bus, they can only perform complete data transfers with start/stop handled in the silicon. This adds a fallback mechanism that attempts to read a single byte from each i2c address. It's less reliable than looking for an an ACK repsonse to a start, because some devices will NAK an attempt to read that isn't preceeded by a write of a register address. Writing to devices to probe them is too dangerous to even consider. The user is told that a less-reliable scan is being done, so even if the read-scan comes up empty too, it's still a vast improvement over the old situation where it would just claim there were no devices on the bus even though the devices were there and working fine. If the i2c controller responds with a proper ENODEV (device doesn't support operation) or an almost-proper EOPNOTSUPP, the START/STOP scan is switched to a read-scan right away. Most controllers respond with ENXIO or EIO if they don't support START/STOP, so no quick-out is available. For those, if a scan of all 127 addresses and come up empty, the scan is re-done using the read method. Reported by: Maxim Filimonov Modified: head/usr.sbin/i2c/i2c.c Modified: head/usr.sbin/i2c/i2c.c ============================================================================== --- head/usr.sbin/i2c/i2c.c Mon Sep 11 21:32:35 2017 (r323464) +++ head/usr.sbin/i2c/i2c.c Mon Sep 11 21:49:38 2017 (r323465) @@ -121,9 +121,12 @@ skip_get_tokens(char *skip_addr, int *sk_addr, int max static int scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr) { + struct iic_msg rdmsg; + struct iic_rdwr_data rdwrdata; struct skip_range addr_range = { 0, 0 }; int *tokens, fd, error, i, index, j; - int len = 0, do_skip = 0, no_range = 1; + int len = 0, do_skip = 0, no_range = 1, num_found = 0, use_read_xfer = 0; + uint8_t rdbyte; fd = open(dev, O_RDWR); if (fd == -1) { @@ -157,6 +160,14 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char } printf("Scanning I2C devices on %s: ", dev); + +start_over: + if (use_read_xfer) { + fprintf(stderr, + "Hardware may not support START/STOP scanning; " + "trying less-reliable read method.\n"); + } + for (i = 1; i < 127; i++) { if (skip && ( addr_range.start < addr_range.end)) { @@ -180,17 +191,46 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char cmd.last = 1; cmd.count = 0; error = ioctl(fd, I2CRSTCARD, &cmd); - if (error) + if (error) { + fprintf(stderr, "Controller reset failed\n"); goto out; - - cmd.slave = i << 1; - cmd.last = 1; - error = ioctl(fd, I2CSTART, &cmd); - if (!error) - printf("%x ", i); - cmd.slave = i << 1; - cmd.last = 1; - error = ioctl(fd, I2CSTOP, &cmd); + } + if (use_read_xfer) { + rdmsg.buf = &rdbyte; + rdmsg.len = 1; + rdmsg.flags = IIC_M_RD; + rdmsg.slave = i << 1; + rdwrdata.msgs = &rdmsg; + rdwrdata.nmsgs = 1; + error = ioctl(fd, I2CRDWR, &rdwrdata); + } else { + cmd.slave = i << 1; + cmd.last = 1; + error = ioctl(fd, I2CSTART, &cmd); + if (errno == ENODEV || errno == EOPNOTSUPP) { + /* If START not supported try reading. */ + use_read_xfer = 1; + goto start_over; + } + cmd.slave = i << 1; + cmd.last = 1; + ioctl(fd, I2CSTOP, &cmd); + } + if (error == 0) { + ++num_found; + printf("%02x ", i); + } + } + /* + * If we found nothing, maybe START is not supported and returns a + * generic error code such as EIO or ENXIO, so try again using reads. + */ + if (num_found == 0) { + if (!use_read_xfer) { + use_read_xfer = 1; + goto start_over; + } + printf(""); } printf("\n"); From owner-svn-src-all@freebsd.org Mon Sep 11 21:55:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2368AE01CF4; Mon, 11 Sep 2017 21:55:11 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B307B74916; Mon, 11 Sep 2017 21:55:10 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id v8BLt0Ps058506 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 11 Sep 2017 23:55:01 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id v8BLt0VA058505; Mon, 11 Sep 2017 23:55:00 +0200 (CEST) (envelope-from marius) Date: Mon, 11 Sep 2017 23:55:00 +0200 From: Marius Strobl To: Slawa Olhovchenkov Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r323081 - stable/10/sys/conf Message-ID: <20170911215500.GE95883@alchemy.franken.de> References: <201709010016.v810G3YB099686@repo.freebsd.org> <20170906170854.GC9110@zxy.spb.ru> <20170906190410.GD95883@alchemy.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170906190410.GD95883@alchemy.franken.de> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 21:55:11 -0000 On Wed, Sep 06, 2017 at 09:04:10PM +0200, Marius Strobl wrote: > On Wed, Sep 06, 2017 at 08:08:54PM +0300, Slawa Olhovchenkov wrote: > > On Fri, Sep 01, 2017 at 12:16:03AM +0000, Marius Strobl wrote: > > > > > Author: marius > > > Date: Fri Sep 1 00:16:03 2017 > > > New Revision: 323081 > > > URL: https://svnweb.freebsd.org/changeset/base/323081 > > > > > > Log: > > > Update stable/10 to BETA3 in preparation for 10.4-BETA3 builds. > > > > > > Approved by: re (implicit) > > > > > > Modified: > > > stable/10/sys/conf/newvers.sh > > > > NETAMP still not working on ix card. > > Yeah, erj@ intended to update ixgbe(4) in stable/10 but apparently > has dropped the ball on it. I've no idea whether that update would > actually fix netmap(4) support, though; regarding that problem he > said that at Intel, they don't have much capability or time for > netmap(4) testing. Please test whether the following patch solves your problems with r315333: https://people.freebsd.org/~marius/ixgbe_netmap_10.diff Marius From owner-svn-src-all@freebsd.org Mon Sep 11 22:18:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A7A1E02EB5; Mon, 11 Sep 2017 22:18:02 +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 46F49752B2; Mon, 11 Sep 2017 22:18:02 +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 v8BMI16U061422; Mon, 11 Sep 2017 22:18:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMI15x061421; Mon, 11 Sep 2017 22:18:01 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709112218.v8BMI15x061421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 11 Sep 2017 22:18:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323466 - head/libexec/rtld-elf/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/libexec/rtld-elf/mips X-SVN-Commit-Revision: 323466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:18:02 -0000 Author: jhb Date: Mon Sep 11 22:18:01 2017 New Revision: 323466 URL: https://svnweb.freebsd.org/changeset/base/323466 Log: Add CFI directives for _rtld_bind_start. This allows debuggers to unwind back into the caller when stopped in the runtime linker. Sponsored by: DARPA / AFRL Modified: head/libexec/rtld-elf/mips/rtld_start.S Modified: head/libexec/rtld-elf/mips/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/mips/rtld_start.S Mon Sep 11 21:49:38 2017 (r323465) +++ head/libexec/rtld-elf/mips/rtld_start.S Mon Sep 11 22:18:01 2017 (r323466) @@ -104,26 +104,39 @@ END(rtld_start) .ent _rtld_bind_start _rtld_bind_start: .frame sp, XCALLFRAME_SIZ, $15 + .cfi_startproc simple + .cfi_register ra, $15 move v1, gp /* save old GP */ #if defined(__mips_o32) || defined(__mips_o64) PTR_ADDU t9, 8 /* modify T9 to point at .cpload */ #endif SETUP_GP PTR_SUBU sp, XCALLFRAME_SIZ /* save arguments and sp value in stack */ + .cfi_def_cfa sp, XCALLFRAME_SIZ SETUP_GP64(XCALLFRAME_GP, _rtld_bind_start) SAVE_GP(XCALLFRAME_GP) #if defined(__mips_n32) || defined(__mips_n64) REG_S a4, XCALLFRAME_A4(sp) + .cfi_rel_offset a4, XCALLFRAME_A4 REG_S a5, XCALLFRAME_A5(sp) + .cfi_rel_offset a5, XCALLFRAME_A5 REG_S a6, XCALLFRAME_A6(sp) + .cfi_rel_offset a6, XCALLFRAME_A6 REG_S a7, XCALLFRAME_A7(sp) + .cfi_rel_offset a7, XCALLFRAME_A7 #endif REG_S a0, XCALLFRAME_A0(sp) + .cfi_rel_offset a0, XCALLFRAME_A0 REG_S a1, XCALLFRAME_A1(sp) + .cfi_rel_offset a1, XCALLFRAME_A1 REG_S a2, XCALLFRAME_A2(sp) + .cfi_rel_offset a2, XCALLFRAME_A2 REG_S a3, XCALLFRAME_A3(sp) + .cfi_rel_offset a3, XCALLFRAME_A3 REG_S $15, XCALLFRAME_RA(sp) /* ra is in t7/t3 */ + .cfi_rel_offset ra, XCALLFRAME_RA REG_S s0, XCALLFRAME_S0(sp) + .cfi_rel_offset s0, XCALLFRAME_S0 move s0, sp move a0, v1 /* old GP */ @@ -147,20 +160,31 @@ _rtld_bind_start: move sp, s0 REG_L ra, XCALLFRAME_RA(sp) + .cfi_restore ra REG_L s0, XCALLFRAME_S0(sp) + .cfi_restore s0 REG_L a0, XCALLFRAME_A0(sp) + .cfi_restore a0 REG_L a1, XCALLFRAME_A1(sp) + .cfi_restore a1 REG_L a2, XCALLFRAME_A2(sp) + .cfi_restore a2 REG_L a3, XCALLFRAME_A3(sp) + .cfi_restore a3 #if defined(__mips_n32) || defined(__mips_n64) REG_L a4, XCALLFRAME_A4(sp) + .cfi_restore a4 REG_L a5, XCALLFRAME_A5(sp) + .cfi_restore a5 REG_L a6, XCALLFRAME_A6(sp) + .cfi_restore a6 REG_L a7, XCALLFRAME_A7(sp) + .cfi_restore a7 #endif RESTORE_GP64 PTR_ADDU sp, XCALLFRAME_SIZ move t9, v0 jr t9 nop + .cfi_endproc END(_rtld_bind_start) From owner-svn-src-all@freebsd.org Mon Sep 11 22:21:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C634CE03166; Mon, 11 Sep 2017 22:21:17 +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 62A7F75511; Mon, 11 Sep 2017 22:21:17 +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 v8BMLG0h061592; Mon, 11 Sep 2017 22:21:16 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMLFoV061582; Mon, 11 Sep 2017 22:21:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112221.v8BMLFoV061582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323467 - in stable/11/sys: arm/allwinner conf dev/iicbus mips/conf mips/rmi modules/i2c modules/i2c/ds1307 modules/i2c/ds13rtc modules/i2c/ds3231 modules/i2c/isl12xx modules/i2c/nxprtc... X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/allwinner conf dev/iicbus mips/conf mips/rmi modules/i2c modules/i2c/ds1307 modules/i2c/ds13rtc modules/i2c/ds3231 modules/i2c/isl12xx modules/i2c/nxprtc modules/i2c/s35390a X-SVN-Commit-Revision: 323467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:21:17 -0000 Author: ian Date: Mon Sep 11 22:21:15 2017 New Revision: 323467 URL: https://svnweb.freebsd.org/changeset/base/323467 Log: MFC r321708-r321712, r321721, r321726-r321727, r321746, r321751, r321791-r321792, r321795, r321798, r321821, r321823, r321826, r321828, r321841, r321934, r322025-r322026, r322282, r322431, r322473, r322475-r322479 Lots of i2c RTC driver stuff... r321708: Replace the pcf8563 i2c RTC driver with a new nxprtc driver which handles all the chips in the NXP PCA212x and PCA/PCF85xx series. In addition to supporting more chips, this driver uses the countdown timer on the chips as a fractional seconds counter, giving it a resolution of about 15 milliseconds. r321709: Fix building this driver on non-FDT platforms. r321710: Add a few missing i2c devices that build fine on all arches. r321711: Move the device descriptions onto the device lines, so they cut and paste nicely into other config files. r321712: Add the i2c RTC drivers found on various arm systems. r321721: Switch from using iic_transfer() to iicdev_readfrom/writeto(), mostly so that transfers will be done with proper ownership of the bus. No behavioral changes. r321726: Bugfixes and enhancements... Don't enable the oscillator when it is found to be stopped at init time, just let the first setting of valid time start it. But still report a dead battery if it's stopped at init time. Don't force the chip into 24hr mode, just cope with whatever mode it is already in. Align the RTC clock to top of second when setting it. r321727: Fix AM/PM mode handling. The bits to mask off in the hours register changes between 12/24 hour mode. Also fix conversion between 12 and 24 hour mode. It's not as easy as adding/subtracting 12, because the clock doesn't roll over 11->0, it rolls over 12->1; 0 isn't a valid hour in AM/PM mode. r321746: Use the new clock_schedule() to arrange for clock_settime() to be called at the right time to keep the RTC hardware time in sync, instead of using pause_sbt() to sleep until the right time. r321751: Remove now-unused variable. r321791: Switch from using iic_transfer() to iicdev_readfrom/writeto(), mostly so that transfers will be done with proper ownership of the bus. No behavioral changes. Also add a detach() method. r321792: Add a detach() method. r321795: Check the clock-halted flag every time the clock is read, not just once at startup. The flag stays set until the clock is loaded with good time, so we need to keep saying the time is invalid until that happens. r321798: Restore a few rather important lines of code that got fumbled in r321746. r321821: No need to call getnanotime() now that the waiting is done by the central subr_rtc code, switch from CLOCKF_SETTIME_NO_TS to CLOCKF_SETTIME_NO_ADJ so that we get fed a timestamp, but it's not adjusted to compensate for inaccuracy in setting time. r321823: Bugfixes and enhancements... Don't enable the oscillator when it is found to be stopped at init time, just let the first setting of valid time start it. But still report a dead battery if it's stopped at init time. Don't force the chip into 24hr mode, just cope with whatever mode it is already in. Schedule the clock_settime() callbacks to align the RTC clock to top of second when setting it. r321826: Restructure the SUBDIR list as 1-per-line and alphabetize, so it will be easier to add new things (and see what changed) in the future. r321828: Build iicbus/{ds1307,ds3231,nxprtc} as modules. r321841: Add a driver for the Intersil ISL12xx family of i2c RTC chips. Supports ISL1209, ISL1218, ISL1219, ISL1220, ISL1221 (just basic RTC functionality, not all the other fancy stuff the chips can do). r321934: Add missing ofw_bus_if.h src file. r322025: Switch to iicdev_readfrom/writeto() to do xfers with proper bus ownership. Tested by: manu@ r322026: Add missing header file to SRCS. Reported by: manu@ r322282: Remove the ds133x and s35390a i2c RTC drivers for now. They both do i2c transfers in their probe() or attach() routines, and that doesn't work when the low-level controller requires interrupts to be functional. The DS133x family of chips is nearly identical to the DS1307 and support for them should be added to that driver, then the ds133x driver can be deleted. The s35390a driver just needs a non-trivial workover. In both cases that work will be done and committed separately. r322431: Bid for the device with BUS_PROBE_GENERIC, because this is very much a generic driver with minimal feature support for a large number of chips. More featureful per-chip drivers might exist (especially out-of-tree) and those should win the bidding even if they use BUS_PROBE_DEFAULT. r322473: Add a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips. This driver supports only basic timekeeping functionality. It completely replaces the ds133x driver. It can also replace the ds1374 driver, but that will take a few other changes in MIPS code and config, and will be committed separately. It does NOT replace the existing ds1307 driver, which provides access to some of the extended features on the 1307 chip, such as controlling the square wave output signal. If both ds1307 and ds13rtc drivers are present, the ds1307 driver will outbid and win control of the device. This driver can be configured with FDT data, or by using hints on non-FDT systems. In addition to the standard hints for i2c devices, it requires a "chiptype" string of the form "dallas,ds13xx" where 'xx' is the chip id (i.e., the same format as FDT compat strings). r322475: Change "chiptype" to "compatible". Making the hint name the same as the FDT property name should make it easier to document the list of names accepted by both configuration mechanisms. r322476: Remove the old ds1374 driver and use the ds13rtc driver instead. Adjust several mips config files accordingly. r322477: Minor fixes and enhancements for the s35390a i2c RTC driver... - Add FDT probe code. - Do i2c transfers with exclusive bus ownership. - Use config_intrhook_oneshot() to defer chip setup because some i2c busses can't do transfers without interrupts. - Add a detach() routine. - Add to module build. r322478: Add back the drivers for Dallas/Maxim ds13xx and Seiko S35390x now that they've been rewritten/fixed to not cause panics by doing i2c transfers before interrupts are available. PR: 221227 r322479: Add hinted attachment for non-FDT systems. Also, print a message if setting up the timer fails, because on some types of chips that's the first attempt to access the device. If the chip is missing/non-responsive then you'd get a driver that attached and didn't register the rtc, with no clue about why. On other chip types there are inits that come before timer setup, and they already print messages about errors. Added: stable/11/sys/dev/iicbus/ds13rtc.c - copied, changed from r322473, head/sys/dev/iicbus/ds13rtc.c stable/11/sys/dev/iicbus/isl12xx.c - copied unchanged from r321841, head/sys/dev/iicbus/isl12xx.c stable/11/sys/dev/iicbus/nxprtc.c - copied, changed from r321712, head/sys/dev/iicbus/nxprtc.c stable/11/sys/modules/i2c/ds1307/ - copied from r321828, head/sys/modules/i2c/ds1307/ stable/11/sys/modules/i2c/ds13rtc/ - copied from r322473, head/sys/modules/i2c/ds13rtc/ stable/11/sys/modules/i2c/ds3231/ - copied from r321828, head/sys/modules/i2c/ds3231/ stable/11/sys/modules/i2c/isl12xx/ - copied from r321841, head/sys/modules/i2c/isl12xx/ stable/11/sys/modules/i2c/nxprtc/ - copied from r321828, head/sys/modules/i2c/nxprtc/ stable/11/sys/modules/i2c/s35390a/ - copied from r322479, head/sys/modules/i2c/s35390a/ Deleted: stable/11/sys/dev/iicbus/ds133x.c stable/11/sys/dev/iicbus/ds1374.c stable/11/sys/dev/iicbus/pcf8563.c stable/11/sys/dev/iicbus/pcf8563reg.h Modified: stable/11/sys/arm/allwinner/axp209.c stable/11/sys/conf/NOTES stable/11/sys/conf/files stable/11/sys/dev/iicbus/ds1307.c stable/11/sys/dev/iicbus/ds1307reg.h stable/11/sys/dev/iicbus/ds3231.c stable/11/sys/dev/iicbus/ds3231reg.h stable/11/sys/dev/iicbus/s35390a.c stable/11/sys/mips/conf/XLP.hints stable/11/sys/mips/conf/XLR stable/11/sys/mips/conf/XLR64 stable/11/sys/mips/conf/XLRN32 stable/11/sys/mips/conf/std.XLP stable/11/sys/mips/rmi/xlr_i2c.c stable/11/sys/modules/i2c/Makefile stable/11/sys/modules/i2c/ds1307/Makefile stable/11/sys/modules/i2c/ds3231/Makefile stable/11/sys/modules/i2c/isl12xx/Makefile stable/11/sys/modules/i2c/nxprtc/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/axp209.c ============================================================================== --- stable/11/sys/arm/allwinner/axp209.c Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/arm/allwinner/axp209.c Mon Sep 11 22:21:15 2017 (r323467) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -59,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include -#include "iicbus_if.h" #include "gpio_if.h" #include "regdev_if.h" @@ -602,7 +600,6 @@ enum AXP2XX_TYPE { struct axp2xx_softc { device_t dev; - uint32_t addr; struct resource * res[1]; void * intrcookie; struct intr_config_hook intr_hook; @@ -641,57 +638,15 @@ static struct resource_spec axp_res_spec[] = { static int axp2xx_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { - struct axp2xx_softc *sc = device_get_softc(dev); - struct iic_msg msg[2]; - msg[0].slave = sc->addr; - msg[0].flags = IIC_M_WR; - msg[0].len = 1; - msg[0].buf = ® - - msg[1].slave = sc->addr; - msg[1].flags = IIC_M_RD; - msg[1].len = size; - msg[1].buf = data; - - return (iicbus_transfer(dev, msg, 2)); + return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT)); } static int axp2xx_write(device_t dev, uint8_t reg, uint8_t data) { - uint8_t buffer[2]; - struct axp2xx_softc *sc = device_get_softc(dev); - struct iic_msg msg[2]; - int nmsgs = 0; - if (sc->type == AXP209) { - buffer[0] = reg; - buffer[1] = data; - - msg[0].slave = sc->addr; - msg[0].flags = IIC_M_WR; - msg[0].len = 2; - msg[0].buf = buffer; - - nmsgs = 1; - } - else if (sc->type == AXP221) { - msg[0].slave = sc->addr; - msg[0].flags = IIC_M_WR; - msg[0].len = 1; - msg[0].buf = ® - - msg[1].slave = sc->addr; - msg[1].flags = IIC_M_WR; - msg[1].len = 1; - msg[1].buf = &data; - nmsgs = 2; - } - else - return (EINVAL); - - return (iicbus_transfer(dev, msg, nmsgs)); + return (iicdev_writeto(dev, reg, &data, sizeof(data), IIC_INTRWAIT)); } static int @@ -1239,7 +1194,6 @@ axp2xx_start(void *pdev) dev = pdev; sc = device_get_softc(dev); - sc->addr = iicbus_get_addr(dev); sc->dev = dev; if (bootverbose) { @@ -1451,4 +1405,4 @@ EARLY_DRIVER_MODULE(ofw_gpiobus, axp2xx_pmu, ofw_gpiob DRIVER_MODULE(gpioc, axp2xx_pmu, gpioc_driver, gpioc_devclass, 0, 0); MODULE_VERSION(axp2xx, 1); -MODULE_DEPEND(axp2xx, iicbus, 1, 1, 1); +MODULE_DEPEND(axp2xx, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/conf/NOTES Mon Sep 11 22:21:15 2017 (r323467) @@ -2567,15 +2567,14 @@ device iicoc # OpenCores I2C controller support # I2C peripheral devices # -# ds133x Dallas Semiconductor DS1337, DS1338 and DS1339 RTC -# ds1374 Dallas Semiconductor DS1374 RTC -# ds1672 Dallas Semiconductor DS1672 RTC -# s35390a Seiko Instruments S-35390A RTC -# -device ds133x -device ds1374 -device ds1672 -device s35390a +device ds1307 # Dallas DS1307 RTC and compatible +device ds13rtc # All Dallas/Maxim ds13xx chips +device ds1672 # Dallas DS1672 RTC +device ds3231 # Dallas DS3231 RTC + temperature +device icee # AT24Cxxx and compatible EEPROMs +device lm75 # LM75 compatible temperature sensor +device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx +device s35390a # Seiko Instruments S-35390A RTC # Parallel-Port Bus # Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/conf/files Mon Sep 11 22:21:15 2017 (r323467) @@ -1686,8 +1686,7 @@ dev/ie/if_ie.c optional ie isa nowerror dev/ie/if_ie_isa.c optional ie isa dev/iicbus/ad7418.c optional ad7418 dev/iicbus/ds1307.c optional ds1307 -dev/iicbus/ds133x.c optional ds133x -dev/iicbus/ds1374.c optional ds1374 +dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 dev/iicbus/icee.c optional icee @@ -1702,9 +1701,10 @@ dev/iicbus/iiconf.c optional iicbus dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" dev/iicbus/iicoc.c optional iicoc +dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 +dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus -dev/iicbus/pcf8563.c optional pcf8563 dev/iicbus/s35390a.c optional s35390a dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir Modified: stable/11/sys/dev/iicbus/ds1307.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1307.c Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/dev/iicbus/ds1307.c Mon Sep 11 22:21:15 2017 (r323467) @@ -56,43 +56,36 @@ __FBSDID("$FreeBSD$"); struct ds1307_softc { device_t sc_dev; - int sc_year0; - struct intr_config_hook enum_hook; - uint16_t sc_addr; /* DS1307 slave address. */ + struct intr_config_hook + enum_hook; uint8_t sc_ctrl; - int sc_mcp7941x; + bool sc_mcp7941x; + bool sc_use_ampm; }; static void ds1307_start(void *); #ifdef FDT static const struct ofw_compat_data ds1307_compat_data[] = { - {"dallas,ds1307", (uintptr_t)"Maxim DS1307 RTC"}, - {"maxim,ds1307", (uintptr_t)"Maxim DS1307 RTC"}, - {"microchip,mcp7941x", (uintptr_t)"Microchip MCP7941x RTC"}, + {"dallas,ds1307", (uintptr_t)"Dallas DS1307 RTC"}, + {"maxim,ds1307", (uintptr_t)"Maxim DS1307 RTC"}, + {"microchip,mcp7941x", (uintptr_t)"Microchip MCP7941x RTC"}, { NULL, 0 } }; #endif static int -ds1307_read(device_t dev, uint16_t addr, uint8_t reg, uint8_t *data, size_t len) +ds1307_read1(device_t dev, uint8_t reg, uint8_t *data) { - struct iic_msg msg[2] = { - { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, - { addr, IIC_M_RD, len, data }, - }; - return (iicbus_transfer(dev, msg, nitems(msg))); + return (iicdev_readfrom(dev, reg, data, 1, IIC_INTRWAIT)); } static int -ds1307_write(device_t dev, uint16_t addr, uint8_t *data, size_t len) +ds1307_write1(device_t dev, uint8_t reg, uint8_t data) { - struct iic_msg msg[1] = { - { addr, IIC_M_WR, len, data }, - }; - return (iicbus_transfer(dev, msg, nitems(msg))); + return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT)); } static int @@ -101,8 +94,7 @@ ds1307_ctrl_read(struct ds1307_softc *sc) int error; sc->sc_ctrl = 0; - error = ds1307_read(sc->sc_dev, sc->sc_addr, DS1307_CONTROL, - &sc->sc_ctrl, sizeof(sc->sc_ctrl)); + error = ds1307_read1(sc->sc_dev, DS1307_CONTROL, &sc->sc_ctrl); if (error) { device_printf(sc->sc_dev, "cannot read from RTC.\n"); return (error); @@ -115,11 +107,10 @@ static int ds1307_ctrl_write(struct ds1307_softc *sc) { int error; - uint8_t data[2]; + uint8_t ctrl; - data[0] = DS1307_CONTROL; - data[1] = sc->sc_ctrl & DS1307_CTRL_MASK; - error = ds1307_write(sc->sc_dev, sc->sc_addr, data, sizeof(data)); + ctrl = sc->sc_ctrl & DS1307_CTRL_MASK; + error = ds1307_write1(sc->sc_dev, DS1307_CONTROL, ctrl); if (error != 0) device_printf(sc->sc_dev, "cannot write to RTC.\n"); @@ -127,54 +118,6 @@ ds1307_ctrl_write(struct ds1307_softc *sc) } static int -ds1307_osc_enable(struct ds1307_softc *sc) -{ - int error; - uint8_t data[2], secs; - - secs = 0; - error = ds1307_read(sc->sc_dev, sc->sc_addr, DS1307_SECS, - &secs, sizeof(secs)); - if (error) { - device_printf(sc->sc_dev, "cannot read from RTC.\n"); - return (error); - } - /* Check if the oscillator is disabled. */ - if ((secs & DS1307_SECS_CH) == 0) - return (0); - device_printf(sc->sc_dev, "clock was halted, check the battery.\n"); - data[0] = DS1307_SECS; - data[1] = secs & DS1307_SECS_MASK; - error = ds1307_write(sc->sc_dev, sc->sc_addr, data, sizeof(data)); - if (error != 0) - device_printf(sc->sc_dev, "cannot write to RTC.\n"); - - return (error); -} - -static int -ds1307_set_24hrs_mode(struct ds1307_softc *sc) -{ - int error; - uint8_t data[2], hour; - - hour = 0; - error = ds1307_read(sc->sc_dev, sc->sc_addr, DS1307_HOUR, - &hour, sizeof(hour)); - if (error) { - device_printf(sc->sc_dev, "cannot read from RTC.\n"); - return (error); - } - data[0] = DS1307_HOUR; - data[1] = hour & DS1307_HOUR_MASK; - error = ds1307_write(sc->sc_dev, sc->sc_addr, data, sizeof(data)); - if (error != 0) - device_printf(sc->sc_dev, "cannot write to RTC.\n"); - - return (error); -} - -static int ds1307_sqwe_sysctl(SYSCTL_HANDLER_ARGS) { int sqwe, error, newv, sqwe_bit; @@ -283,7 +226,7 @@ ds1307_probe(device_t dev) #else device_set_desc(dev, "Maxim DS1307 RTC"); - return (BUS_PROBE_DEFAULT); + return (BUS_PROBE_NOWILDCARD); #endif } @@ -294,13 +237,13 @@ ds1307_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_addr = iicbus_get_addr(dev); - sc->sc_year0 = 1900; sc->enum_hook.ich_func = ds1307_start; sc->enum_hook.ich_arg = dev; +#ifdef FDT if (ofw_bus_is_compatible(dev, "microchip,mcp7941x")) sc->sc_mcp7941x = 1; +#endif /* * We have to wait until interrupts are enabled. Usually I2C read @@ -312,6 +255,14 @@ ds1307_attach(device_t dev) return (0); } +static int +ds1307_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + static void ds1307_start(void *xdev) { @@ -320,6 +271,7 @@ ds1307_start(void *xdev) struct sysctl_ctx_list *ctx; struct sysctl_oid *tree_node; struct sysctl_oid_list *tree; + uint8_t secs; dev = (device_t)xdev; sc = device_get_softc(dev); @@ -328,12 +280,16 @@ ds1307_start(void *xdev) tree = SYSCTL_CHILDREN(tree_node); config_intrhook_disestablish(&sc->enum_hook); - /* Set the 24 hours mode. */ - if (ds1307_set_24hrs_mode(sc) != 0) + + /* Check if the oscillator is disabled. */ + if (ds1307_read1(sc->sc_dev, DS1307_SECS, &secs) != 0) { + device_printf(sc->sc_dev, "cannot read from RTC.\n"); return; - /* Enable the oscillator if halted. */ - if (ds1307_osc_enable(sc) != 0) - return; + } + if ((secs & DS1307_SECS_CH) != 0) { + device_printf(sc->sc_dev, + "WARNING: RTC clock stopped, check the battery.\n"); + } /* Configuration parameters. */ SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "sqwe", @@ -347,8 +303,13 @@ ds1307_start(void *xdev) CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0, ds1307_sqw_out_sysctl, "IU", "DS1307 square-wave output state"); - /* 1 second resolution. */ - clock_register(dev, 1000000); + /* + * Register as a clock with 1 second resolution. Schedule the + * clock_settime() method to be called just after top-of-second; + * resetting the time resets top-of-second in the hardware. + */ + clock_register_flags(dev, 1000000, CLOCKF_SETTIME_NO_ADJ); + clock_schedule(dev, 1); } static int @@ -357,56 +318,85 @@ ds1307_gettime(device_t dev, struct timespec *ts) int error; struct clocktime ct; struct ds1307_softc *sc; - uint8_t data[7]; + uint8_t data[7], hourmask; sc = device_get_softc(dev); - memset(data, 0, sizeof(data)); - error = ds1307_read(sc->sc_dev, sc->sc_addr, DS1307_SECS, - data, sizeof(data)); + error = iicdev_readfrom(sc->sc_dev, DS1307_SECS, data, sizeof(data), + IIC_INTRWAIT); if (error != 0) { device_printf(dev, "cannot read from RTC.\n"); return (error); } + + /* If the clock halted, we don't have good data. */ + if (data[DS1307_SECS] & DS1307_SECS_CH) + return (EINVAL); + + /* If chip is in AM/PM mode remember that. */ + if (data[DS1307_HOUR] & DS1307_HOUR_USE_AMPM) { + sc->sc_use_ampm = true; + hourmask = DS1307_HOUR_MASK_12HR; + } else + hourmask = DS1307_HOUR_MASK_24HR; + ct.nsec = 0; - ct.sec = FROMBCD(data[DS1307_SECS] & DS1307_SECS_MASK); - ct.min = FROMBCD(data[DS1307_MINS] & DS1307_MINS_MASK); - ct.hour = FROMBCD(data[DS1307_HOUR] & DS1307_HOUR_MASK); - ct.day = FROMBCD(data[DS1307_DATE] & DS1307_DATE_MASK); - ct.dow = data[DS1307_WEEKDAY] & DS1307_WEEKDAY_MASK; - ct.mon = FROMBCD(data[DS1307_MONTH] & DS1307_MONTH_MASK); - ct.year = FROMBCD(data[DS1307_YEAR] & DS1307_YEAR_MASK); - ct.year += sc->sc_year0; - if (ct.year < POSIX_BASE_YEAR) - ct.year += 100; /* assume [1970, 2069] */ + ct.sec = FROMBCD(data[DS1307_SECS] & DS1307_SECS_MASK); + ct.min = FROMBCD(data[DS1307_MINS] & DS1307_MINS_MASK); + ct.hour = FROMBCD(data[DS1307_HOUR] & hourmask); + ct.day = FROMBCD(data[DS1307_DATE] & DS1307_DATE_MASK); + ct.mon = FROMBCD(data[DS1307_MONTH] & DS1307_MONTH_MASK); + ct.year = FROMBCD(data[DS1307_YEAR] & DS1307_YEAR_MASK); + if (sc->sc_use_ampm) { + if (ct.hour == 12) + ct.hour = 0; + if (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) + ct.hour += 12; + } + return (clock_ct_to_ts(&ct, ts)); } static int ds1307_settime(device_t dev, struct timespec *ts) { - int error; struct clocktime ct; struct ds1307_softc *sc; - uint8_t data[8]; + int error; + uint8_t data[7]; + uint8_t pmflags; sc = device_get_softc(dev); - /* Accuracy is only one second. */ - if (ts->tv_nsec >= 500000000) - ts->tv_sec++; - ts->tv_nsec = 0; + + /* + * We request a timespec with no resolution-adjustment. That also + * disables utc adjustment, so apply that ourselves. + */ + ts->tv_sec -= utc_offset(); clock_ts_to_ct(ts, &ct); - memset(data, 0, sizeof(data)); - data[0] = DS1307_SECS; - data[DS1307_SECS + 1] = TOBCD(ct.sec); - data[DS1307_MINS + 1] = TOBCD(ct.min); - data[DS1307_HOUR + 1] = TOBCD(ct.hour); - data[DS1307_DATE + 1] = TOBCD(ct.day); - data[DS1307_WEEKDAY + 1] = ct.dow; - data[DS1307_MONTH + 1] = TOBCD(ct.mon); - data[DS1307_YEAR + 1] = TOBCD(ct.year % 100); + + /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ + if (sc->sc_use_ampm) { + pmflags = DS1307_HOUR_USE_AMPM; + if (ct.hour >= 12) { + ct.hour -= 12; + pmflags |= DS1307_HOUR_IS_PM; + } + if (ct.hour == 0) + ct.hour = 12; + } else + pmflags = 0; + + data[DS1307_SECS] = TOBCD(ct.sec); + data[DS1307_MINS] = TOBCD(ct.min); + data[DS1307_HOUR] = TOBCD(ct.hour) | pmflags; + data[DS1307_DATE] = TOBCD(ct.day); + data[DS1307_WEEKDAY] = ct.dow; + data[DS1307_MONTH] = TOBCD(ct.mon); + data[DS1307_YEAR] = TOBCD(ct.year % 100); /* Write the time back to RTC. */ - error = ds1307_write(dev, sc->sc_addr, data, sizeof(data)); + error = iicdev_writeto(sc->sc_dev, DS1307_SECS, data, sizeof(data), + IIC_INTRWAIT); if (error != 0) device_printf(dev, "cannot write to RTC.\n"); @@ -416,6 +406,7 @@ ds1307_settime(device_t dev, struct timespec *ts) static device_method_t ds1307_methods[] = { DEVMETHOD(device_probe, ds1307_probe), DEVMETHOD(device_attach, ds1307_attach), + DEVMETHOD(device_detach, ds1307_detach), DEVMETHOD(clock_gettime, ds1307_gettime), DEVMETHOD(clock_settime, ds1307_settime), Modified: stable/11/sys/dev/iicbus/ds1307reg.h ============================================================================== --- stable/11/sys/dev/iicbus/ds1307reg.h Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/dev/iicbus/ds1307reg.h Mon Sep 11 22:21:15 2017 (r323467) @@ -39,7 +39,10 @@ #define DS1307_MINS 0x01 #define DS1307_MINS_MASK 0x7f #define DS1307_HOUR 0x02 -#define DS1307_HOUR_MASK 0x3f +#define DS1307_HOUR_MASK_12HR 0x1f +#define DS1307_HOUR_MASK_24HR 0x3f +#define DS1307_HOUR_IS_PM 0x20 +#define DS1307_HOUR_USE_AMPM 0x40 #define DS1307_WEEKDAY 0x03 #define DS1307_WEEKDAY_MASK 0x07 #define DS1307_DATE 0x04 Copied and modified: stable/11/sys/dev/iicbus/ds13rtc.c (from r322473, head/sys/dev/iicbus/ds13rtc.c) ============================================================================== --- head/sys/dev/iicbus/ds13rtc.c Sun Aug 13 21:02:40 2017 (r322473, copy source) +++ stable/11/sys/dev/iicbus/ds13rtc.c Mon Sep 11 22:21:15 2017 (r323467) @@ -495,7 +495,7 @@ ds13rtc_get_chiptype(device_t dev) * We can only attach if provided a chiptype hint string. */ if (resource_string_value(device_get_name(dev), - device_get_unit(dev), "chiptype", &htype) != 0) + device_get_unit(dev), "compatible", &htype) != 0) return (TYPE_NONE); /* Modified: stable/11/sys/dev/iicbus/ds3231.c ============================================================================== --- stable/11/sys/dev/iicbus/ds3231.c Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/dev/iicbus/ds3231.c Mon Sep 11 22:21:15 2017 (r323467) @@ -62,29 +62,23 @@ struct ds3231_softc { uint16_t sc_addr; /* DS3231 slave address. */ uint8_t sc_ctrl; uint8_t sc_status; + bool sc_use_ampm; }; static void ds3231_start(void *); static int -ds3231_read(device_t dev, uint16_t addr, uint8_t reg, uint8_t *data, size_t len) +ds3231_read1(device_t dev, uint8_t reg, uint8_t *data) { - struct iic_msg msg[2] = { - { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, - { addr, IIC_M_RD, len, data }, - }; - return (iicbus_transfer(dev, msg, nitems(msg))); + return (iicdev_readfrom(dev, reg, data, 1, IIC_INTRWAIT)); } static int -ds3231_write(device_t dev, uint16_t addr, uint8_t *data, size_t len) +ds3231_write1(device_t dev, uint8_t reg, uint8_t data) { - struct iic_msg msg[1] = { - { addr, IIC_M_WR, len, data }, - }; - return (iicbus_transfer(dev, msg, nitems(msg))); + return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT)); } static int @@ -92,14 +86,11 @@ ds3231_ctrl_read(struct ds3231_softc *sc) { int error; - sc->sc_ctrl = 0; - error = ds3231_read(sc->sc_dev, sc->sc_addr, DS3231_CONTROL, - &sc->sc_ctrl, sizeof(sc->sc_ctrl)); + error = ds3231_read1(sc->sc_dev, DS3231_CONTROL, &sc->sc_ctrl); if (error) { device_printf(sc->sc_dev, "cannot read from RTC.\n"); return (error); } - return (0); } @@ -107,12 +98,11 @@ static int ds3231_ctrl_write(struct ds3231_softc *sc) { int error; - uint8_t data[2]; + uint8_t data; - data[0] = DS3231_CONTROL; /* Always enable the oscillator. Always disable both alarms. */ - data[1] = sc->sc_ctrl & ~DS3231_CTRL_MASK; - error = ds3231_write(sc->sc_dev, sc->sc_addr, data, sizeof(data)); + data = sc->sc_ctrl & ~DS3231_CTRL_MASK; + error = ds3231_write1(sc->sc_dev, DS3231_CONTROL, data); if (error != 0) device_printf(sc->sc_dev, "cannot write to RTC.\n"); @@ -124,9 +114,7 @@ ds3231_status_read(struct ds3231_softc *sc) { int error; - sc->sc_status = 0; - error = ds3231_read(sc->sc_dev, sc->sc_addr, DS3231_STATUS, - &sc->sc_status, sizeof(sc->sc_status)); + error = ds3231_read1(sc->sc_dev, DS3231_STATUS, &sc->sc_status); if (error) { device_printf(sc->sc_dev, "cannot read from RTC.\n"); return (error); @@ -139,15 +127,14 @@ static int ds3231_status_write(struct ds3231_softc *sc, int clear_a1, int clear_a2) { int error; - uint8_t data[2]; + uint8_t data; - data[0] = DS3231_STATUS; - data[1] = sc->sc_status; + data = sc->sc_status; if (clear_a1 == 0) - data[1] |= DS3231_STATUS_A1F; + data |= DS3231_STATUS_A1F; if (clear_a2 == 0) - data[1] |= DS3231_STATUS_A2F; - error = ds3231_write(sc->sc_dev, sc->sc_addr, data, sizeof(data)); + data |= DS3231_STATUS_A2F; + error = ds3231_write1(sc->sc_dev, DS3231_STATUS, data); if (error != 0) device_printf(sc->sc_dev, "cannot write to RTC.\n"); @@ -155,36 +142,14 @@ ds3231_status_write(struct ds3231_softc *sc, int clear } static int -ds3231_set_24hrs_mode(struct ds3231_softc *sc) -{ - int error; - uint8_t data[2], hour; - - hour = 0; - error = ds3231_read(sc->sc_dev, sc->sc_addr, DS3231_HOUR, - &hour, sizeof(hour)); - if (error) { - device_printf(sc->sc_dev, "cannot read from RTC.\n"); - return (error); - } - data[0] = DS3231_HOUR; - data[1] = hour & ~DS3231_C_MASK; - error = ds3231_write(sc->sc_dev, sc->sc_addr, data, sizeof(data)); - if (error != 0) - device_printf(sc->sc_dev, "cannot write to RTC.\n"); - - return (error); -} - -static int ds3231_temp_read(struct ds3231_softc *sc, int *temp) { int error, neg, t; uint8_t buf8[2]; uint16_t buf; - error = ds3231_read(sc->sc_dev, sc->sc_addr, DS3231_TEMP, - buf8, sizeof(buf8)); + error = iicdev_readfrom(sc->sc_dev, DS3231_TEMP, buf8, sizeof(buf8), + IIC_INTRWAIT); if (error != 0) return (error); buf = (buf8[0] << 8) | (buf8[1] & 0xff); @@ -426,6 +391,14 @@ ds3231_attach(device_t dev) return (0); } +static int +ds3231_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + static void ds3231_start(void *xdev) { @@ -446,20 +419,20 @@ ds3231_start(void *xdev) return; if (ds3231_status_read(sc) != 0) return; - /* Clear the OSF bit and ack any pending alarm interrupt. */ + /* + * Warn if the clock stopped, but don't restart it until the first + * clock_settime() call. + */ if (sc->sc_status & DS3231_STATUS_OSF) { device_printf(sc->sc_dev, - "oscillator has stopped, check the battery.\n"); - sc->sc_status &= ~DS3231_STATUS_OSF; + "WARNING: RTC clock stopped, check the battery.\n"); } + /* Ack any pending alarm interrupt. */ if (ds3231_status_write(sc, 1, 1) != 0) return; /* Always enable the oscillator. */ if (ds3231_ctrl_write(sc) != 0) return; - /* Set the 24 hours mode. */ - if (ds3231_set_24hrs_mode(sc) != 0) - return; /* Temperature. */ SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "temperature", @@ -485,8 +458,13 @@ ds3231_start(void *xdev) CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0, ds3231_en32khz_sysctl, "IU", "DS3231 enable the 32kHz output"); - /* 1 second resolution. */ - clock_register(dev, 1000000); + /* + * Register as a clock with 1 second resolution. Schedule the + * clock_settime() method to be called just after top-of-second; + * resetting the time resets top-of-second in the hardware. + */ + clock_register_flags(dev, 1000000, CLOCKF_SETTIME_NO_ADJ); + clock_schedule(dev, 1); } static int @@ -495,24 +473,45 @@ ds3231_gettime(device_t dev, struct timespec *ts) int c, error; struct clocktime ct; struct ds3231_softc *sc; - uint8_t data[7]; + uint8_t data[7], hourmask; sc = device_get_softc(dev); - memset(data, 0, sizeof(data)); - error = ds3231_read(sc->sc_dev, sc->sc_addr, DS3231_SECS, - data, sizeof(data)); + + /* If the clock halted, we don't have good data. */ + if ((error = ds3231_status_read(sc)) != 0) { + device_printf(dev, "cannot read from RTC.\n"); + return (error); + } + if (sc->sc_status & DS3231_STATUS_OSF) + return (EINVAL); + + error = iicdev_readfrom(sc->sc_dev, DS3231_SECS, data, sizeof(data), + IIC_INTRWAIT); if (error != 0) { device_printf(dev, "cannot read from RTC.\n"); return (error); } + + /* If chip is in AM/PM mode remember that. */ + if (data[DS3231_HOUR] & DS3231_HOUR_USE_AMPM) { + sc->sc_use_ampm = true; + hourmask = DS3231_HOUR_MASK_12HR; + } else + hourmask = DS3231_HOUR_MASK_24HR; + ct.nsec = 0; - ct.sec = FROMBCD(data[DS3231_SECS] & DS3231_SECS_MASK); - ct.min = FROMBCD(data[DS3231_MINS] & DS3231_MINS_MASK); - ct.hour = FROMBCD(data[DS3231_HOUR] & DS3231_HOUR_MASK); - ct.day = FROMBCD(data[DS3231_DATE] & DS3231_DATE_MASK); - ct.dow = data[DS3231_WEEKDAY] & DS3231_WEEKDAY_MASK; - ct.mon = FROMBCD(data[DS3231_MONTH] & DS3231_MONTH_MASK); - ct.year = FROMBCD(data[DS3231_YEAR] & DS3231_YEAR_MASK); + ct.sec = FROMBCD(data[DS3231_SECS] & DS3231_SECS_MASK); + ct.min = FROMBCD(data[DS3231_MINS] & DS3231_MINS_MASK); + ct.hour = FROMBCD(data[DS3231_HOUR] & hourmask); + ct.day = FROMBCD(data[DS3231_DATE] & DS3231_DATE_MASK); + ct.mon = FROMBCD(data[DS3231_MONTH] & DS3231_MONTH_MASK); + ct.year = FROMBCD(data[DS3231_YEAR] & DS3231_YEAR_MASK); + + /* + * If the century flag has toggled since we last saw it, there has been + * a century rollover. If this is the first time we're seeing it, + * remember the state so we can preserve its polarity on writes. + */ c = (data[DS3231_MONTH] & DS3231_C_MASK) ? 1 : 0; if (sc->sc_last_c == -1) sc->sc_last_c = c; @@ -524,6 +523,14 @@ ds3231_gettime(device_t dev, struct timespec *ts) if (ct.year < POSIX_BASE_YEAR) ct.year += 100; /* assume [1970, 2069] */ + /* If running in AM/PM mode, deal with it. */ + if (sc->sc_use_ampm) { + if (ct.hour == 12) + ct.hour = 0; + if (data[DS3231_HOUR] & DS3231_HOUR_IS_PM) + ct.hour += 12; + } + return (clock_ct_to_ts(&ct, ts)); } @@ -533,36 +540,71 @@ ds3231_settime(device_t dev, struct timespec *ts) int error; struct clocktime ct; struct ds3231_softc *sc; - uint8_t data[8]; + uint8_t data[7]; + uint8_t pmflags; sc = device_get_softc(dev); - /* Accuracy is only one second. */ - if (ts->tv_nsec >= 500000000) - ts->tv_sec++; - ts->tv_nsec = 0; + + /* + * We request a timespec with no resolution-adjustment. That also + * disables utc adjustment, so apply that ourselves. + */ + ts->tv_sec -= utc_offset(); clock_ts_to_ct(ts, &ct); - memset(data, 0, sizeof(data)); - data[0] = DS3231_SECS; - data[DS3231_SECS + 1] = TOBCD(ct.sec); - data[DS3231_MINS + 1] = TOBCD(ct.min); - data[DS3231_HOUR + 1] = TOBCD(ct.hour); - data[DS3231_DATE + 1] = TOBCD(ct.day); - data[DS3231_WEEKDAY + 1] = ct.dow; - data[DS3231_MONTH + 1] = TOBCD(ct.mon); - data[DS3231_YEAR + 1] = TOBCD(ct.year % 100); + + /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ + if (sc->sc_use_ampm) { + pmflags = DS3231_HOUR_USE_AMPM; + if (ct.hour >= 12) { + ct.hour -= 12; + pmflags |= DS3231_HOUR_IS_PM; + } + if (ct.hour == 0) + ct.hour = 12; + } else + pmflags = 0; + + data[DS3231_SECS] = TOBCD(ct.sec); + data[DS3231_MINS] = TOBCD(ct.min); + data[DS3231_HOUR] = TOBCD(ct.hour) | pmflags; + data[DS3231_DATE] = TOBCD(ct.day); + data[DS3231_WEEKDAY] = ct.dow; + data[DS3231_MONTH] = TOBCD(ct.mon); + data[DS3231_YEAR] = TOBCD(ct.year % 100); if (sc->sc_last_c) data[DS3231_MONTH] |= DS3231_C_MASK; + /* Write the time back to RTC. */ - error = ds3231_write(dev, sc->sc_addr, data, sizeof(data)); - if (error != 0) + error = iicdev_writeto(dev, DS3231_SECS, data, sizeof(data), + IIC_INTRWAIT); + if (error != 0) { device_printf(dev, "cannot write to RTC.\n"); + return (error); + } + /* + * Unlike most hardware, the osc-was-stopped bit does not clear itself + * after setting the time, it has to be manually written to zero. + */ + if (sc->sc_status & DS3231_STATUS_OSF) { + if ((error = ds3231_status_read(sc)) != 0) { + device_printf(dev, "cannot read from RTC.\n"); + return (error); + } + sc->sc_status &= ~DS3231_STATUS_OSF; + if ((error = ds3231_status_write(sc, 0, 0)) != 0) { + device_printf(dev, "cannot write to RTC.\n"); + return (error); + } + } + return (error); } static device_method_t ds3231_methods[] = { DEVMETHOD(device_probe, ds3231_probe), DEVMETHOD(device_attach, ds3231_attach), + DEVMETHOD(device_detach, ds3231_detach), DEVMETHOD(clock_gettime, ds3231_gettime), DEVMETHOD(clock_settime, ds3231_settime), Modified: stable/11/sys/dev/iicbus/ds3231reg.h ============================================================================== --- stable/11/sys/dev/iicbus/ds3231reg.h Mon Sep 11 22:18:01 2017 (r323466) +++ stable/11/sys/dev/iicbus/ds3231reg.h Mon Sep 11 22:21:15 2017 (r323467) @@ -38,7 +38,10 @@ #define DS3231_MINS 0x01 #define DS3231_MINS_MASK 0x7f #define DS3231_HOUR 0x02 -#define DS3231_HOUR_MASK 0x3f +#define DS3231_HOUR_MASK_12HR 0x3f +#define DS3231_HOUR_MASK_24HR 0x1f +#define DS3231_HOUR_IS_PM 0x20 +#define DS3231_HOUR_USE_AMPM 0x40 #define DS3231_WEEKDAY 0x03 #define DS3231_WEEKDAY_MASK 0x07 #define DS3231_DATE 0x04 Copied: stable/11/sys/dev/iicbus/isl12xx.c (from r321841, head/sys/dev/iicbus/isl12xx.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/iicbus/isl12xx.c Mon Sep 11 22:21:15 2017 (r323467, copy of r321841, head/sys/dev/iicbus/isl12xx.c) @@ -0,0 +1,354 @@ +/*- + * Copyright (c) 2017 Ian Lepore. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for ISL12xx family i2c realtime clocks: + * - ISL1209 = 2B sram, tamper/event timestamp + * - ISL1218 = 8B sram, DS13xx pin compatible (but not software compatible) + * - ISL1219 = 2B sram, tamper/event timestamp + * - ISL1220 = 8B sram, separate Fout + * - ISL1221 = 2B sram, separate Fout, tamper/event timestamp + * + * This driver supports only the basic RTC functionality in all these chips. + */ + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#endif + +#include +#include + +#include "clock_if.h" +#include "iicbus_if.h" + +/* + * All register and bit names as found in the datasheet. When a bit name ends + * in 'B' that stands for "bar" and it is an active-low signal; something named + * "EVENB" implies 1=event-disable, 0=event-enable. + */ + +#define ISL12XX_SC_REG 0x00 /* RTC Seconds */ + +#define ISL12XX_SR_REG 0x07 /* Status */ +#define ISL12XX_SR_ARST (1u << 7) /* Auto-reset on status read */ +#define ISL12XX_SR_XTOSCB (1u << 5) /* Osc disable (use ext osc) */ +#define ISL12XX_SR_WRTC (1u << 4) /* Write RTC enable */ +#define ISL12XX_SR_EVT (1u << 3) /* Event occurred (w0c) */ +#define ISL12XX_SR_ALM (1u << 2) /* Alarm occurred (w0c) */ +#define ISL12XX_SR_BAT (1u << 1) /* Running on battery (w0c) */ +#define ISL12XX_SR_RTCF (1u << 0) /* RTC fail (power loss) */ +#define ISL12XX_SR_W0C_BITS (ISL12XX_SR_BAT | ISL12XX_SR_ALM | ISL12XX_SR_EVT) + +#define ISL12XX_INT_REG 0x08 /* Interrupts */ +#define ISL12XX_INT_IM (1u << 7) /* Alarm interrupt mode */ +#define ISL12XX_INT_ALME (1u << 6) /* Alarm enable */ +#define ISL12XX_INT_LPMODE (1u << 5) /* Low Power mode */ +#define ISL12XX_INT_FOBATB (1u << 4) /* Fout/IRQ disabled on bat */ +#define ISL12XX_INT_FO_SHIFT 0 /* Frequency output select */ +#define ISL12XX_INT_FO_MASK 0x0f /* shift and mask. */ + +#define ISL12XX_EV_REG 0x09 /* Event */ +#define ISL12XX_EV_EVIENB (1u << 7) /* Disable internal pullup */ +#define ISL12XX_EV_EVBATB (1u << 6) /* Disable ev detect on bat */ +#define ISL12XX_EV_RTCHLT (1u << 5) /* Halt RTC on event */ +#define ISL12XX_EV_EVEN (1u << 4) /* Event detect enable */ +#define ISL12XX_EV_EHYS_SHIFT 2 /* Event input hysteresis */ +#define ISL12XX_EV_EHYS_MASK 0x03 /* selection; see datasheet */ +#define ISL12XX_EV_ESMP_SHIFT 0 /* Event input sample rate */ +#define ISL12XX_EV_ESMP_MASK 0x03 /* selection; see datasheet */ + +#define ISL12XX_ATR_REG 0x0a /* Analog trim (osc adjust) */ + +#define ISL12XX_DTR_REG 0x0b /* Digital trim (osc adjust) */ + +#define ISL12XX_SCA_REG 0x0c /* Alarm seconds */ + +#define ISL12XX_USR1_REG 0x12 /* User byte 1 */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Sep 11 22:28:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05AB7E03826; Mon, 11 Sep 2017 22:28:40 +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 C5232759B5; Mon, 11 Sep 2017 22:28:39 +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 v8BMSdg3065616; Mon, 11 Sep 2017 22:28:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMScMV065607; Mon, 11 Sep 2017 22:28:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112228.v8BMScMV065607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323468 - in stable/11/sys/arm: conf freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys/arm: conf freescale/imx X-SVN-Commit-Revision: 323468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:28:40 -0000 Author: ian Date: Mon Sep 11 22:28:38 2017 New Revision: 323468 URL: https://svnweb.freebsd.org/changeset/base/323468 Log: MFC r321938, r322015 r321938: Fix the interface to imx_iomux_gpr_get/set(). The functions were defined as taking a register number, and that would get multiplied by 4 to make a register address. But the header file that consumers have to reference this stuff publishes register addresses, not numbers. So now everything works in terms of register addresses. Note that the HDMI init code was writing into the wrong register before this change. Apparently whatever it wrote to was harmless, and apparently HDMI was working because uboot had set up the right bits. r322015: Add an ahci driver for imx6. This was submitted by Rogiel Sulzbach (thank you!) but has a few last-minute changes by me, mostly where the code interfaces to my still-utterly-deficient imx6_ccm clocks implementation. So blame me for any mistakes. Submitted by: Rogiel Sulzbach Differential Revision: https://reviews.freebsd.org/D11177 Added: stable/11/sys/arm/freescale/imx/imx6_ahci.c - copied unchanged from r322015, head/sys/arm/freescale/imx/imx6_ahci.c Modified: stable/11/sys/arm/conf/IMX6 stable/11/sys/arm/freescale/imx/files.imx6 stable/11/sys/arm/freescale/imx/imx6_ccm.c stable/11/sys/arm/freescale/imx/imx6_ccmreg.h stable/11/sys/arm/freescale/imx/imx_ccmvar.h stable/11/sys/arm/freescale/imx/imx_iomux.c stable/11/sys/arm/freescale/imx/imx_iomuxreg.h stable/11/sys/arm/freescale/imx/imx_iomuxvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/IMX6 ============================================================================== --- stable/11/sys/arm/conf/IMX6 Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/conf/IMX6 Mon Sep 11 22:28:38 2017 (r323468) @@ -78,6 +78,9 @@ device da # Direct Access (disks) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) +# ATA controllers +device ahci # AHCI-compatible SATA controllers + # USB support device ehci # OHCI USB interface device usb # USB Bus (required) Modified: stable/11/sys/arm/freescale/imx/files.imx6 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx6 Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/files.imx6 Mon Sep 11 22:28:38 2017 (r323468) @@ -25,6 +25,7 @@ arm/freescale/imx/imx_i2c.c optional fsliic arm/freescale/imx/imx6_sdma.c optional sdma arm/freescale/imx/imx6_audmux.c optional sound arm/freescale/imx/imx6_ssi.c optional sound +arm/freescale/imx/imx6_ahci.c optional ahci arm/arm/hdmi_if.m optional hdmi arm/freescale/imx/imx6_hdmi.c optional hdmi Copied: stable/11/sys/arm/freescale/imx/imx6_ahci.c (from r322015, head/sys/arm/freescale/imx/imx6_ahci.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/freescale/imx/imx6_ahci.c Mon Sep 11 22:28:38 2017 (r323468, copy of r322015, head/sys/arm/freescale/imx/imx6_ahci.c) @@ -0,0 +1,358 @@ +/*- + * Copyright (c) 2017 Rogiel Sulzbach + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#define SATA_TIMER1MS 0x000000e0 + +#define SATA_P0PHYCR 0x00000178 +#define SATA_P0PHYCR_CR_READ (1 << 19) +#define SATA_P0PHYCR_CR_WRITE (1 << 18) +#define SATA_P0PHYCR_CR_CAP_DATA (1 << 17) +#define SATA_P0PHYCR_CR_CAP_ADDR (1 << 16) +#define SATA_P0PHYCR_CR_DATA_IN(v) ((v) & 0xffff) + +#define SATA_P0PHYSR 0x0000017c +#define SATA_P0PHYSR_CR_ACK (1 << 18) +#define SATA_P0PHYSR_CR_DATA_OUT(v) ((v) & 0xffff) + +/* phy registers */ +#define SATA_PHY_CLOCK_RESET 0x7f3f +#define SATA_PHY_CLOCK_RESET_RST (1 << 0) + +#define SATA_PHY_LANE0_OUT_STAT 0x2003 +#define SATA_PHY_LANE0_OUT_STAT_RX_PLL_STATE (1 << 1) + +static int +imx6_ahci_phy_ctrl(struct ahci_controller* sc, uint32_t bitmask, bool on) +{ + uint32_t v; + int timeout; + bool state; + + v = ATA_INL(sc->r_mem, SATA_P0PHYCR); + if (on) { + v |= bitmask; + } else { + v &= ~bitmask; + } + ATA_OUTL(sc->r_mem, SATA_P0PHYCR, v); + + for (timeout = 5000; timeout > 0; --timeout) { + v = ATA_INL(sc->r_mem, SATA_P0PHYSR); + state = (v & SATA_P0PHYSR_CR_ACK) == SATA_P0PHYSR_CR_ACK; + if(state == on) { + break; + } + DELAY(100); + } + + if (timeout > 0) { + return (0); + } + + return (ETIMEDOUT); +} + +static int +imx6_ahci_phy_addr(struct ahci_controller* sc, uint32_t addr) +{ + int error; + + DELAY(100); + + ATA_OUTL(sc->r_mem, SATA_P0PHYCR, addr); + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_CAP_ADDR, true); + if (error != 0) { + device_printf(sc->dev, + "%s: timeout on SATA_P0PHYCR_CR_CAP_ADDR=1\n", + __FUNCTION__); + return (error); + } + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_CAP_ADDR, false); + if (error != 0) { + device_printf(sc->dev, + "%s: timeout on SATA_P0PHYCR_CR_CAP_ADDR=0\n", + __FUNCTION__); + return (error); + } + + return (0); +} + +static int +imx6_ahci_phy_write(struct ahci_controller* sc, uint32_t addr, + uint16_t data) +{ + int error; + + error = imx6_ahci_phy_addr(sc, addr); + if (error != 0) { + device_printf(sc->dev, "%s: error on imx6_ahci_phy_addr\n", + __FUNCTION__); + return (error); + } + + ATA_OUTL(sc->r_mem, SATA_P0PHYCR, data); + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_CAP_DATA, true); + if (error != 0) { + device_printf(sc->dev, + "%s: error on SATA_P0PHYCR_CR_CAP_DATA=1\n", __FUNCTION__); + return (error); + } + if (imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_CAP_DATA, false) != 0) { + device_printf(sc->dev, + "%s: error on SATA_P0PHYCR_CR_CAP_DATA=0\n", __FUNCTION__); + return (error); + } + + if ((addr == SATA_PHY_CLOCK_RESET) && data) { + /* we can't check ACK after RESET */ + ATA_OUTL(sc->r_mem, SATA_P0PHYCR, + SATA_P0PHYCR_CR_DATA_IN(data) | SATA_P0PHYCR_CR_WRITE); + return (0); + } + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_WRITE, true); + if (error != 0) { + device_printf(sc->dev, "%s: error on SATA_P0PHYCR_CR_WRITE=1\n", + __FUNCTION__); + return (error); + } + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_WRITE, false); + if (error != 0) { + device_printf(sc->dev, "%s: error on SATA_P0PHYCR_CR_WRITE=0\n", + __FUNCTION__); + return (error); + } + + return (0); +} + +static int +imx6_ahci_phy_read(struct ahci_controller* sc, uint32_t addr, uint16_t* val) +{ + int error; + uint32_t v; + + error = imx6_ahci_phy_addr(sc, addr); + if (error != 0) { + device_printf(sc->dev, "%s: error on imx6_ahci_phy_addr\n", + __FUNCTION__); + return (error); + } + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_READ, true); + if (error != 0) { + device_printf(sc->dev, "%s: error on SATA_P0PHYCR_CR_READ=1\n", + __FUNCTION__); + return (error); + } + + v = ATA_INL(sc->r_mem, SATA_P0PHYSR); + + error = imx6_ahci_phy_ctrl(sc, SATA_P0PHYCR_CR_READ, false); + if (error != 0) { + device_printf(sc->dev, "%s: error on SATA_P0PHYCR_CR_READ=0\n", + __FUNCTION__); + return (error); + } + + *val = SATA_P0PHYSR_CR_DATA_OUT(v); + return (0); +} + +static int +imx6_ahci_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) { + return (ENXIO); + } + + if (!ofw_bus_is_compatible(dev, "fsl,imx6q-ahci")) { + return (ENXIO); + } + device_set_desc(dev, "i.MX6 Integrated AHCI controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +imx6_ahci_attach(device_t dev) +{ + struct ahci_controller* ctlr; + uint16_t pllstat; + uint32_t v; + int error, timeout; + + ctlr = device_get_softc(dev); + + /* Power up the controller and phy. */ + error = imx6_ccm_sata_enable(); + if (error != 0) { + device_printf(dev, "error enabling controller and phy\n"); + return (error); + } + + ctlr->vendorid = 0; + ctlr->deviceid = 0; + ctlr->subvendorid = 0; + ctlr->subdeviceid = 0; + ctlr->numirqs = 1; + ctlr->r_rid = 0; + if ((ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &ctlr->r_rid, RF_ACTIVE)) == NULL) { + return (ENXIO); + } + + v = imx_iomux_gpr_get(IOMUX_GPR13); + /* Clear out existing values; these numbers are bitmasks. */ + v &= ~(IOMUX_GPR13_SATA_PHY_8(7) | + IOMUX_GPR13_SATA_PHY_7(0x1f) | + IOMUX_GPR13_SATA_PHY_6(7) | + IOMUX_GPR13_SATA_SPEED(1) | + IOMUX_GPR13_SATA_PHY_5(1) | + IOMUX_GPR13_SATA_PHY_4(7) | + IOMUX_GPR13_SATA_PHY_3(0xf) | + IOMUX_GPR13_SATA_PHY_2(0x1f) | + IOMUX_GPR13_SATA_PHY_1(1) | + IOMUX_GPR13_SATA_PHY_0(1)); + /* setting */ + v |= IOMUX_GPR13_SATA_PHY_8(5) | /* Rx 3.0db */ + IOMUX_GPR13_SATA_PHY_7(0x12) | /* Rx SATA2m */ + IOMUX_GPR13_SATA_PHY_6(3) | /* Rx DPLL mode */ + IOMUX_GPR13_SATA_SPEED(1) | /* 3.0GHz */ + IOMUX_GPR13_SATA_PHY_5(0) | /* SpreadSpectram */ + IOMUX_GPR13_SATA_PHY_4(4) | /* Tx Attenuation 9/16 */ + IOMUX_GPR13_SATA_PHY_3(0) | /* Tx Boost 0db */ + IOMUX_GPR13_SATA_PHY_2(0x11) | /* Tx Level 1.104V */ + IOMUX_GPR13_SATA_PHY_1(1); /* PLL clock enable */ + imx_iomux_gpr_set(IOMUX_GPR13, v); + + /* phy reset */ + error = imx6_ahci_phy_write(ctlr, SATA_PHY_CLOCK_RESET, + SATA_PHY_CLOCK_RESET_RST); + if (error != 0) { + device_printf(dev, "cannot reset PHY\n"); + goto fail; + } + + for (timeout = 50; timeout > 0; --timeout) { + DELAY(100); + error = imx6_ahci_phy_read(ctlr, SATA_PHY_LANE0_OUT_STAT, + &pllstat); + if (error != 0) { + device_printf(dev, "cannot read LANE0 status\n"); + goto fail; + } + if (pllstat & SATA_PHY_LANE0_OUT_STAT_RX_PLL_STATE) { + break; + } + } + if (timeout <= 0) { + device_printf(dev, "time out reading LANE0 status\n"); + error = ETIMEDOUT; + goto fail; + } + + /* Support Staggered Spin-up */ + v = ATA_INL(ctlr->r_mem, AHCI_CAP); + ATA_OUTL(ctlr->r_mem, AHCI_CAP, v | AHCI_CAP_SSS); + + /* Ports Implemented. must set 1 */ + v = ATA_INL(ctlr->r_mem, AHCI_PI); + ATA_OUTL(ctlr->r_mem, AHCI_PI, v | (1 << 0)); + + /* set 1ms-timer = AHB clock / 1000 */ + ATA_OUTL(ctlr->r_mem, SATA_TIMER1MS, + imx_ccm_ahb_hz() / 1000); + + /* + * Note: ahci_attach will release ctlr->r_mem on errors automatically + */ + return (ahci_attach(dev)); + +fail: + bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); + return (error); +} + +static int +imx6_ahci_detach(device_t dev) +{ + + return (ahci_detach(dev)); +} + +devclass_t ahci_devclass; + +static device_method_t imx6_ahci_ata_methods[] = { + /* device probe, attach and detach methods */ + DEVMETHOD(device_probe, imx6_ahci_probe), + DEVMETHOD(device_attach, imx6_ahci_attach), + DEVMETHOD(device_detach, imx6_ahci_detach), + + /* ahci bus methods */ + DEVMETHOD(bus_print_child, ahci_print_child), + DEVMETHOD(bus_alloc_resource, ahci_alloc_resource), + DEVMETHOD(bus_release_resource, ahci_release_resource), + DEVMETHOD(bus_setup_intr, ahci_setup_intr), + DEVMETHOD(bus_teardown_intr, ahci_teardown_intr), + DEVMETHOD(bus_child_location_str, ahci_child_location_str), + + DEVMETHOD_END +}; + +static driver_t ahci_ata_driver = { + "ahci", + imx6_ahci_ata_methods, + sizeof(struct ahci_controller) +}; + +DRIVER_MODULE(ahci, simplebus, ahci_ata_driver, ahci_devclass, 0, 0); Modified: stable/11/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccm.c Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/imx6_ccm.c Mon Sep 11 22:28:38 2017 (r323468) @@ -314,6 +314,41 @@ imx_ccm_usbphy_enable(device_t _phydev) #endif } +int +imx6_ccm_sata_enable(void) +{ + uint32_t v; + int timeout; + + /* Un-gate the sata controller. */ + WR4(ccm_sc, CCM_CCGR5, RD4(ccm_sc, CCM_CCGR5) | CCGR5_SATA); + + /* Power up the PLL that feeds ENET/SATA/PCI phys, wait for lock. */ + v = RD4(ccm_sc, CCM_ANALOG_PLL_ENET); + v &= ~CCM_ANALOG_PLL_ENET_POWERDOWN; + WR4(ccm_sc, CCM_ANALOG_PLL_ENET, v); + + for (timeout = 100000; timeout > 0; timeout--) { + if (RD4(ccm_sc, CCM_ANALOG_PLL_ENET) & + CCM_ANALOG_PLL_ENET_LOCK) { + break; + } + } + if (timeout <= 0) { + return ETIMEDOUT; + } + + /* Enable the PLL, and enable its 100mhz output. */ + v |= CCM_ANALOG_PLL_ENET_ENABLE; + v &= ~CCM_ANALOG_PLL_ENET_BYPASS; + WR4(ccm_sc, CCM_ANALOG_PLL_ENET, v); + + v |= CCM_ANALOG_PLL_ENET_ENABLE_100M; + WR4(ccm_sc, CCM_ANALOG_PLL_ENET, v); + + return 0; +} + uint32_t imx_ccm_ipg_hz(void) { Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Mon Sep 11 22:28:38 2017 (r323468) @@ -116,6 +116,7 @@ #define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) #define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) #define CCM_CCGR5 0x07C +#define CCGR5_SATA (0x3 << 4) #define CCGR5_SDMA (0x3 << 6) #define CCGR5_SSI1 (0x3 << 18) #define CCGR5_SSI2 (0x3 << 20) @@ -129,5 +130,12 @@ #define CCGR6_USDHC3 (0x3 << 6) #define CCGR6_USDHC4 (0x3 << 8) #define CCM_CMEOR 0x088 + +#define CCM_ANALOG_PLL_ENET 0x000040e0 +#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) +#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ +#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) +#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ +#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) #endif Modified: stable/11/sys/arm/freescale/imx/imx_ccmvar.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_ccmvar.h Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/imx_ccmvar.h Mon Sep 11 22:28:38 2017 (r323468) @@ -54,6 +54,7 @@ void imx_ccm_usbphy_enable(device_t _phydev); void imx_ccm_ssi_configure(device_t _ssidev); void imx_ccm_hdmi_enable(void); void imx_ccm_ipu_enable(int ipu); +int imx6_ccm_sata_enable(void); /* Routines to get and set the arm clock root divisor register. */ uint32_t imx_ccm_get_cacrr(void); Modified: stable/11/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_iomux.c Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/imx_iomux.c Mon Sep 11 22:28:38 2017 (r323468) @@ -71,7 +71,7 @@ struct iomux_softc { device_t dev; struct resource *mem_res; - u_int last_gpreg; + u_int last_gpregaddr; }; static struct iomux_softc *iomux_sc; @@ -214,19 +214,19 @@ iomux_attach(device_t dev) switch (imx_soc_type()) { case IMXSOC_51: - sc->last_gpreg = 1; + sc->last_gpregaddr = 1 * sizeof(uint32_t); break; case IMXSOC_53: - sc->last_gpreg = 2; + sc->last_gpregaddr = 2 * sizeof(uint32_t); break; case IMXSOC_6DL: case IMXSOC_6S: case IMXSOC_6SL: case IMXSOC_6Q: - sc->last_gpreg = 13; + sc->last_gpregaddr = 13 * sizeof(uint32_t); break; case IMXSOC_6UL: - sc->last_gpreg = 14; + sc->last_gpregaddr = 14 * sizeof(uint32_t); break; default: device_printf(dev, "Unknown SoC type\n"); @@ -262,45 +262,48 @@ iomux_attach(device_t dev) } uint32_t -imx_iomux_gpr_get(u_int regnum) +imx_iomux_gpr_get(u_int regaddr) { struct iomux_softc * sc; sc = iomux_sc; KASSERT(sc != NULL, ("%s called before attach", __FUNCTION__)); - KASSERT(regnum >= 0 && regnum <= sc->last_gpreg, - ("%s bad regnum %u, max %u", __FUNCTION__, regnum, sc->last_gpreg)); + KASSERT(regaddr >= 0 && regaddr <= sc->last_gpregaddr, + ("%s bad regaddr %u, max %u", __FUNCTION__, regaddr, + sc->last_gpregaddr)); - return (RD4(iomux_sc, regnum * 4)); + return (RD4(iomux_sc, regaddr)); } void -imx_iomux_gpr_set(u_int regnum, uint32_t val) +imx_iomux_gpr_set(u_int regaddr, uint32_t val) { struct iomux_softc * sc; sc = iomux_sc; KASSERT(sc != NULL, ("%s called before attach", __FUNCTION__)); - KASSERT(regnum >= 0 && regnum <= sc->last_gpreg, - ("%s bad regnum %u, max %u", __FUNCTION__, regnum, sc->last_gpreg)); + KASSERT(regaddr >= 0 && regaddr <= sc->last_gpregaddr, + ("%s bad regaddr %u, max %u", __FUNCTION__, regaddr, + sc->last_gpregaddr)); - WR4(iomux_sc, regnum * 4, val); + WR4(iomux_sc, regaddr, val); } void -imx_iomux_gpr_set_masked(u_int regnum, uint32_t clrbits, uint32_t setbits) +imx_iomux_gpr_set_masked(u_int regaddr, uint32_t clrbits, uint32_t setbits) { struct iomux_softc * sc; uint32_t val; sc = iomux_sc; KASSERT(sc != NULL, ("%s called before attach", __FUNCTION__)); - KASSERT(regnum >= 0 && regnum <= sc->last_gpreg, - ("%s bad regnum %u, max %u", __FUNCTION__, regnum, sc->last_gpreg)); + KASSERT(regaddr >= 0 && regaddr <= sc->last_gpregaddr, + ("%s bad regaddr %u, max %u", __FUNCTION__, regaddr, + sc->last_gpregaddr)); - val = RD4(iomux_sc, regnum * 4); + val = RD4(iomux_sc, regaddr * 4); val = (val & ~clrbits) | setbits; - WR4(iomux_sc, regnum * 4, val); + WR4(iomux_sc, regaddr, val); } static device_method_t imx_iomux_methods[] = { Modified: stable/11/sys/arm/freescale/imx/imx_iomuxreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_iomuxreg.h Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/imx_iomuxreg.h Mon Sep 11 22:28:38 2017 (r323468) @@ -29,14 +29,33 @@ #ifndef IMX_IOMUXREG_H #define IMX_IOMUXREG_H -#define IOMUXC_GPR0 0x00 -#define IOMUXC_GPR1 0x04 -#define IOMUXC_GPR2 0x08 -#define IOMUXC_GPR3 0x0C -#define IOMUXC_GPR3_HDMI_MASK (3 << 2) -#define IOMUXC_GPR3_HDMI_IPU1_DI0 (0 << 2) -#define IOMUXC_GPR3_HDMI_IPU1_DI1 (1 << 2) -#define IOMUXC_GPR3_HDMI_IPU2_DI0 (2 << 2) -#define IOMUXC_GPR3_HDMI_IPU2_DI1 (3 << 2) +#define IMX_IOMUXREG_LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask)) +#define IMX_IOMUXREG_SHIFTIN(__x, __mask) ((__x) * IMX_IOMUXREG_LOWEST_SET_BIT(__mask)) + +#define IMX_IOMUXREG_BIT(n) (1 << (n)) +#define IMX_IOMUXREG_BITS(__m, __n) \ + ((IMX_IOMUXREG_BIT(MAX((__m), (__n)) + 1) - 1) ^ (IMX_IOMUXREG_BIT(MIN((__m), (__n))) - 1)) + +#define IOMUXC_GPR0 0x00 +#define IOMUXC_GPR1 0x04 +#define IOMUXC_GPR2 0x08 +#define IOMUXC_GPR3 0x0C +#define IOMUXC_GPR3_HDMI_MASK (3 << 2) +#define IOMUXC_GPR3_HDMI_IPU1_DI0 (0 << 2) +#define IOMUXC_GPR3_HDMI_IPU1_DI1 (1 << 2) +#define IOMUXC_GPR3_HDMI_IPU2_DI0 (2 << 2) +#define IOMUXC_GPR3_HDMI_IPU2_DI1 (3 << 2) + +#define IOMUX_GPR13 0x34 +#define IOMUX_GPR13_SATA_PHY_8(n) IMX_IOMUXREG_SHIFTIN(n, IMX_IOMUXREG_BITS(26, 24)) +#define IOMUX_GPR13_SATA_PHY_7(n) IMX_IOMUXREG_SHIFTIN(n, IMX_IOMUXREG_BITS(23, 19)) +#define IOMUX_GPR13_SATA_PHY_6(n) IMX_IOMUXREG_SHIFTIN(n, IMX_IOMUXREG_BITS(18, 16)) +#define IOMUX_GPR13_SATA_SPEED(n) IMX_IOMUXREG_SHIFTIN(n, (1 << 15)) +#define IOMUX_GPR13_SATA_PHY_5(n) IMX_IOMUXREG_SHIFTIN(n, (1 << 14)) +#define IOMUX_GPR13_SATA_PHY_4(n) IMX_IOMUXREG_SHIFTIN(n, IMX_IOMUXREG_BITS(13, 11)) +#define IOMUX_GPR13_SATA_PHY_3(n) IMX_IOMUXREG_SHIFTIN(n, IMX_IOMUXREG_BITS(10, 7)) +#define IOMUX_GPR13_SATA_PHY_2(n) IMX_IOMUXREG_SHIFTIN(n, IMX_IOMUXREG_BITS(6, 2)) +#define IOMUX_GPR13_SATA_PHY_1(n) IMX_IOMUXREG_SHIFTIN(n, (1 << 1)) +#define IOMUX_GPR13_SATA_PHY_0(n) IMX_IOMUXREG_SHIFTIN(n, (1 << 0)) #endif Modified: stable/11/sys/arm/freescale/imx/imx_iomuxvar.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_iomuxvar.h Mon Sep 11 22:21:15 2017 (r323467) +++ stable/11/sys/arm/freescale/imx/imx_iomuxvar.h Mon Sep 11 22:28:38 2017 (r323468) @@ -42,8 +42,8 @@ u_int iomux_get_pad_config(u_int pin); * with IO pin assignments or pad control. These functions let other soc level * code manipulate these values. */ -uint32_t imx_iomux_gpr_get(u_int regnum); -void imx_iomux_gpr_set(u_int regnum, uint32_t val); -void imx_iomux_gpr_set_masked(u_int regnum, uint32_t clrbits, uint32_t setbits); +uint32_t imx_iomux_gpr_get(u_int regaddr); +void imx_iomux_gpr_set(u_int regaddr, uint32_t val); +void imx_iomux_gpr_set_masked(u_int regaddr, uint32_t clrbits, uint32_t setbits); #endif From owner-svn-src-all@freebsd.org Mon Sep 11 22:32:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B907E03C71; Mon, 11 Sep 2017 22:32:39 +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 28B2175DB1; Mon, 11 Sep 2017 22:32:39 +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 v8BMWcnc069433; Mon, 11 Sep 2017 22:32:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMWcM6069432; Mon, 11 Sep 2017 22:32:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112232.v8BMWcM6069432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323469 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 323469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:32:39 -0000 Author: ian Date: Mon Sep 11 22:32:38 2017 New Revision: 323469 URL: https://svnweb.freebsd.org/changeset/base/323469 Log: MFC r322580: Fix compile error with option DEBUG. This is fallout from some long-ago INTRNG refactoring that didn't get caught at the time because code in a debugf() statement isn't compiled unless DEBUG is defined. PR: 221557 Modified: stable/11/sys/kern/subr_intr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_intr.c ============================================================================== --- stable/11/sys/kern/subr_intr.c Mon Sep 11 22:28:38 2017 (r323468) +++ stable/11/sys/kern/subr_intr.c Mon Sep 11 22:32:38 2017 (r323469) @@ -1023,14 +1023,14 @@ intr_setup_irq(device_t dev, struct resource *res, dri if (flags & INTR_SOLO) { error = iscr_setup_filter(isrc, name, (intr_irq_filter_t *)filt, arg, cookiep); - debugf("irq %u setup filter error %d on %s\n", irq, error, + debugf("irq %u setup filter error %d on %s\n", isrc->isrc_irq, error, name); } else #endif { error = isrc_add_handler(isrc, name, filt, hand, arg, flags, cookiep); - debugf("irq %u add handler error %d on %s\n", irq, error, name); + debugf("irq %u add handler error %d on %s\n", isrc->isrc_irq, error, name); } if (error != 0) return (error); From owner-svn-src-all@freebsd.org Mon Sep 11 22:33:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3C4EE03DA6; Mon, 11 Sep 2017 22:33:30 +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 B2B5275F66; Mon, 11 Sep 2017 22:33:30 +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 v8BMXTuh069539; Mon, 11 Sep 2017 22:33:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMXTm6069538; Mon, 11 Sep 2017 22:33:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112233.v8BMXTm6069538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323470 - stable/11/sys/arm/ti/am335x X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/ti/am335x X-SVN-Commit-Revision: 323470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:33:31 -0000 Author: ian Date: Mon Sep 11 22:33:29 2017 New Revision: 323470 URL: https://svnweb.freebsd.org/changeset/base/323470 Log: MFC r322373: Ensure the clocks driver is attached before any drivers that need to enable clocks in their attach(). Modified: stable/11/sys/arm/ti/am335x/am335x_prcm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- stable/11/sys/arm/ti/am335x/am335x_prcm.c Mon Sep 11 22:32:38 2017 (r323469) +++ stable/11/sys/arm/ti/am335x/am335x_prcm.c Mon Sep 11 22:33:29 2017 (r323470) @@ -466,8 +466,8 @@ static driver_t am335x_prcm_driver = { static devclass_t am335x_prcm_devclass; -DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver, - am335x_prcm_devclass, 0, 0); +EARLY_DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver, + am335x_prcm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY); MODULE_VERSION(am335x_prcm, 1); MODULE_DEPEND(am335x_prcm, ti_scm, 1, 1, 1); From owner-svn-src-all@freebsd.org Mon Sep 11 22:35:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2988E03F20; Mon, 11 Sep 2017 22:35:21 +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 9FD64760E4; Mon, 11 Sep 2017 22:35:21 +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 v8BMZKhx069654; Mon, 11 Sep 2017 22:35:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMZKfV069653; Mon, 11 Sep 2017 22:35:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112235.v8BMZKfV069653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323471 - stable/11/sys/arm/broadcom/bcm2835 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 323471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:35:21 -0000 Author: ian Date: Mon Sep 11 22:35:20 2017 New Revision: 323471 URL: https://svnweb.freebsd.org/changeset/base/323471 Log: MFC r323132-r323133 r323132: The latest RPi firmware leaves secondary cores in a wait-for-event (WFE) state to save power, so after writing the entry point address for a core to the mailbox, use a dsb() to synchronize the execution pipeline to the data written, then use an sev() to wake up the core. Submitted by: Sylvain Garrigues r323133: Change leading spaces to tabs, no functional change. Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Mon Sep 11 22:33:29 2017 (r323470) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Mon Sep 11 22:35:20 2017 (r323471) @@ -114,7 +114,9 @@ platform_mp_start_ap(void) /* set entry point to mailbox 3 */ BSWR4(MBOX3SET_CORE(i), (uint32_t)pmap_kextract((vm_offset_t)mpentry)); - wmb(); + /* Firmware put cores in WFE state, need SEV to wake up. */ + dsb(); + sev(); /* wait for bootup */ retry = 1000; From owner-svn-src-all@freebsd.org Mon Sep 11 22:40:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 540E0E04227; Mon, 11 Sep 2017 22:40:01 +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 22D23762B6; Mon, 11 Sep 2017 22:40:01 +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 v8BMe095069858; Mon, 11 Sep 2017 22:40:00 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMe0gP069855; Mon, 11 Sep 2017 22:40:00 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112240.v8BMe0gP069855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323472 - in stable/11/sys: dev/xen/timer isa x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: dev/xen/timer isa x86/isa X-SVN-Commit-Revision: 323472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:40:01 -0000 Author: ian Date: Mon Sep 11 22:39:59 2017 New Revision: 323472 URL: https://svnweb.freebsd.org/changeset/base/323472 Log: MFC r322411: Stop calling atrtc_set() from the xen timer clock_settime() method. That removes the only reference to atrtc_set() from outside of atrtc.c, so make it static. The xen timer driver registers as a realtime clock with 1us resolution. In the past that resulted in only the xen timer's clock_settime() getting called, so it would call atrtc_set() to set the hardware clock as well. As of r32090, the clock_settime() method of all registered realtime clocks gets called, so the xen driver no longer needs to chain-call the lower-resolution driver. Thanks to royger@ for talking me through the xen stuff, and for testing. Modified: stable/11/sys/dev/xen/timer/timer.c stable/11/sys/isa/rtc.h stable/11/sys/x86/isa/atrtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/xen/timer/timer.c ============================================================================== --- stable/11/sys/dev/xen/timer/timer.c Mon Sep 11 22:35:20 2017 (r323471) +++ stable/11/sys/dev/xen/timer/timer.c Mon Sep 11 22:39:59 2017 (r323472) @@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include "clock_if.h" static devclass_t xentimer_devclass; @@ -228,9 +226,6 @@ xentimer_settime(device_t dev __unused, struct timespe */ if (!xen_initial_domain()) return (0); - - /* Set the native RTC. */ - atrtc_set(ts); settime.cmd = XENPF_settime64; settime.u.settime64.mbz = 0; Modified: stable/11/sys/isa/rtc.h ============================================================================== --- stable/11/sys/isa/rtc.h Mon Sep 11 22:35:20 2017 (r323471) +++ stable/11/sys/isa/rtc.h Mon Sep 11 22:39:59 2017 (r323472) @@ -118,7 +118,6 @@ extern int atrtcclock_disable; int rtcin(int reg); void atrtc_restore(void); void writertc(int reg, u_char val); -void atrtc_set(struct timespec *ts); #endif #endif /* _I386_ISA_RTC_H_ */ Modified: stable/11/sys/x86/isa/atrtc.c ============================================================================== --- stable/11/sys/x86/isa/atrtc.c Mon Sep 11 22:35:20 2017 (r323471) +++ stable/11/sys/x86/isa/atrtc.c Mon Sep 11 22:39:59 2017 (r323472) @@ -159,7 +159,7 @@ atrtc_restore(void) rtcin(RTC_INTR); } -void +static void atrtc_set(struct timespec *ts) { struct clocktime ct; From owner-svn-src-all@freebsd.org Mon Sep 11 22:43:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 225AAE046B6; Mon, 11 Sep 2017 22:43:03 +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 E3F3F766F0; Mon, 11 Sep 2017 22:43:02 +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 v8BMh22X073732; Mon, 11 Sep 2017 22:43:02 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BMh2gL073731; Mon, 11 Sep 2017 22:43:02 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112243.v8BMh2gL073731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 22:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323473 - stable/11/share/man/man5 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/share/man/man5 X-SVN-Commit-Revision: 323473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 22:43:03 -0000 Author: ian Date: Mon Sep 11 22:43:01 2017 New Revision: 323473 URL: https://svnweb.freebsd.org/changeset/base/323473 Log: MFC r323341: Clarify that the size option is in bytes by default, but also accepts the usual SI suffixes. Modified: stable/11/share/man/man5/tmpfs.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man5/tmpfs.5 ============================================================================== --- stable/11/share/man/man5/tmpfs.5 Mon Sep 11 22:39:59 2017 (r323472) +++ stable/11/share/man/man5/tmpfs.5 Mon Sep 11 22:43:01 2017 (r323473) @@ -54,7 +54,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 20, 2017 +.Dd September 8, 2017 .Dt TMPFS 5 .Os .Sh NAME @@ -131,7 +131,9 @@ the file system size, which can be limited with the .Cm size option. .It Cm size -Specifies the total file system size in bytes. +Specifies the total file system size in bytes, unless suffixed +with one of k, m, g, t, or p, which denote byte, kilobyte, +megabyte, gigabyte, terabyte and petabyte respectively. If zero (the default) or a value larger than SIZE_MAX - PAGE_SIZE is given, the available amount of memory (including main memory and swap space) will be used. From owner-svn-src-all@freebsd.org Mon Sep 11 23:47:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76724E07FAF; Mon, 11 Sep 2017 23:47:50 +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 43EB37C798; Mon, 11 Sep 2017 23:47:50 +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 v8BNlnfU097920; Mon, 11 Sep 2017 23:47:49 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8BNln8G097919; Mon, 11 Sep 2017 23:47:49 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709112347.v8BNln8G097919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 11 Sep 2017 23:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323474 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 323474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 23:47:50 -0000 Author: ian Date: Mon Sep 11 23:47:49 2017 New Revision: 323474 URL: https://svnweb.freebsd.org/changeset/base/323474 Log: Add a default implementation that returns ENODEV for start, repeat_start, stop, read, and write methods. Some controllers don't implement these individual operations and have only a transfer method. In that case, we should return an indication that the device is present but doesn't support the method, as opposed to the kobj default error ENXIO which makes it look like the whole device is missing. Userland tools such as i2c(8) can use the differing return values to switch between the two different i2c IO mechanisms. Modified: head/sys/dev/iicbus/iicbus_if.m Modified: head/sys/dev/iicbus/iicbus_if.m ============================================================================== --- head/sys/dev/iicbus/iicbus_if.m Mon Sep 11 22:43:01 2017 (r323473) +++ head/sys/dev/iicbus/iicbus_if.m Mon Sep 11 23:47:49 2017 (r323474) @@ -32,6 +32,12 @@ INTERFACE iicbus; CODE { + static int iicbus_nosupport(void) + { + + return (ENODEV); + } + static u_int iicbus_default_frequency(device_t bus, u_char speed) { @@ -69,7 +75,7 @@ METHOD int repeated_start { device_t dev; u_char slave; int timeout; -}; +} DEFAULT iicbus_nosupport; # # Send START condition @@ -78,14 +84,14 @@ METHOD int start { device_t dev; u_char slave; int timeout; -}; +} DEFAULT iicbus_nosupport; # # Send STOP condition # METHOD int stop { device_t dev; -}; +} DEFAULT iicbus_nosupport; # # Read from I2C bus @@ -97,7 +103,7 @@ METHOD int read { int *bytes; int last; int delay; -}; +} DEFAULT iicbus_nosupport; # # Write to the I2C bus @@ -108,7 +114,7 @@ METHOD int write { int len; int *bytes; int timeout; -}; +} DEFAULT iicbus_nosupport; # # Reset I2C bus From owner-svn-src-all@freebsd.org Tue Sep 12 00:26:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2478AE0A509; Tue, 12 Sep 2017 00:26:58 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0023A7DBA6; Tue, 12 Sep 2017 00:26:57 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C0QvoD014068; Tue, 12 Sep 2017 00:26:57 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C0Qvii014065; Tue, 12 Sep 2017 00:26:57 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120026.v8C0Qvii014065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 00:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323475 - in stable/11/lib/msun: src tests X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: in stable/11/lib/msun: src tests X-SVN-Commit-Revision: 323475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 00:26:58 -0000 Author: rlibby Date: Tue Sep 12 00:26:56 2017 New Revision: 323475 URL: https://svnweb.freebsd.org/changeset/base/323475 Log: MFC r323003,r323004: r323003: lib/msun: avoid referring to broken LDBL_MAX r323004: lib/msun: add more csqrt unit tests for precision and overflow Modified: stable/11/lib/msun/src/catrig.c stable/11/lib/msun/src/s_csqrtl.c stable/11/lib/msun/tests/csqrt_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/src/catrig.c ============================================================================== --- stable/11/lib/msun/src/catrig.c Mon Sep 11 23:47:49 2017 (r323474) +++ stable/11/lib/msun/src/catrig.c Tue Sep 12 00:26:56 2017 (r323475) @@ -469,8 +469,13 @@ clog_for_large_values(double complex z) /* * Avoid overflow in hypot() when x and y are both very large. - * Divide x and y by E, and then add 1 to the logarithm. This depends - * on E being larger than sqrt(2). + * Divide x and y by E, and then add 1 to the logarithm. This + * depends on E being larger than sqrt(2), since the return value of + * hypot cannot overflow if neither argument is greater in magnitude + * than 1/sqrt(2) of the maximum value of the return type. Likewise + * this determines the necessary threshold for using this method + * (however, actually use 1/2 instead as it is simpler). + * * Dividing by E causes an insignificant loss of accuracy; however * this method is still poor since it is uneccessarily slow. */ Modified: stable/11/lib/msun/src/s_csqrtl.c ============================================================================== --- stable/11/lib/msun/src/s_csqrtl.c Mon Sep 11 23:47:49 2017 (r323474) +++ stable/11/lib/msun/src/s_csqrtl.c Tue Sep 12 00:26:56 2017 (r323475) @@ -42,8 +42,16 @@ __FBSDID("$FreeBSD$"); */ #pragma STDC CX_LIMITED_RANGE ON -/* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */ -#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L) +/* + * We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). + * Rather than determining the fully precise value at which we might + * overflow, just use a threshold of approximately LDBL_MAX / 4. + */ +#if LDBL_MAX_EXP != 0x4000 +#error "Unsupported long double format" +#else +#define THRESH 0x1p16382L +#endif long double complex csqrtl(long double complex z) Modified: stable/11/lib/msun/tests/csqrt_test.c ============================================================================== --- stable/11/lib/msun/tests/csqrt_test.c Mon Sep 11 23:47:49 2017 (r323474) +++ stable/11/lib/msun/tests/csqrt_test.c Tue Sep 12 00:26:56 2017 (r323475) @@ -214,28 +214,94 @@ test_nans(void) /* * Test whether csqrt(a + bi) works for inputs that are large enough to - * cause overflow in hypot(a, b) + a. In this case we are using - * csqrt(115 + 252*I) == 14 + 9*I - * scaled up to near MAX_EXP. + * cause overflow in hypot(a, b) + a. Each of the tests is scaled up to + * near MAX_EXP. */ static void test_overflow(int maxexp) { long double a, b; long double complex result; + int exp, i; - a = ldexpl(115 * 0x1p-8, maxexp); - b = ldexpl(252 * 0x1p-8, maxexp); - result = t_csqrt(CMPLXL(a, b)); - assert(creall(result) == ldexpl(14 * 0x1p-4, maxexp / 2)); - assert(cimagl(result) == ldexpl(9 * 0x1p-4, maxexp / 2)); + assert(maxexp > 0 && maxexp % 2 == 0); + + for (i = 0; i < 4; i++) { + exp = maxexp - 2 * i; + + /* csqrt(115 + 252*I) == 14 + 9*I */ + a = ldexpl(115 * 0x1p-8, exp); + b = ldexpl(252 * 0x1p-8, exp); + result = t_csqrt(CMPLXL(a, b)); + assert(creall(result) == ldexpl(14 * 0x1p-4, exp / 2)); + assert(cimagl(result) == ldexpl(9 * 0x1p-4, exp / 2)); + + /* csqrt(-11 + 60*I) = 5 + 6*I */ + a = ldexpl(-11 * 0x1p-6, exp); + b = ldexpl(60 * 0x1p-6, exp); + result = t_csqrt(CMPLXL(a, b)); + assert(creall(result) == ldexpl(5 * 0x1p-3, exp / 2)); + assert(cimagl(result) == ldexpl(6 * 0x1p-3, exp / 2)); + + /* csqrt(225 + 0*I) == 15 + 0*I */ + a = ldexpl(225 * 0x1p-8, exp); + b = 0; + result = t_csqrt(CMPLXL(a, b)); + assert(creall(result) == ldexpl(15 * 0x1p-4, exp / 2)); + assert(cimagl(result) == 0); + } } +/* + * Test that precision is maintained for some large squares. Set all or + * some bits in the lower mantdig/2 bits, square the number, and try to + * recover the sqrt. Note: + * (x + xI)**2 = 2xxI + */ +static void +test_precision(int maxexp, int mantdig) +{ + long double b, x; + long double complex result; + uint64_t mantbits, sq_mantbits; + int exp, i; + + assert(maxexp > 0 && maxexp % 2 == 0); + assert(mantdig <= 64); + mantdig = rounddown(mantdig, 2); + + for (exp = 0; exp <= maxexp; exp += 2) { + mantbits = ((uint64_t)1 << (mantdig / 2 )) - 1; + for (i = 0; + i < 100 && mantbits > ((uint64_t)1 << (mantdig / 2 - 1)); + i++, mantbits--) { + sq_mantbits = mantbits * mantbits; + /* + * sq_mantibts is a mantdig-bit number. Divide by + * 2**mantdig to normalize it to [0.5, 1), where, + * note, the binary power will be -1. Raise it by + * 2**exp for the test. exp is even. Lower it by + * one to reach a final binary power which is also + * even. The result should be exactly + * representable, given that mantdig is less than or + * equal to the available precision. + */ + b = ldexpl((long double)sq_mantbits, + exp - 1 - mantdig); + x = ldexpl(mantbits, (exp - 2 - mantdig) / 2); + assert(b == x * x * 2); + result = t_csqrt(CMPLXL(0, b)); + assert(creall(result) == x); + assert(cimagl(result) == x); + } + } +} + int main(void) { - printf("1..15\n"); + printf("1..18\n"); /* Test csqrt() */ t_csqrt = _csqrt; @@ -255,41 +321,56 @@ main(void) test_overflow(DBL_MAX_EXP); printf("ok 5 - csqrt\n"); + test_precision(DBL_MAX_EXP, DBL_MANT_DIG); + printf("ok 6 - csqrt\n"); + /* Now test csqrtf() */ t_csqrt = _csqrtf; test_finite(); - printf("ok 6 - csqrt\n"); + printf("ok 7 - csqrt\n"); test_zeros(); - printf("ok 7 - csqrt\n"); + printf("ok 8 - csqrt\n"); test_infinities(); - printf("ok 8 - csqrt\n"); + printf("ok 9 - csqrt\n"); test_nans(); - printf("ok 9 - csqrt\n"); + printf("ok 10 - csqrt\n"); test_overflow(FLT_MAX_EXP); - printf("ok 10 - csqrt\n"); + printf("ok 11 - csqrt\n"); + test_precision(FLT_MAX_EXP, FLT_MANT_DIG); + printf("ok 12 - csqrt\n"); + /* Now test csqrtl() */ t_csqrt = csqrtl; test_finite(); - printf("ok 11 - csqrt\n"); + printf("ok 13 - csqrt\n"); test_zeros(); - printf("ok 12 - csqrt\n"); + printf("ok 14 - csqrt\n"); test_infinities(); - printf("ok 13 - csqrt\n"); + printf("ok 15 - csqrt\n"); test_nans(); - printf("ok 14 - csqrt\n"); + printf("ok 16 - csqrt\n"); test_overflow(LDBL_MAX_EXP); - printf("ok 15 - csqrt\n"); + printf("ok 17 - csqrt\n"); + + test_precision(LDBL_MAX_EXP, +#ifndef __i386__ + LDBL_MANT_DIG +#else + DBL_MANT_DIG +#endif + ); + printf("ok 18 - csqrt\n"); return (0); } From owner-svn-src-all@freebsd.org Tue Sep 12 00:44:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 800AEE0B38B; Tue, 12 Sep 2017 00:44:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A5437E530; Tue, 12 Sep 2017 00:44:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C0iHOi022118; Tue, 12 Sep 2017 00:44:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C0iGVL022114; Tue, 12 Sep 2017 00:44:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709120044.v8C0iGVL022114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 12 Sep 2017 00:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323476 - in stable/11/release: amd64 arm64 i386 powerpc X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/11/release: amd64 arm64 i386 powerpc X-SVN-Commit-Revision: 323476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 00:44:18 -0000 Author: emaste Date: Tue Sep 12 00:44:16 2017 New Revision: 323476 URL: https://svnweb.freebsd.org/changeset/base/323476 Log: make-memstick.sh: use 'set -e' to abort if any step fails Also remove the now-redundant error handling that was only for makefs. This script was run on an older FreeBSD host that lacked efi-on-mbr support in makefs. A warning was emitted on the console (from makefs) but the script continued running and exited with 0. MFC of r308171 (arm64) and r323178 (other architectures). Modified: stable/11/release/amd64/make-memstick.sh stable/11/release/arm64/make-memstick.sh stable/11/release/i386/make-memstick.sh stable/11/release/powerpc/make-memstick.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/release/amd64/make-memstick.sh ============================================================================== --- stable/11/release/amd64/make-memstick.sh Tue Sep 12 00:26:56 2017 (r323475) +++ stable/11/release/amd64/make-memstick.sh Tue Sep 12 00:44:16 2017 (r323476) @@ -10,6 +10,8 @@ # $FreeBSD$ # +set -e + PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH @@ -31,10 +33,6 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local makefs -B little -o label=FreeBSD_Install ${2}.part ${1} -if [ $? -ne 0 ]; then - echo "makefs failed" - exit 1 -fi rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: stable/11/release/arm64/make-memstick.sh ============================================================================== --- stable/11/release/arm64/make-memstick.sh Tue Sep 12 00:26:56 2017 (r323475) +++ stable/11/release/arm64/make-memstick.sh Tue Sep 12 00:44:16 2017 (r323476) @@ -10,6 +10,8 @@ # $FreeBSD$ # +set -e + PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH @@ -31,10 +33,6 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local makefs -B little -o label=FreeBSD_Install ${2}.part ${1} -if [ $? -ne 0 ]; then - echo "makefs failed" - exit 1 -fi rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: stable/11/release/i386/make-memstick.sh ============================================================================== --- stable/11/release/i386/make-memstick.sh Tue Sep 12 00:26:56 2017 (r323475) +++ stable/11/release/i386/make-memstick.sh Tue Sep 12 00:44:16 2017 (r323476) @@ -10,6 +10,8 @@ # $FreeBSD$ # +set -e + PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH @@ -31,10 +33,6 @@ fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local makefs -B little -o label=FreeBSD_Install ${2}.part ${1} -if [ $? -ne 0 ]; then - echo "makefs failed" - exit 1 -fi rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local Modified: stable/11/release/powerpc/make-memstick.sh ============================================================================== --- stable/11/release/powerpc/make-memstick.sh Tue Sep 12 00:26:56 2017 (r323475) +++ stable/11/release/powerpc/make-memstick.sh Tue Sep 12 00:44:16 2017 (r323476) @@ -10,6 +10,8 @@ # $FreeBSD$ # +set -e + PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH @@ -36,10 +38,6 @@ echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fsta echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local rm -f ${tempfile} makefs -B big ${tempfile} ${1} -if [ $? -ne 0 ]; then - echo "makefs failed" - exit 1 -fi rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local From owner-svn-src-all@freebsd.org Tue Sep 12 03:54:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 254F1E14CFA; Tue, 12 Sep 2017 03:54:06 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C89248398C; Tue, 12 Sep 2017 03:54:05 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C3s5pl099326; Tue, 12 Sep 2017 03:54:05 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C3s5fa099325; Tue, 12 Sep 2017 03:54:05 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201709120354.v8C3s5fa099325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Tue, 12 Sep 2017 03:54:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323477 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 323477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 03:54:06 -0000 Author: mjoras Date: Tue Sep 12 03:54:04 2017 New Revision: 323477 URL: https://svnweb.freebsd.org/changeset/base/323477 Log: MFC r322548: Rework vlan(4) locking. Previously the locking of vlan(4) interfaces was not very comprehensive. Particularly there was very little protection against the destruction of active vlan(4) interfaces or concurrent modification of a vlan(4) interface. The former readily produced several different panics. The changes can be summarized as using two global vlan locks (an rmlock(9) and an sx(9)) to protect accesses to the if_vlantrunk field of struct ifnet, in addition to other places where global exclusive access is required. vlan(4) should now be much more resilient to the destruction of active interfaces and concurrent calls into the configuration path. Modified: stable/11/sys/net/if_vlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_vlan.c ============================================================================== --- stable/11/sys/net/if_vlan.c Tue Sep 12 00:44:16 2017 (r323476) +++ stable/11/sys/net/if_vlan.c Tue Sep 12 03:54:04 2017 (r323477) @@ -1,6 +1,7 @@ /*- * Copyright 1998 Massachusetts Institute of Technology * Copyright 2012 ADARA Networks, Inc. + * Copyright 2017 Dell EMC Isilon * * Portions of this software were developed by Robert N. M. Watson under * contract to ADARA Networks, Inc. @@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -100,6 +102,53 @@ struct ifvlantrunk { int refcnt; }; +/* + * This macro provides a facility to iterate over every vlan on a trunk with + * the assumption that none will be added/removed during iteration. + */ +#ifdef VLAN_ARRAY +#define VLAN_FOREACH(_ifv, _trunk) \ + size_t _i; \ + for (_i = 0; _i < VLAN_ARRAY_SIZE; _i++) \ + if (((_ifv) = (_trunk)->vlans[_i]) != NULL) +#else /* VLAN_ARRAY */ +#define VLAN_FOREACH(_ifv, _trunk) \ + struct ifvlan *_next; \ + size_t _i; \ + for (_i = 0; _i < (1 << (_trunk)->hwidth); _i++) \ + LIST_FOREACH_SAFE((_ifv), &(_trunk)->hash[_i], ifv_list, _next) +#endif /* VLAN_ARRAY */ + +/* + * This macro provides a facility to iterate over every vlan on a trunk while + * also modifying the number of vlans on the trunk. The iteration continues + * until some condition is met or there are no more vlans on the trunk. + */ +#ifdef VLAN_ARRAY +/* The VLAN_ARRAY case is simple -- just a for loop using the condition. */ +#define VLAN_FOREACH_UNTIL_SAFE(_ifv, _trunk, _cond) \ + size_t _i; \ + for (_i = 0; !(_cond) && _i < VLAN_ARRAY_SIZE; _i++) \ + if (((_ifv) = (_trunk)->vlans[_i])) +#else /* VLAN_ARRAY */ +/* + * The hash table case is more complicated. We allow for the hash table to be + * modified (i.e. vlans removed) while we are iterating over it. To allow for + * this we must restart the iteration every time we "touch" something during + * the iteration, since removal will resize the hash table and invalidate our + * current position. If acting on the touched element causes the trunk to be + * emptied, then iteration also stops. + */ +#define VLAN_FOREACH_UNTIL_SAFE(_ifv, _trunk, _cond) \ + size_t _i; \ + bool _touch = false; \ + for (_i = 0; \ + !(_cond) && _i < (1 << (_trunk)->hwidth); \ + _i = (_touch && ((_trunk) != NULL) ? 0 : _i + 1), _touch = false) \ + if (((_ifv) = LIST_FIRST(&(_trunk)->hash[_i])) != NULL && \ + (_touch = true)) +#endif /* VLAN_ARRAY */ + struct vlan_mc_entry { struct sockaddr_dl mc_addr; SLIST_ENTRY(vlan_mc_entry) mc_entries; @@ -122,6 +171,7 @@ struct ifvlan { uint16_t ifvm_vid; /* VLAN ID */ uint8_t ifvm_pcp; /* Priority Code Point (PCP). */ } ifv_mib; + struct task lladdr_task; SLIST_HEAD(, vlan_mc_entry) vlan_mc_listhead; #ifndef VLAN_ARRAY LIST_ENTRY(ifvlan) ifv_list; @@ -172,33 +222,92 @@ static eventhandler_tag ifdetach_tag; static eventhandler_tag iflladdr_tag; /* - * We have a global mutex, that is used to serialize configuration - * changes and isn't used in normal packet delivery. + * if_vlan uses two module-level locks to allow concurrent modification of vlan + * interfaces and (mostly) allow for vlans to be destroyed while they are being + * used for tx/rx. To accomplish this in a way that has acceptable performance + * and cooperation with other parts of the network stack there is a + * non-sleepable rmlock(9) and an sx(9). Both locks are exclusively acquired + * when destroying a vlan interface, i.e. when the if_vlantrunk field of struct + * ifnet is de-allocated and NULL'd. Thus a reader holding either lock has a + * guarantee that the struct ifvlantrunk references a valid vlan trunk. * - * We also have a per-trunk rmlock(9), that is locked shared on packet - * processing and exclusive when configuration is changed. + * The performance-sensitive paths that warrant using the rmlock(9) are + * vlan_transmit and vlan_input. Both have to check for the vlan interface's + * existence using if_vlantrunk, and being in the network tx/rx paths the use + * of an rmlock(9) gives a measureable improvement in performance. * + * The reason for having an sx(9) is mostly because there are still areas that + * must be sleepable and also have safe concurrent access to a vlan interface. + * Since the sx(9) exists, it is used by default in most paths unless sleeping + * is not permitted, or if it is not clear whether sleeping is permitted. + * + * Note that despite these protections, there is still an inherent race in the + * destruction of vlans since there's no guarantee that the ifnet hasn't been + * freed/reused when the tx/rx functions are called by the stack. This can only + * be fixed by addressing ifnet's lifetime issues. + */ +#define _VLAN_RM_ID ifv_rm_lock +#define _VLAN_SX_ID ifv_sx + +static struct rmlock _VLAN_RM_ID; +static struct sx _VLAN_SX_ID; + +#define VLAN_LOCKING_INIT() \ + rm_init(&_VLAN_RM_ID, "vlan_rm"); \ + sx_init(&_VLAN_SX_ID, "vlan_sx") + +#define VLAN_LOCKING_DESTROY() \ + rm_destroy(&_VLAN_RM_ID); \ + sx_destroy(&_VLAN_SX_ID) + +#define _VLAN_RM_TRACKER _vlan_rm_tracker +#define VLAN_RLOCK() rm_rlock(&_VLAN_RM_ID, \ + &_VLAN_RM_TRACKER) +#define VLAN_RUNLOCK() rm_runlock(&_VLAN_RM_ID, \ + &_VLAN_RM_TRACKER) +#define VLAN_WLOCK() rm_wlock(&_VLAN_RM_ID) +#define VLAN_WUNLOCK() rm_wunlock(&_VLAN_RM_ID) +#define VLAN_RLOCK_ASSERT() rm_assert(&_VLAN_RM_ID, RA_RLOCKED) +#define VLAN_WLOCK_ASSERT() rm_assert(&_VLAN_RM_ID, RA_WLOCKED) +#define VLAN_RWLOCK_ASSERT() rm_assert(&_VLAN_RM_ID, RA_LOCKED) +#define VLAN_LOCK_READER struct rm_priotracker _VLAN_RM_TRACKER + +#define VLAN_SLOCK() sx_slock(&_VLAN_SX_ID) +#define VLAN_SUNLOCK() sx_sunlock(&_VLAN_SX_ID) +#define VLAN_XLOCK() sx_xlock(&_VLAN_SX_ID) +#define VLAN_XUNLOCK() sx_xunlock(&_VLAN_SX_ID) +#define VLAN_SLOCK_ASSERT() sx_assert(&_VLAN_SX_ID, SA_SLOCKED) +#define VLAN_XLOCK_ASSERT() sx_assert(&_VLAN_SX_ID, SA_XLOCKED) +#define VLAN_SXLOCK_ASSERT() sx_assert(&_VLAN_SX_ID, SA_LOCKED) + + +/* + * We also have a per-trunk rmlock(9), that is locked shared on packet + * processing and exclusive when configuration is changed. Note: This should + * only be acquired while there is a shared lock on either of the global locks + * via VLAN_SLOCK or VLAN_RLOCK. Thus, an exclusive lock on the global locks + * makes a call to TRUNK_RLOCK/TRUNK_WLOCK technically superfluous. + */ +#define _TRUNK_RM_TRACKER _trunk_rm_tracker +#define TRUNK_LOCK_INIT(trunk) rm_init(&(trunk)->lock, vlanname) +#define TRUNK_LOCK_DESTROY(trunk) rm_destroy(&(trunk)->lock) +#define TRUNK_RLOCK(trunk) rm_rlock(&(trunk)->lock, \ + &_TRUNK_RM_TRACKER) +#define TRUNK_WLOCK(trunk) rm_wlock(&(trunk)->lock) +#define TRUNK_RUNLOCK(trunk) rm_runlock(&(trunk)->lock, \ + &_TRUNK_RM_TRACKER) +#define TRUNK_WUNLOCK(trunk) rm_wunlock(&(trunk)->lock) +#define TRUNK_RLOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_RLOCKED) +#define TRUNK_LOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_LOCKED) +#define TRUNK_WLOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_WLOCKED) +#define TRUNK_LOCK_READER struct rm_priotracker _TRUNK_RM_TRACKER + +/* * The VLAN_ARRAY substitutes the dynamic hash with a static array * with 4096 entries. In theory this can give a boost in processing, - * however on practice it does not. Probably this is because array + * however in practice it does not. Probably this is because the array * is too big to fit into CPU cache. */ -static struct sx ifv_lock; -#define VLAN_LOCK_INIT() sx_init(&ifv_lock, "vlan_global") -#define VLAN_LOCK_DESTROY() sx_destroy(&ifv_lock) -#define VLAN_LOCK_ASSERT() sx_assert(&ifv_lock, SA_LOCKED) -#define VLAN_LOCK() sx_xlock(&ifv_lock) -#define VLAN_UNLOCK() sx_xunlock(&ifv_lock) -#define TRUNK_LOCK_INIT(trunk) rm_init(&(trunk)->lock, vlanname) -#define TRUNK_LOCK_DESTROY(trunk) rm_destroy(&(trunk)->lock) -#define TRUNK_LOCK(trunk) rm_wlock(&(trunk)->lock) -#define TRUNK_UNLOCK(trunk) rm_wunlock(&(trunk)->lock) -#define TRUNK_LOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_WLOCKED) -#define TRUNK_RLOCK(trunk) rm_rlock(&(trunk)->lock, &tracker) -#define TRUNK_RUNLOCK(trunk) rm_runlock(&(trunk)->lock, &tracker) -#define TRUNK_LOCK_RASSERT(trunk) rm_assert(&(trunk)->lock, RA_RLOCKED) -#define TRUNK_LOCK_READER struct rm_priotracker tracker - #ifndef VLAN_ARRAY static void vlan_inithash(struct ifvlantrunk *trunk); static void vlan_freehash(struct ifvlantrunk *trunk); @@ -234,6 +343,8 @@ static int vlan_clone_destroy(struct if_clone *, struc static void vlan_ifdetach(void *arg, struct ifnet *ifp); static void vlan_iflladdr(void *arg, struct ifnet *ifp); +static void vlan_lladdr_fn(void *arg, int pending); + static struct if_clone *vlan_cloner; #ifdef VIMAGE @@ -288,7 +399,7 @@ vlan_inshash(struct ifvlantrunk *trunk, struct ifvlan int i, b; struct ifvlan *ifv2; - TRUNK_LOCK_ASSERT(trunk); + TRUNK_WLOCK_ASSERT(trunk); KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); b = 1 << trunk->hwidth; @@ -318,7 +429,7 @@ vlan_remhash(struct ifvlantrunk *trunk, struct ifvlan int i, b; struct ifvlan *ifv2; - TRUNK_LOCK_ASSERT(trunk); + TRUNK_WLOCK_ASSERT(trunk); KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); b = 1 << trunk->hwidth; @@ -346,7 +457,7 @@ vlan_growhash(struct ifvlantrunk *trunk, int howmuch) struct ifvlanhead *hash2; int hwidth2, i, j, n, n2; - TRUNK_LOCK_ASSERT(trunk); + TRUNK_WLOCK_ASSERT(trunk); KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); if (howmuch == 0) { @@ -392,7 +503,7 @@ vlan_gethash(struct ifvlantrunk *trunk, uint16_t vid) { struct ifvlan *ifv; - TRUNK_LOCK_RASSERT(trunk); + TRUNK_RLOCK_ASSERT(trunk); LIST_FOREACH(ifv, &trunk->hash[HASH(vid, trunk->hmask)], ifv_list) if (ifv->ifv_vid == vid) @@ -462,12 +573,11 @@ vlan_inithash(struct ifvlantrunk *trunk) static void trunk_destroy(struct ifvlantrunk *trunk) { - VLAN_LOCK_ASSERT(); + VLAN_XLOCK_ASSERT(); + VLAN_WLOCK_ASSERT(); - TRUNK_LOCK(trunk); vlan_freehash(trunk); trunk->parent->if_vlantrunk = NULL; - TRUNK_UNLOCK(trunk); TRUNK_LOCK_DESTROY(trunk); if_rele(trunk->parent); free(trunk, M_VLAN); @@ -490,9 +600,15 @@ vlan_setmulti(struct ifnet *ifp) struct vlan_mc_entry *mc; int error; + /* + * XXX This stupidly needs the rmlock to avoid sleeping while holding + * the in6_multi_mtx (see in6_mc_join_locked). + */ + VLAN_RWLOCK_ASSERT(); + /* Find the parent. */ sc = ifp->if_softc; - TRUNK_LOCK_ASSERT(TRUNK(sc)); + TRUNK_WLOCK_ASSERT(TRUNK(sc)); ifp_p = PARENT(sc); CURVNET_SET_QUIET(ifp_p->if_vnet); @@ -539,36 +655,42 @@ static void vlan_iflladdr(void *arg __unused, struct ifnet *ifp) { struct ifvlan *ifv; -#ifndef VLAN_ARRAY - struct ifvlan *next; -#endif - int i; + struct ifnet *ifv_ifp; + struct ifvlantrunk *trunk; + struct sockaddr_dl *sdl; + VLAN_LOCK_READER; - /* - * Check if it's a trunk interface first of all - * to avoid needless locking. - */ - if (ifp->if_vlantrunk == NULL) + /* Need the rmlock since this is run on taskqueue_swi. */ + VLAN_RLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_RUNLOCK(); return; + } - VLAN_LOCK(); /* * OK, it's a trunk. Loop over and change all vlan's lladdrs on it. + * We need an exclusive lock here to prevent concurrent SIOCSIFLLADDR + * ioctl calls on the parent garbling the lladdr of the child vlan. */ -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if ((ifv = ifp->if_vlantrunk->vlans[i])) { -#else /* VLAN_ARRAY */ - for (i = 0; i < (1 << ifp->if_vlantrunk->hwidth); i++) - LIST_FOREACH_SAFE(ifv, &ifp->if_vlantrunk->hash[i], ifv_list, next) { -#endif /* VLAN_ARRAY */ - VLAN_UNLOCK(); - if_setlladdr(ifv->ifv_ifp, IF_LLADDR(ifp), - ifp->if_addrlen); - VLAN_LOCK(); - } - VLAN_UNLOCK(); - + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + /* + * Copy new new lladdr into the ifv_ifp, enqueue a task + * to actually call if_setlladdr. if_setlladdr needs to + * be deferred to a taskqueue because it will call into + * the if_vlan ioctl path and try to acquire the global + * lock. + */ + ifv_ifp = ifv->ifv_ifp; + bcopy(IF_LLADDR(ifp), IF_LLADDR(ifv_ifp), + ifp->if_addrlen); + sdl = (struct sockaddr_dl *)ifv_ifp->if_addr->ifa_addr; + sdl->sdl_alen = ifp->if_addrlen; + taskqueue_enqueue(taskqueue_thread, &ifv->lladdr_task); + } + TRUNK_WUNLOCK(trunk); + VLAN_RUNLOCK(); } /* @@ -582,46 +704,30 @@ static void vlan_ifdetach(void *arg __unused, struct ifnet *ifp) { struct ifvlan *ifv; - int i; + struct ifvlantrunk *trunk; - /* - * Check if it's a trunk interface first of all - * to avoid needless locking. - */ - if (ifp->if_vlantrunk == NULL) - return; - /* If the ifnet is just being renamed, don't do anything. */ if (ifp->if_flags & IFF_RENAMING) return; + VLAN_XLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_XUNLOCK(); + return; + } - VLAN_LOCK(); /* * OK, it's a trunk. Loop over and detach all vlan's on it. * Check trunk pointer after each vlan_unconfig() as it will * free it and set to NULL after the last vlan was detached. */ -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if ((ifv = ifp->if_vlantrunk->vlans[i])) { - vlan_unconfig_locked(ifv->ifv_ifp, 1); - if (ifp->if_vlantrunk == NULL) - break; - } -#else /* VLAN_ARRAY */ -restart: - for (i = 0; i < (1 << ifp->if_vlantrunk->hwidth); i++) - if ((ifv = LIST_FIRST(&ifp->if_vlantrunk->hash[i]))) { - vlan_unconfig_locked(ifv->ifv_ifp, 1); - if (ifp->if_vlantrunk) - goto restart; /* trunk->hwidth can change */ - else - break; - } -#endif /* VLAN_ARRAY */ + VLAN_FOREACH_UNTIL_SAFE(ifv, ifp->if_vlantrunk, + ifp->if_vlantrunk == NULL) + vlan_unconfig_locked(ifv->ifv_ifp, 1); + /* Trunk should have been destroyed in vlan_unconfig(). */ KASSERT(ifp->if_vlantrunk == NULL, ("%s: purge failed", __func__)); - VLAN_UNLOCK(); + VLAN_XUNLOCK(); } /* @@ -631,15 +737,18 @@ static struct ifnet * vlan_trunkdev(struct ifnet *ifp) { struct ifvlan *ifv; + VLAN_LOCK_READER; if (ifp->if_type != IFT_L2VLAN) return (NULL); + + /* Not clear if callers are sleepable, so acquire the rmlock. */ + VLAN_RLOCK(); ifv = ifp->if_softc; ifp = NULL; - VLAN_LOCK(); if (ifv->ifv_trunk) ifp = PARENT(ifv); - VLAN_UNLOCK(); + VLAN_RUNLOCK(); return (ifp); } @@ -701,17 +810,23 @@ vlan_devat(struct ifnet *ifp, uint16_t vid) { struct ifvlantrunk *trunk; struct ifvlan *ifv; + VLAN_LOCK_READER; TRUNK_LOCK_READER; + /* Not clear if callers are sleepable, so acquire the rmlock. */ + VLAN_RLOCK(); trunk = ifp->if_vlantrunk; - if (trunk == NULL) + if (trunk == NULL) { + VLAN_RUNLOCK(); return (NULL); + } ifp = NULL; TRUNK_RLOCK(trunk); ifv = vlan_gethash(trunk, vid); if (ifv) ifp = ifv->ifv_ifp; TRUNK_RUNLOCK(trunk); + VLAN_RUNLOCK(); return (ifp); } @@ -751,7 +866,7 @@ vlan_modevent(module_t mod, int type, void *data) vlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY); if (iflladdr_tag == NULL) return (ENOMEM); - VLAN_LOCK_INIT(); + VLAN_LOCKING_INIT(); vlan_input_p = vlan_input; vlan_link_state_p = vlan_link_state; vlan_trunk_cap_p = vlan_trunk_capabilities; @@ -788,7 +903,7 @@ vlan_modevent(module_t mod, int type, void *data) vlan_cookie_p = NULL; vlan_setcookie_p = NULL; vlan_devat_p = NULL; - VLAN_LOCK_DESTROY(); + VLAN_LOCKING_DESTROY(); if (bootverbose) printf("vlan: unloaded\n"); break; @@ -1006,9 +1121,6 @@ vlan_clone_create(struct if_clone *ifc, char *name, si return (error); } - - /* Update flags on the parent, if necessary. */ - vlan_setflags(ifp, 1); } return (0); @@ -1022,6 +1134,12 @@ vlan_clone_destroy(struct if_clone *ifc, struct ifnet ether_ifdetach(ifp); /* first, remove it from system-wide lists */ vlan_unconfig(ifp); /* now it can be unconfigured and freed */ + /* + * We should have the only reference to the ifv now, so we can now + * drain any remaining lladdr task before freeing the ifnet and the + * ifvlan. + */ + taskqueue_drain(taskqueue_thread, &ifv->lladdr_task); if_free(ifp); free(ifv, M_VLAN); ifc_free_unit(ifc, unit); @@ -1048,8 +1166,16 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) struct m_tag *mtag; uint16_t tag; int error, len, mcast; + VLAN_LOCK_READER; + VLAN_RLOCK(); ifv = ifp->if_softc; + if (TRUNK(ifv) == NULL) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); + m_freem(m); + return (ENETDOWN); + } p = PARENT(ifv); len = m->m_pkthdr.len; mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; @@ -1061,8 +1187,9 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) * or parent's driver will cause a system crash. */ if (!UP_AND_RUNNING(p)) { - m_freem(m); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); + m_freem(m); return (ENETDOWN); } @@ -1090,6 +1217,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if (n > 0) { if_printf(ifp, "cannot pad short frame\n"); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); m_freem(m); return (0); } @@ -1115,6 +1243,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if (m == NULL) { if_printf(ifp, "unable to prepend VLAN header\n"); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); return (0); } } @@ -1129,6 +1258,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast); } else if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); return (error); } @@ -1143,13 +1273,20 @@ vlan_qflush(struct ifnet *ifp __unused) static void vlan_input(struct ifnet *ifp, struct mbuf *m) { - struct ifvlantrunk *trunk = ifp->if_vlantrunk; + struct ifvlantrunk *trunk; struct ifvlan *ifv; + VLAN_LOCK_READER; TRUNK_LOCK_READER; struct m_tag *mtag; uint16_t vid, tag; - KASSERT(trunk != NULL, ("%s: no trunk", __func__)); + VLAN_RLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_RUNLOCK(); + m_freem(m); + return; + } if (m->m_flags & M_VLANTAG) { /* @@ -1169,6 +1306,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) if (m->m_len < sizeof(*evl) && (m = m_pullup(m, sizeof(*evl))) == NULL) { if_printf(ifp, "cannot pullup VLAN header\n"); + VLAN_RUNLOCK(); return; } evl = mtod(m, struct ether_vlan_header *); @@ -1190,8 +1328,9 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) panic("%s: %s has unsupported if_type %u", __func__, ifp->if_xname, ifp->if_type); #endif - m_freem(m); if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1); + VLAN_RUNLOCK(); + m_freem(m); return; } } @@ -1202,8 +1341,9 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) ifv = vlan_gethash(trunk, vid); if (ifv == NULL || !UP_AND_RUNNING(ifv->ifv_ifp)) { TRUNK_RUNLOCK(trunk); - m_freem(m); if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1); + VLAN_RUNLOCK(); + m_freem(m); return; } TRUNK_RUNLOCK(trunk); @@ -1221,8 +1361,9 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_IN, sizeof(uint8_t), M_NOWAIT); if (mtag == NULL) { - m_freem(m); if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + VLAN_RUNLOCK(); + m_freem(m); return; } m_tag_prepend(m, mtag); @@ -1232,11 +1373,24 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) m->m_pkthdr.rcvif = ifv->ifv_ifp; if_inc_counter(ifv->ifv_ifp, IFCOUNTER_IPACKETS, 1); + VLAN_RUNLOCK(); /* Pass it back through the parent's input routine. */ (*ifp->if_input)(ifv->ifv_ifp, m); } +static void +vlan_lladdr_fn(void *arg, int pending __unused) +{ + struct ifvlan *ifv; + struct ifnet *ifp; + + ifv = (struct ifvlan *)arg; + ifp = ifv->ifv_ifp; + /* The ifv_ifp already has the lladdr copied in. */ + if_setlladdr(ifp, IF_LLADDR(ifp), ifp->if_addrlen); +} + static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid) { @@ -1263,27 +1417,22 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 if (ifv->ifv_trunk) return (EBUSY); + /* Acquire rmlock after the branch so we can M_WAITOK. */ + VLAN_XLOCK(); if (p->if_vlantrunk == NULL) { trunk = malloc(sizeof(struct ifvlantrunk), M_VLAN, M_WAITOK | M_ZERO); vlan_inithash(trunk); - VLAN_LOCK(); - if (p->if_vlantrunk != NULL) { - /* A race that is very unlikely to be hit. */ - vlan_freehash(trunk); - free(trunk, M_VLAN); - goto exists; - } TRUNK_LOCK_INIT(trunk); - TRUNK_LOCK(trunk); + VLAN_WLOCK(); + TRUNK_WLOCK(trunk); p->if_vlantrunk = trunk; trunk->parent = p; if_ref(trunk->parent); } else { - VLAN_LOCK(); -exists: + VLAN_WLOCK(); trunk = p->if_vlantrunk; - TRUNK_LOCK(trunk); + TRUNK_WLOCK(trunk); } ifv->ifv_vid = vid; /* must set this before vlan_inshash() */ @@ -1360,15 +1509,25 @@ exists: * Configure multicast addresses that may already be * joined on the vlan device. */ - (void)vlan_setmulti(ifp); /* XXX: VLAN lock held */ + (void)vlan_setmulti(ifp); + TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv); + /* We are ready for operation now. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; + + /* Update flags on the parent, if necessary. */ + vlan_setflags(ifp, 1); done: - TRUNK_UNLOCK(trunk); + /* + * We need to drop the non-sleepable rmlock so that the underlying + * devices can sleep in their vlan_config hooks. + */ + TRUNK_WUNLOCK(trunk); + VLAN_WUNLOCK(); if (error == 0) EVENTHANDLER_INVOKE(vlan_config, p, ifv->ifv_vid); - VLAN_UNLOCK(); + VLAN_XUNLOCK(); return (error); } @@ -1377,9 +1536,9 @@ static void vlan_unconfig(struct ifnet *ifp) { - VLAN_LOCK(); + VLAN_XLOCK(); vlan_unconfig_locked(ifp, 0); - VLAN_UNLOCK(); + VLAN_XUNLOCK(); } static void @@ -1391,15 +1550,20 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing) struct ifnet *parent; int error; - VLAN_LOCK_ASSERT(); + VLAN_XLOCK_ASSERT(); ifv = ifp->if_softc; trunk = ifv->ifv_trunk; parent = NULL; if (trunk != NULL) { - - TRUNK_LOCK(trunk); + /* + * Both vlan_transmit and vlan_input rely on the trunk fields + * being NULL to determine whether to bail, so we need to get + * an exclusive lock here to prevent them from using bad + * ifvlans. + */ + VLAN_WLOCK(); parent = trunk->parent; /* @@ -1429,7 +1593,14 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing) } vlan_setflags(ifp, 0); /* clear special flags on parent */ + + /* + * The trunk lock isn't actually required here, but + * vlan_remhash expects it. + */ + TRUNK_WLOCK(trunk); vlan_remhash(trunk, ifv); + TRUNK_WUNLOCK(trunk); ifv->ifv_trunk = NULL; /* @@ -1437,17 +1608,9 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing) */ if (trunk->refcnt == 0) { parent->if_vlantrunk = NULL; - /* - * XXXGL: If some ithread has already entered - * vlan_input() and is now blocked on the trunk - * lock, then it should preempt us right after - * unlock and finish its work. Then we will acquire - * lock again in trunk_destroy(). - */ - TRUNK_UNLOCK(trunk); trunk_destroy(trunk); - } else - TRUNK_UNLOCK(trunk); + } + VLAN_WUNLOCK(); } /* Disconnect from parent. */ @@ -1474,7 +1637,7 @@ vlan_setflag(struct ifnet *ifp, int flag, int status, struct ifvlan *ifv; int error; - /* XXX VLAN_LOCK_ASSERT(); */ + VLAN_SXLOCK_ASSERT(); ifv = ifp->if_softc; status = status ? (ifp->if_flags & flag) : 0; @@ -1522,36 +1685,41 @@ vlan_setflags(struct ifnet *ifp, int status) static void vlan_link_state(struct ifnet *ifp) { - struct ifvlantrunk *trunk = ifp->if_vlantrunk; + struct ifvlantrunk *trunk; struct ifvlan *ifv; - int i; + VLAN_LOCK_READER; - TRUNK_LOCK(trunk); -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if (trunk->vlans[i] != NULL) { - ifv = trunk->vlans[i]; -#else - for (i = 0; i < (1 << trunk->hwidth); i++) - LIST_FOREACH(ifv, &trunk->hash[i], ifv_list) { -#endif - ifv->ifv_ifp->if_baudrate = trunk->parent->if_baudrate; - if_link_state_change(ifv->ifv_ifp, - trunk->parent->if_link_state); - } - TRUNK_UNLOCK(trunk); + /* Called from a taskqueue_swi task, so we cannot sleep. */ + VLAN_RLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_RUNLOCK(); + return; + } + + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + ifv->ifv_ifp->if_baudrate = trunk->parent->if_baudrate; + if_link_state_change(ifv->ifv_ifp, + trunk->parent->if_link_state); + } + TRUNK_WUNLOCK(trunk); + VLAN_RUNLOCK(); } static void vlan_capabilities(struct ifvlan *ifv) { - struct ifnet *p = PARENT(ifv); - struct ifnet *ifp = ifv->ifv_ifp; + struct ifnet *p; + struct ifnet *ifp; struct ifnet_hw_tsomax hw_tsomax; int cap = 0, ena = 0, mena; u_long hwa = 0; - TRUNK_LOCK_ASSERT(TRUNK(ifv)); + VLAN_SXLOCK_ASSERT(); + TRUNK_WLOCK_ASSERT(TRUNK(ifv)); + p = PARENT(ifv); + ifp = ifv->ifv_ifp; /* Mask parent interface enabled capabilities disabled by user. */ mena = p->if_capenable & ifv->ifv_capenable; @@ -1632,22 +1800,21 @@ vlan_capabilities(struct ifvlan *ifv) static void vlan_trunk_capabilities(struct ifnet *ifp) { - struct ifvlantrunk *trunk = ifp->if_vlantrunk; + struct ifvlantrunk *trunk; struct ifvlan *ifv; - int i; - TRUNK_LOCK(trunk); -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if (trunk->vlans[i] != NULL) { - ifv = trunk->vlans[i]; -#else - for (i = 0; i < (1 << trunk->hwidth); i++) { - LIST_FOREACH(ifv, &trunk->hash[i], ifv_list) -#endif - vlan_capabilities(ifv); + VLAN_SLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_SUNLOCK(); + return; } - TRUNK_UNLOCK(trunk); + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + vlan_capabilities(ifv); + } + TRUNK_WUNLOCK(trunk); + VLAN_SUNLOCK(); } static int @@ -1660,6 +1827,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data struct ifvlantrunk *trunk; struct vlanreq vlr; int error = 0; + VLAN_LOCK_READER; ifr = (struct ifreq *)data; ifa = (struct ifaddr *) data; @@ -1682,11 +1850,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } break; case SIOCGIFMEDIA: - VLAN_LOCK(); + VLAN_SLOCK(); if (TRUNK(ifv) != NULL) { p = PARENT(ifv); if_ref(p); - VLAN_UNLOCK(); error = (*p->if_ioctl)(p, SIOCGIFMEDIA, data); if_rele(p); /* Limit the result to the parent's current config. */ @@ -1702,9 +1869,9 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } } } else { - VLAN_UNLOCK(); error = EINVAL; } + VLAN_SUNLOCK(); break; case SIOCSIFMEDIA: @@ -1715,8 +1882,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data /* * Set the interface MTU. */ - VLAN_LOCK(); - if (TRUNK(ifv) != NULL) { + VLAN_SLOCK(); + trunk = TRUNK(ifv); + if (trunk != NULL) { + TRUNK_WLOCK(trunk); if (ifr->ifr_mtu > (PARENT(ifv)->if_mtu - ifv->ifv_mtufudge) || ifr->ifr_mtu < @@ -1724,9 +1893,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data error = EINVAL; else ifp->if_mtu = ifr->ifr_mtu; + TRUNK_WUNLOCK(trunk); } else error = EINVAL; - VLAN_UNLOCK(); + VLAN_SUNLOCK(); break; case SIOCSETVLAN: @@ -1757,11 +1927,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } error = vlan_config(ifv, p, vlr.vlr_tag); if_rele(p); - if (error) - break; - - /* Update flags on the parent, if necessary. */ - vlan_setflags(ifp, 1); break; case SIOCGETVLAN: @@ -1772,13 +1937,13 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } #endif bzero(&vlr, sizeof(vlr)); - VLAN_LOCK(); + VLAN_SLOCK(); if (TRUNK(ifv) != NULL) { strlcpy(vlr.vlr_parent, PARENT(ifv)->if_xname, sizeof(vlr.vlr_parent)); vlr.vlr_tag = ifv->ifv_vid; } - VLAN_UNLOCK(); + VLAN_SUNLOCK(); error = copyout(&vlr, ifr->ifr_data, sizeof(vlr)); break; @@ -1787,8 +1952,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data * We should propagate selected flags to the parent, * e.g., promiscuous mode. */ + VLAN_XLOCK(); if (TRUNK(ifv) != NULL) error = vlan_setflags(ifp, 1); + VLAN_XUNLOCK(); break; case SIOCADDMULTI: @@ -1796,13 +1963,18 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data /* * If we don't have a parent, just remember the membership for * when we do. + * + * XXX We need the rmlock here to avoid sleeping while + * holding in6_multi_mtx. */ + VLAN_RLOCK(); trunk = TRUNK(ifv); if (trunk != NULL) { - TRUNK_LOCK(trunk); + TRUNK_WLOCK(trunk); error = vlan_setmulti(ifp); - TRUNK_UNLOCK(trunk); + TRUNK_WUNLOCK(trunk); } + VLAN_RUNLOCK(); break; case SIOCGVLANPCP: @@ -1834,15 +2006,15 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; case SIOCSIFCAP: - VLAN_LOCK(); + VLAN_SLOCK(); ifv->ifv_capenable = ifr->ifr_reqcap; trunk = TRUNK(ifv); if (trunk != NULL) { - TRUNK_LOCK(trunk); + TRUNK_WLOCK(trunk); vlan_capabilities(ifv); - TRUNK_UNLOCK(trunk); + TRUNK_WUNLOCK(trunk); } - VLAN_UNLOCK(); + VLAN_SUNLOCK(); break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Sep 12 04:21:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D86C9E1612A; Tue, 12 Sep 2017 04:21:05 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A640262B; Tue, 12 Sep 2017 04:21:05 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C4L4tl010781; Tue, 12 Sep 2017 04:21:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C4L4Fh010780; Tue, 12 Sep 2017 04:21:04 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201709120421.v8C4L4Fh010780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 12 Sep 2017 04:21:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323478 - 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: 323478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 04:21:06 -0000 Author: cy Date: Tue Sep 12 04:21:04 2017 New Revision: 323478 URL: https://svnweb.freebsd.org/changeset/base/323478 Log: Improve the wording of a comment describing why EAGAIN is the error code. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Tue Sep 12 03:54:04 2017 (r323477) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Tue Sep 12 04:21:04 2017 (r323478) @@ -1383,10 +1383,10 @@ ipf_state_add(softc, fin, stsave, flags) int out; /* - * If a packet that was created locally is trying to go out but we - * do not match here here because of this lock, it is likely that - * the policy will block it and return network unreachable back up - * the stack. To mitigate this error, EAGAIN is returned instead, + * If a locally created packet is trying to egress but it + * does not match because of this lock, it is likely that + * the policy will block it and return network unreachable further + * up the stack. To mitigate this error, EAGAIN is returned instead, * telling the IP stack to try sending this packet again later. */ if (softs->ipf_state_lock) { From owner-svn-src-all@freebsd.org Tue Sep 12 06:02:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C05E2E1AA06; Tue, 12 Sep 2017 06:02:22 +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 8C15F3717; Tue, 12 Sep 2017 06:02:22 +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 v8C62Lmv052480; Tue, 12 Sep 2017 06:02:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C62LY2052478; Tue, 12 Sep 2017 06:02:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709120602.v8C62LY2052478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Sep 2017 06:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323479 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 323479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:02:22 -0000 Author: avg Date: Tue Sep 12 06:02:21 2017 New Revision: 323479 URL: https://svnweb.freebsd.org/changeset/base/323479 Log: zfs: tighten debug versions of ZTOV and VTOZ MFC after: 2 weeks Sponsored by: Panzura Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Sep 12 04:21:04 2017 (r323478) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Sep 12 06:02:21 2017 (r323479) @@ -227,7 +227,7 @@ ZTOV(znode_t *zp) { vnode_t *vp = zp->z_vnode; - ASSERT(vp == NULL || vp->v_data == NULL || vp->v_data == zp); + ASSERT(vp != NULL && vp->v_data == zp); return (vp); } static __inline znode_t * @@ -235,7 +235,7 @@ VTOZ(vnode_t *vp) { znode_t *zp = (znode_t *)vp->v_data; - ASSERT(zp == NULL || zp->z_vnode == NULL || zp->z_vnode == vp); + ASSERT(zp != NULL && zp->z_vnode == vp); return (zp); } #else Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Sep 12 04:21:04 2017 (r323478) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Sep 12 06:02:21 2017 (r323479) @@ -143,8 +143,7 @@ zfs_znode_cache_destructor(void *buf, void *arg) znode_t *zp = buf; ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs)); - ASSERT(ZTOV(zp) == NULL); - vn_free(ZTOV(zp)); + ASSERT3P(zp->z_vnode, ==, NULL); ASSERT(!list_link_active(&zp->z_link_node)); mutex_destroy(&zp->z_acl_lock); avl_destroy(&zp->z_range_avl); From owner-svn-src-all@freebsd.org Tue Sep 12 06:04:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6158DE1AB95; Tue, 12 Sep 2017 06:04:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2AADB38C3; Tue, 12 Sep 2017 06:04:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C641lM052578; Tue, 12 Sep 2017 06:04:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C641MV052577; Tue, 12 Sep 2017 06:04:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709120604.v8C641MV052577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Sep 2017 06:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323480 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:04:02 -0000 Author: avg Date: Tue Sep 12 06:04:01 2017 New Revision: 323480 URL: https://svnweb.freebsd.org/changeset/base/323480 Log: zfs_get_vfs: reference a requested filesystem instead of vfs_busy-ing it The only consumer of zfs_get_vfs, zfs_unmount_snap, does not need the filesystem to be busy, it just need a reference that it can pass to dounmount. Also, previously the code was racy as it unbusied the filesystem before taking a reference on it. Now the code should be simpler and safer. MFC after: 2 weeks Sponsored by: Panzura Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 12 06:02:21 2017 (r323479) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 12 06:04:01 2017 (r323480) @@ -3049,13 +3049,11 @@ zfs_get_vfs(const char *resource) mtx_lock(&mountlist_mtx); TAILQ_FOREACH(vfsp, &mountlist, mnt_list) { if (strcmp(refstr_value(vfsp->vfs_resource), resource) == 0) { - if (vfs_busy(vfsp, MBF_MNTLSTLOCK) != 0) - vfsp = NULL; + vfs_ref(vfsp); break; } } - if (vfsp == NULL) - mtx_unlock(&mountlist_mtx); + mtx_unlock(&mountlist_mtx); return (vfsp); } @@ -3545,7 +3543,9 @@ zfs_unmount_snap(const char *snapname) { vfs_t *vfsp; zfsvfs_t *zfsvfs; +#ifdef illumos int err; +#endif if (strchr(snapname, '@') == NULL) return (0); @@ -3557,23 +3557,19 @@ zfs_unmount_snap(const char *snapname) zfsvfs = vfsp->vfs_data; ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os))); - err = vn_vfswlock(vfsp->vfs_vnodecovered); #ifdef illumos + err = vn_vfswlock(vfsp->vfs_vnodecovered); VFS_RELE(vfsp); -#else - vfs_unbusy(vfsp); -#endif if (err != 0) return (SET_ERROR(err)); +#endif /* * Always force the unmount for snapshots. */ - #ifdef illumos (void) dounmount(vfsp, MS_FORCE, kcred); #else - vfs_ref(vfsp); (void) dounmount(vfsp, MS_FORCE, curthread); #endif return (0); From owner-svn-src-all@freebsd.org Tue Sep 12 06:04:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C86C0E1AC65; Tue, 12 Sep 2017 06:04:51 +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 965DB3A48; Tue, 12 Sep 2017 06:04:51 +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 v8C64o3Q052643; Tue, 12 Sep 2017 06:04:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C64opD052642; Tue, 12 Sep 2017 06:04:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709120604.v8C64opD052642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Sep 2017 06:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323481 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:04:51 -0000 Author: avg Date: Tue Sep 12 06:04:50 2017 New Revision: 323481 URL: https://svnweb.freebsd.org/changeset/base/323481 Log: zfsvfs_hold: assert that the busied filesystem can not be unmounted This is a FreeBSD specific feature. MFC after: 3 weeks Sponsored by: Panzura Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 12 06:04:01 2017 (r323480) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 12 06:04:50 2017 (r323481) @@ -1488,6 +1488,7 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zf if (error == 0) { rrm_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER : RW_READER, tag); +#ifdef illumos if ((*zfvp)->z_unmounted) { /* * XXX we could probably try again, since the unmounting @@ -1497,6 +1498,13 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zf rrm_exit(&(*zfvp)->z_teardown_lock, tag); return (SET_ERROR(EBUSY)); } +#else + /* + * vfs_busy() ensures that the filesystem is not and + * can not be unmounted. + */ + ASSERT(!(*zfvp)->z_unmounted); +#endif } return (error); } From owner-svn-src-all@freebsd.org Tue Sep 12 06:05:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FBC1E1AD66; Tue, 12 Sep 2017 06:05:32 +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 F14BF3BB7; Tue, 12 Sep 2017 06:05:31 +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 v8C65V5C052716; Tue, 12 Sep 2017 06:05:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C65Vgn052715; Tue, 12 Sep 2017 06:05:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709120605.v8C65Vgn052715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Sep 2017 06:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323482 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:05:32 -0000 Author: avg Date: Tue Sep 12 06:05:30 2017 New Revision: 323482 URL: https://svnweb.freebsd.org/changeset/base/323482 Log: zfs_ctldir: remove obsolete / bogus ARGSUSED lint directives None of the tagged functions had unused parameters. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 12 06:04:50 2017 (r323481) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 12 06:05:30 2017 (r323482) @@ -434,7 +434,6 @@ zfsctl_root(zfsvfs_t *zfsvfs, int flags, vnode_t **vpp /* * Common open routine. Disallow any write access. */ -/* ARGSUSED */ static int zfsctl_common_open(struct vop_open_args *ap) { @@ -459,7 +458,6 @@ zfsctl_common_close(struct vop_close_args *ap) /* * Common access routine. Disallow writes. */ -/* ARGSUSED */ static int zfsctl_common_access(ap) struct vop_access_args /* { @@ -515,7 +513,6 @@ zfsctl_common_getattr(vnode_t *vp, vattr_t *vap) vap->va_nlink = 2; } -/*ARGSUSED*/ static int zfsctl_common_fid(ap) struct vop_fid_args /* { @@ -569,7 +566,6 @@ zfsctl_common_print(ap) /* * Get root directory attributes. */ -/* ARGSUSED */ static int zfsctl_root_getattr(ap) struct vop_getattr_args /* { @@ -821,7 +817,6 @@ zfsctl_snapshot_vnode_setup(vnode_t *vp, void *arg) * snapshot if it exist, creating the pseudo filesystem vnode as necessary. * Perform a mount of the associated dataset on top of the vnode. */ -/* ARGSUSED */ int zfsctl_snapdir_lookup(ap) struct vop_lookup_args /* { @@ -1013,7 +1008,6 @@ zfsctl_snapdir_readdir(ap) /* NOTREACHED */ } -/* ARGSUSED */ static int zfsctl_snapdir_getattr(ap) struct vop_getattr_args /* { From owner-svn-src-all@freebsd.org Tue Sep 12 06:06:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7164FE1AE4E; Tue, 12 Sep 2017 06:06:59 +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 4C84C3D26; Tue, 12 Sep 2017 06:06:59 +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 v8C66wJm052806; Tue, 12 Sep 2017 06:06:58 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C66wD3052805; Tue, 12 Sep 2017 06:06:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709120606.v8C66wD3052805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Sep 2017 06:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323483 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:06:59 -0000 Author: avg Date: Tue Sep 12 06:06:58 2017 New Revision: 323483 URL: https://svnweb.freebsd.org/changeset/base/323483 Log: zfsctl_snapdir_lookup should be able to handle an uncovered vnode The uncovered vnode is possible because there is no guarantee that its hold count would go to zero (and it would be inactivated and reclaimed) immediately after a covering filesystem is unmounted. So, such a vnode should be expected and it is possible to re-use it without any trouble. MFC after: 3 weeks Sponsored by: Panzura Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 12 06:05:30 2017 (r323482) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 12 06:06:58 2017 (r323483) @@ -816,6 +816,12 @@ zfsctl_snapshot_vnode_setup(vnode_t *vp, void *arg) * Lookup entry point for the 'snapshot' directory. Try to open the * snapshot if it exist, creating the pseudo filesystem vnode as necessary. * Perform a mount of the associated dataset on top of the vnode. + * There are four possibilities: + * - the snapshot node and vnode do not exist + * - the snapshot vnode is covered by the mounted snapshot + * - the snapshot vnode is not covered yet, the mount operation is in progress + * - the snapshot vnode is not covered, because the snapshot has been unmounted + * The last two states are transient and should be relatively short-lived. */ int zfsctl_snapdir_lookup(ap) @@ -881,7 +887,7 @@ zfsctl_snapdir_lookup(ap) /* * The vnode must be referenced at least by this thread and - * the mounted snapshot or the thread doing the mounting. + * the mount point or the thread doing the mounting. * There can be more references from concurrent lookups. */ KASSERT(vrefcnt(*vpp) > 1, ("found unreferenced mountpoint")); @@ -893,22 +899,31 @@ zfsctl_snapdir_lookup(ap) if (err != EJUSTRETURN) return (err); -#ifdef INVARIANTS /* - * If the vnode not covered yet, then the mount operation - * must be in progress. + * If the vnode is not covered, then either the mount operation + * is in progress or the snapshot has already been unmounted + * but the vnode hasn't been inactivated and reclaimed yet. + * We can try to re-use the vnode in the latter case. */ VI_LOCK(*vpp); - KASSERT(((*vpp)->v_iflag & VI_MOUNT) != 0, - ("snapshot vnode not covered")); - VI_UNLOCK(*vpp); -#endif - vput(*vpp); + if (((*vpp)->v_iflag & VI_MOUNT) == 0) { + /* Upgrade to exclusive lock in order to: + * - avoid race conditions + * - satisfy the contract of mount_snapshot() + */ + err = VOP_LOCK(*vpp, LK_TRYUPGRADE | LK_INTERLOCK); + if (err == 0) + break; + } else { + VI_UNLOCK(*vpp); + } /* - * In this situation we can loop on uncontested locks and starve + * In this state we can loop on uncontested locks and starve * the thread doing the lengthy, non-trivial mount operation. + * So, yield to prevent that from happening. */ + vput(*vpp); kern_yield(PRI_USER); } From owner-svn-src-all@freebsd.org Tue Sep 12 06:19:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34218E1B6AF; Tue, 12 Sep 2017 06:19:21 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C6396369D; Tue, 12 Sep 2017 06:19:20 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C6JK8T056805; Tue, 12 Sep 2017 06:19:20 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C6JJ51056802; Tue, 12 Sep 2017 06:19:19 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120619.v8C6JJ51056802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 06:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323484 - stable/11/sys/boot/efi/boot1 X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/sys/boot/efi/boot1 X-SVN-Commit-Revision: 323484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:19:21 -0000 Author: rlibby Date: Tue Sep 12 06:19:19 2017 New Revision: 323484 URL: https://svnweb.freebsd.org/changeset/base/323484 Log: MFC r303723 (by markj): Fix a few cosmetic issues in boot1.efi. Modified: stable/11/sys/boot/efi/boot1/boot1.c stable/11/sys/boot/efi/boot1/ufs_module.c stable/11/sys/boot/efi/boot1/zfs_module.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/boot1/boot1.c ============================================================================== --- stable/11/sys/boot/efi/boot1/boot1.c Tue Sep 12 06:06:58 2017 (r323483) +++ stable/11/sys/boot/efi/boot1/boot1.c Tue Sep 12 06:19:19 2017 (r323484) @@ -43,7 +43,7 @@ static const boot_module_t *boot_modules[] = #endif }; -#define NUM_BOOT_MODULES (sizeof(boot_modules) / sizeof(boot_module_t*)) +#define NUM_BOOT_MODULES nitems(boot_modules) /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 @@ -330,8 +330,6 @@ load_loader(const boot_module_t **modp, dev_info_t **d const boot_module_t *mod; for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] == NULL) - continue; mod = boot_modules[i]; for (dev = mod->devices(); dev != NULL; dev = dev->next) { if (dev->preferred != preferred) @@ -354,7 +352,7 @@ load_loader(const boot_module_t **modp, dev_info_t **d * it simply boots, otherwise it returns the status of last EFI call. */ static EFI_STATUS -try_boot() +try_boot(void) { size_t bufsize, loadersize, cmdsize; void *buf, *loaderbuf; @@ -497,9 +495,6 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] == NULL) - continue; - if ((status = bs->AllocatePool(EfiLoaderData, sizeof(*devinfo), (void **)&devinfo)) != EFI_SUCCESS) { @@ -604,9 +599,6 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) printf(" Loader path: %s\n\n", PATH_LOADER_EFI); printf(" Initializing modules:"); for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] == NULL) - continue; - printf(" %s", boot_modules[i]->name); if (boot_modules[i]->init != NULL) boot_modules[i]->init(); @@ -666,10 +658,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) /* Status summary. */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if (boot_modules[i] != NULL) { - printf(" "); - boot_modules[i]->status(); - } + printf(" "); + boot_modules[i]->status(); } try_boot(); Modified: stable/11/sys/boot/efi/boot1/ufs_module.c ============================================================================== --- stable/11/sys/boot/efi/boot1/ufs_module.c Tue Sep 12 06:06:58 2017 (r323483) +++ stable/11/sys/boot/efi/boot1/ufs_module.c Tue Sep 12 06:19:19 2017 (r323484) @@ -142,7 +142,7 @@ load(const char *filepath, dev_info_t *dev, void **buf } static void -status() +status(void) { int i; dev_info_t *dev; @@ -164,7 +164,7 @@ status() } static dev_info_t * -_devices() +_devices(void) { return (devices); Modified: stable/11/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- stable/11/sys/boot/efi/boot1/zfs_module.c Tue Sep 12 06:06:58 2017 (r323483) +++ stable/11/sys/boot/efi/boot1/zfs_module.c Tue Sep 12 06:19:19 2017 (r323484) @@ -192,7 +192,7 @@ load(const char *filepath, dev_info_t *devinfo, void * } static void -status() +status(void) { spa_t *spa; @@ -210,14 +210,14 @@ status() } static void -init() +init(void) { zfs_init(); } static dev_info_t * -_devices() +_devices(void) { return (devices); From owner-svn-src-all@freebsd.org Tue Sep 12 06:21:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC74FE1B82E; Tue, 12 Sep 2017 06:21:44 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79DF8639E2; Tue, 12 Sep 2017 06:21:44 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C6LhFZ060775; Tue, 12 Sep 2017 06:21:43 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C6LhQp060772; Tue, 12 Sep 2017 06:21:43 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120621.v8C6LhQp060772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 06:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323485 - in stable/11/sys/boot: arm/uboot efi/boot1 efi/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: in stable/11/sys/boot: arm/uboot efi/boot1 efi/loader X-SVN-Commit-Revision: 323485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:21:44 -0000 Author: rlibby Date: Tue Sep 12 06:21:43 2017 New Revision: 323485 URL: https://svnweb.freebsd.org/changeset/base/323485 Log: MFC r316119 (by ngie): self_reloc.c: Pass -Wno-error=maybe-uninitialized to gcc versions greater than 4.2.1 Modified: stable/11/sys/boot/arm/uboot/Makefile stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/efi/loader/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/arm/uboot/Makefile ============================================================================== --- stable/11/sys/boot/arm/uboot/Makefile Tue Sep 12 06:19:19 2017 (r323484) +++ stable/11/sys/boot/arm/uboot/Makefile Tue Sep 12 06:21:43 2017 (r323485) @@ -15,6 +15,10 @@ UBLDR_LOADADDR?= 0x1000000 # Architecture-specific loader code SRCS= start.S conf.c self_reloc.c vers.c +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 +CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized +.endif + .if !defined(LOADER_NO_DISK_SUPPORT) LOADER_DISK_SUPPORT?= yes .else Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Tue Sep 12 06:19:19 2017 (r323484) +++ stable/11/sys/boot/efi/boot1/Makefile Tue Sep 12 06:21:43 2017 (r323485) @@ -27,6 +27,10 @@ SRCS= boot1.c self_reloc.c start.S ufs_module.c SRCS+= zfs_module.c .endif +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 +CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized +.endif + CFLAGS+= -I. CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} Modified: stable/11/sys/boot/efi/loader/Makefile ============================================================================== --- stable/11/sys/boot/efi/loader/Makefile Tue Sep 12 06:19:19 2017 (r323484) +++ stable/11/sys/boot/efi/loader/Makefile Tue Sep 12 06:21:43 2017 (r323485) @@ -31,6 +31,10 @@ CWARNFLAGS.zfs.c+= -Wno-array-bounds CWARNFLAGS.zfs.c+= -Wno-missing-prototypes .endif +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 +CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized +.endif + # We implement a slightly non-standard %S in that it always takes a # CHAR16 that's common in UEFI-land instead of a wchar_t. This only # seems to matter on arm64 where wchar_t defaults to an int instead From owner-svn-src-all@freebsd.org Tue Sep 12 06:24:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90F38E1BB47; Tue, 12 Sep 2017 06:24:45 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A2C263BCA; Tue, 12 Sep 2017 06:24:45 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C6OivW060940; Tue, 12 Sep 2017 06:24:44 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C6Oip4060938; Tue, 12 Sep 2017 06:24:44 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120624.v8C6Oip4060938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 06:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323486 - in stable/11/sys: amd64/include sys X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: in stable/11/sys: amd64/include sys X-SVN-Commit-Revision: 323486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:24:45 -0000 Author: rlibby Date: Tue Sep 12 06:24:44 2017 New Revision: 323486 URL: https://svnweb.freebsd.org/changeset/base/323486 Log: MFC r321284: efi: restrict visibility of EFIABI_ATTR-declared functions Modified: stable/11/sys/amd64/include/efi.h stable/11/sys/sys/efi.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/efi.h ============================================================================== --- stable/11/sys/amd64/include/efi.h Tue Sep 12 06:21:43 2017 (r323485) +++ stable/11/sys/amd64/include/efi.h Tue Sep 12 06:24:44 2017 (r323486) @@ -36,8 +36,14 @@ * XXX: from gcc 6.2 manual: * Note, the ms_abi attribute for Microsoft Windows 64-bit targets * currently requires the -maccumulate-outgoing-args option. + * + * Avoid EFIABI_ATTR declarations for compilers that don't support it. + * GCC support began in version 4.4. */ +#if defined(__clang__) || defined(__GNUC__) && \ + (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4) #define EFIABI_ATTR __attribute__((ms_abi)) +#endif #ifdef _KERNEL struct uuid; Modified: stable/11/sys/sys/efi.h ============================================================================== --- stable/11/sys/sys/efi.h Tue Sep 12 06:21:43 2017 (r323485) +++ stable/11/sys/sys/efi.h Tue Sep 12 06:24:44 2017 (r323486) @@ -122,6 +122,9 @@ struct efi_tblhdr { uint32_t __res; }; +#ifdef _KERNEL + +#ifdef EFIABI_ATTR struct efi_rt { struct efi_tblhdr rt_hdr; efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *) @@ -144,6 +147,7 @@ struct efi_rt { efi_status (*rt_reset)(enum efi_reset, efi_status, u_long, efi_char *) EFIABI_ATTR; }; +#endif struct efi_systbl { struct efi_tblhdr st_hdr; @@ -163,7 +167,6 @@ struct efi_systbl { uint64_t st_cfgtbl; }; -#ifdef _KERNEL extern vm_paddr_t efi_systbl_phys; #endif /* _KERNEL */ From owner-svn-src-all@freebsd.org Tue Sep 12 06:27:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2369E1BCE4; Tue, 12 Sep 2017 06:27:20 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B8AE63D34; Tue, 12 Sep 2017 06:27:20 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C6RJCv061088; Tue, 12 Sep 2017 06:27:19 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C6RJVK061087; Tue, 12 Sep 2017 06:27:19 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120627.v8C6RJVK061087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 06:27:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323487 - stable/11/lib/libefivar X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/lib/libefivar X-SVN-Commit-Revision: 323487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:27:20 -0000 Author: rlibby Date: Tue Sep 12 06:27:19 2017 New Revision: 323487 URL: https://svnweb.freebsd.org/changeset/base/323487 Log: MFC r323155: libefivar: -fno-strict-aliasing Modified: stable/11/lib/libefivar/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libefivar/Makefile ============================================================================== --- stable/11/lib/libefivar/Makefile Tue Sep 12 06:24:44 2017 (r323486) +++ stable/11/lib/libefivar/Makefile Tue Sep 12 06:27:19 2017 (r323487) @@ -64,4 +64,4 @@ WARNS?= 9 .include -CFLAGS+= -Wno-cast-align -Wno-unused-parameter +CFLAGS+= -fno-strict-aliasing -Wno-cast-align -Wno-unused-parameter From owner-svn-src-all@freebsd.org Tue Sep 12 06:31:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E93A7E1C13B; Tue, 12 Sep 2017 06:31:54 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B614A64227; Tue, 12 Sep 2017 06:31:54 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C6Vr9B062032; Tue, 12 Sep 2017 06:31:53 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C6VrmM062030; Tue, 12 Sep 2017 06:31:53 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120631.v8C6VrmM062030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 06:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323488 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 323488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:31:55 -0000 Author: rlibby Date: Tue Sep 12 06:31:53 2017 New Revision: 323488 URL: https://svnweb.freebsd.org/changeset/base/323488 Log: MFC r322940: amd64: drop q suffix from rd[fg]sbase for gas compatibility Modified: stable/11/sys/amd64/amd64/cpu_switch.S stable/11/sys/amd64/amd64/exception.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/11/sys/amd64/amd64/cpu_switch.S Tue Sep 12 06:27:19 2017 (r323487) +++ stable/11/sys/amd64/amd64/cpu_switch.S Tue Sep 12 06:31:53 2017 (r323488) @@ -108,7 +108,7 @@ ENTRY(cpu_switch) movl %fs,%eax cmpl $KUF32SEL,%eax jne 1f - rdfsbaseq %rax + rdfsbase %rax movq %rax,PCB_FSBASE(%r8) 1: movl %gs,%eax cmpl $KUG32SEL,%eax Modified: stable/11/sys/amd64/amd64/exception.S ============================================================================== --- stable/11/sys/amd64/amd64/exception.S Tue Sep 12 06:27:19 2017 (r323487) +++ stable/11/sys/amd64/amd64/exception.S Tue Sep 12 06:31:53 2017 (r323488) @@ -340,10 +340,10 @@ prot_addrf: jz 2f cmpw $KUF32SEL,TF_FS(%rsp) jne 1f - rdfsbaseq %rax + rdfsbase %rax 1: cmpw $KUG32SEL,TF_GS(%rsp) jne 2f - rdgsbaseq %rdx + rdgsbase %rdx 2: swapgs movq PCPU(CURPCB),%rdi testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) @@ -533,7 +533,7 @@ nmi_fromuserspace: jz 2f cmpw $KUF32SEL,TF_FS(%rsp) jne 1f - rdfsbaseq %rax + rdfsbase %rax movq %rax,PCB_FSBASE(%rdi) 1: cmpw $KUG32SEL,TF_GS(%rsp) jne 2f From owner-svn-src-all@freebsd.org Tue Sep 12 06:34:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D205E1C377; Tue, 12 Sep 2017 06:34:04 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 572F3643DD; Tue, 12 Sep 2017 06:34:04 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8C6Y38i065190; Tue, 12 Sep 2017 06:34:03 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8C6Y3Ug065185; Tue, 12 Sep 2017 06:34:03 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709120634.v8C6Y3Ug065185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 12 Sep 2017 06:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323489 - stable/11/contrib/binutils/opcodes X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/contrib/binutils/opcodes X-SVN-Commit-Revision: 323489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 06:34:04 -0000 Author: rlibby Date: Tue Sep 12 06:34:02 2017 New Revision: 323489 URL: https://svnweb.freebsd.org/changeset/base/323489 Log: MFC r323192: gnu binutils: FSGSBASE assembly/disassembly Modified: stable/11/contrib/binutils/opcodes/i386-dis.c stable/11/contrib/binutils/opcodes/i386-opc.h stable/11/contrib/binutils/opcodes/i386-opc.tbl stable/11/contrib/binutils/opcodes/i386-tbl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/binutils/opcodes/i386-dis.c ============================================================================== --- stable/11/contrib/binutils/opcodes/i386-dis.c Tue Sep 12 06:31:53 2017 (r323488) +++ stable/11/contrib/binutils/opcodes/i386-dis.c Tue Sep 12 06:34:02 2017 (r323489) @@ -1302,7 +1302,7 @@ static const unsigned char twobyte_uses_REPZ_prefix[25 /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */ /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */ /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */ - /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */ + /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* af */ /* b0 */ 0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, /* bf */ /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */ /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */ @@ -1793,10 +1793,10 @@ static const struct dis386 grps[][8] = { }, /* GRP15 */ { - { "fxsave", { Ev } }, - { "fxrstor", { Ev } }, - { "ldmxcsr", { Ev } }, - { "stmxcsr", { Ev } }, + { "fxsave", { { OP_0fae, v_mode } } }, + { "fxrstor", { { OP_0fae, v_mode } } }, + { "ldmxcsr", { { OP_0fae, v_mode } } }, + { "stmxcsr", { { OP_0fae, v_mode } } }, { "xsave", { Ev } }, { "xrstor", { { OP_0fae, v_mode } } }, { "xsaveopt", { { OP_0fae, v_mode } } }, @@ -5997,19 +5997,34 @@ OP_0fae (int bytemode, int sizeflag) { if (modrm.mod == 3) { - if (modrm.reg == 7) - strcpy (obuf + strlen (obuf) - sizeof ("clflush") + 1, "sfence"); - else if (modrm.reg == 6) - strcpy (obuf + strlen (obuf) - sizeof ("xsaveopt") + 1, "mfence"); - else if (modrm.reg == 5) - strcpy (obuf + strlen (obuf) - sizeof ("xrstor") + 1, "lfence"); - - if (modrm.reg < 5 || modrm.rm != 0) + if (modrm.reg >= 5 && modrm.reg <= 7 && modrm.rm == 0) { - BadOp (); /* bad sfence, mfence, or lfence */ + if (modrm.reg == 7) + strcpy (obuf + strlen (obuf) - sizeof ("clflush") + 1, "sfence"); + else if (modrm.reg == 6) + strcpy (obuf + strlen (obuf) - sizeof ("xsaveopt") + 1, "mfence"); + else if (modrm.reg == 5) + strcpy (obuf + strlen (obuf) - sizeof ("xrstor") + 1, "lfence"); + bytemode = 0; + } + else if (modrm.reg <= 3 && (prefixes & PREFIX_REPZ) != 0) + { + if (modrm.reg == 0) + strcpy (obuf + strlen (obuf) - sizeof ("fxsave") + 1, "rdfsbase"); + else if (modrm.reg == 1) + strcpy (obuf + strlen (obuf) - sizeof ("fxrstor") + 1, "rdgsbase"); + else if (modrm.reg == 2) + strcpy (obuf + strlen (obuf) - sizeof ("ldmxcsr") + 1, "wrfsbase"); + else if (modrm.reg == 3) + strcpy (obuf + strlen (obuf) - sizeof ("stmxcsr") + 1, "wrgsbase"); + used_prefixes |= PREFIX_REPZ; + bytemode = dq_mode; + } + else + { + BadOp (); return; } - bytemode = 0; } OP_E (bytemode, sizeflag); Modified: stable/11/contrib/binutils/opcodes/i386-opc.h ============================================================================== --- stable/11/contrib/binutils/opcodes/i386-opc.h Tue Sep 12 06:31:53 2017 (r323488) +++ stable/11/contrib/binutils/opcodes/i386-opc.h Tue Sep 12 06:34:02 2017 (r323489) @@ -81,6 +81,7 @@ typedef struct template #define CpuPCLMUL 0x10000000 /* Carry-less Multiplication extensions */ #define CpuRdRnd 0x20000000 /* Intel Random Number Generator extensions */ #define CpuSMAP 0x40000000 /* Intel Supervisor Mode Access Prevention */ +#define CpuFSGSBase 0x80000000 /* Read/write fs/gs segment base registers */ /* SSE4.1/4.2 Instructions required */ #define CpuSSE4 (CpuSSE4_1|CpuSSE4_2) @@ -89,7 +90,8 @@ typedef struct template #define CpuUnknownFlags (Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 \ |CpuP4|CpuSledgehammer|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3|CpuVMX \ |Cpu3dnow|Cpu3dnowA|CpuK6|CpuPadLock|CpuSVME|CpuSSSE3|CpuSSE4_1 \ - |CpuSSE4_2|CpuABM|CpuSSE4a|CpuXSAVE|CpuAES|CpuPCLMUL|CpuRdRnd|CpuSMAP) + |CpuSSE4_2|CpuABM|CpuSSE4a|CpuXSAVE|CpuAES|CpuPCLMUL|CpuRdRnd|CpuSMAP \ + |CpuFSGSBase) /* the bits in opcode_modifier are used to generate the final opcode from the base_opcode. These bits also are used to detect alternate forms of Modified: stable/11/contrib/binutils/opcodes/i386-opc.tbl ============================================================================== --- stable/11/contrib/binutils/opcodes/i386-opc.tbl Tue Sep 12 06:31:53 2017 (r323488) +++ stable/11/contrib/binutils/opcodes/i386-opc.tbl Tue Sep 12 06:34:02 2017 (r323489) @@ -1525,3 +1525,13 @@ pclmulhqhqdq, 2, 0x660f3a44, 0x11, CpuPCLMUL, Modrm|Ig // Intel Random Number Generator extensions rdrand, 1, 0x0fc7, 0x6, CpuRdRnd, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf, { Reg16|Reg32|Reg64 } rdseed, 1, 0x0fc7, 0x7, CpuRdRnd, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf, { Reg16|Reg32|Reg64 } + +// Intel Supervisor Mode Access Prevention extensions +clac, 0, 0x0f01, 0xca, CpuSMAP, NoSuf|ImmExt, { 0 } +stac, 0, 0x0f01, 0xcb, CpuSMAP, NoSuf|ImmExt, { 0 } + +// Read/write fs/gs segment base registers +rdfsbase, 1, 0xf30fae, 0x0, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 } +rdgsbase, 1, 0xf30fae, 0x1, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 } +wrfsbase, 1, 0xf30fae, 0x2, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 } +wrgsbase, 1, 0xf30fae, 0x3, CpuFSGSBase|Cpu64, Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, { Reg32|Reg64 } Modified: stable/11/contrib/binutils/opcodes/i386-tbl.h ============================================================================== --- stable/11/contrib/binutils/opcodes/i386-tbl.h Tue Sep 12 06:31:53 2017 (r323488) +++ stable/11/contrib/binutils/opcodes/i386-tbl.h Tue Sep 12 06:34:02 2017 (r323489) @@ -4400,6 +4400,20 @@ const template i386_optab[] = NoSuf|ImmExt, { 0, 0, 0 } }, {"stac", 0, 0x0f01, 0xcb, CpuSMAP, NoSuf|ImmExt, { 0, 0, 0 } }, + + /* Read/write fs/gs segment base registers */ + {"rdfsbase", 1, 0xf30fae, 0x0, CpuFSGSBase|Cpu64, + Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, + { Reg32|Reg64 } }, + {"rdgsbase", 1, 0xf30fae, 0x1, CpuFSGSBase|Cpu64, + Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, + { Reg32|Reg64 } }, + {"wrfsbase", 1, 0xf30fae, 0x2, CpuFSGSBase|Cpu64, + Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, + { Reg32|Reg64 } }, + {"wrgsbase", 1, 0xf30fae, 0x3, CpuFSGSBase|Cpu64, + Modrm|No_bSuf|No_wSuf|No_sSuf|No_xSuf, + { Reg32|Reg64 } }, { NULL, 0, 0, 0, 0, 0, { 0 } } }; From owner-svn-src-all@freebsd.org Tue Sep 12 09:45:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7EBAE24F4C; Tue, 12 Sep 2017 09:45:42 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f45.google.com (mail-pg0-f45.google.com [74.125.83.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBA526AB9B; Tue, 12 Sep 2017 09:45:42 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f45.google.com with SMTP id u18so3783542pgo.0; Tue, 12 Sep 2017 02:45:42 -0700 (PDT) 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=VfIwAVG4oJx2B9tWvUCz380x57VBG8Kdyr2ZDQlvfz0=; b=o8TO52kzrqze1MQHKhat1dyqSRtUCWhmQCvUZFU+mVUJU0JMQpdI6TGS0bNWVCvFTm 4//+84YpTlD5vpNur6IHyseMbZHBePhxw3ka8Vo3I3gvgwD5z0toL5ggIewQ9VKV3Wrq AwrYXxpg5HMLCzOukv58NKZTz30nPTd5023bemu1PDVCP1qAPNuYmIOio8EgvWYQFEGn KMp3RhN6bUV9ct6Yeuvq3h6eh1DS0LxhPTB3Do1BJcuiDDzxD0NHx5xlm1cR/cygITSu LRL37SmUMn2V94VOjEB8Jr2Zt33Lp7epQcXdAx3j45383piEcX2gpRpJKFQt2sM2iyZg dwqQ== X-Gm-Message-State: AHPjjUhTP0dK6ZE/TZKN0SkYwGqgUpb6AkkC7GFZMCix+Q+/sMVj5EeR sysgXQRJQ5hr/ILXLBas9g== X-Received: by 10.84.133.99 with SMTP id 90mr8998178plf.148.1505209536547; Tue, 12 Sep 2017 02:45:36 -0700 (PDT) Received: from mail-pg0-f47.google.com (mail-pg0-f47.google.com. [74.125.83.47]) by smtp.gmail.com with ESMTPSA id r90sm19130695pfb.183.2017.09.12.02.45.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 02:45:36 -0700 (PDT) Received: by mail-pg0-f47.google.com with SMTP id j16so10093481pga.1; Tue, 12 Sep 2017 02:45:35 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5Zj0FyQtVx0M5ZAfO0E5A/7SL9YkFU3vNwmyiNffyzLoUO1sHfWJAkq6EbbPMWjdVSGVsFVXlDnZYqs9JolKE= X-Received: by 10.98.149.207 with SMTP id c76mr14605472pfk.198.1505209535484; Tue, 12 Sep 2017 02:45:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Tue, 12 Sep 2017 02:45:35 -0700 (PDT) In-Reply-To: <201709080437.v884bnIh029199@repo.freebsd.org> References: <201709080437.v884bnIh029199@repo.freebsd.org> From: Ryan Libby Date: Tue, 12 Sep 2017 02:45:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r323299 - stable/11/lib/msun/tests To: Ngie Cooper Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 09:45:43 -0000 On Thu, Sep 7, 2017 at 9:37 PM, Ngie Cooper wrote: > Author: ngie > Date: Fri Sep 8 04:37:49 2017 > New Revision: 323299 > URL: https://svnweb.freebsd.org/changeset/base/323299 > > Log: > MFC r321455: > > Raise WARNS to 1 > > This will enable warnings with the msun tests. > > Modified: > stable/11/lib/msun/tests/Makefile > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/lib/msun/tests/Makefile > ============================================================================== > --- stable/11/lib/msun/tests/Makefile Fri Sep 8 04:35:44 2017 (r323298) > +++ stable/11/lib/msun/tests/Makefile Fri Sep 8 04:37:49 2017 (r323299) > @@ -4,8 +4,6 @@ > > TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libm > > -WARNS?= 0 > - > # All architectures on FreeBSD have fenv.h > CFLAGS+= -DHAVE_FENV_H > > @@ -85,6 +83,8 @@ IGNORE_PRAGMA= > SRCS.ilogb2_test= ilogb_test.c > > LIBADD+= m > + > +WARNS?= 1 > > # Copied from lib/msun/Makefile > .if ${MACHINE_CPUARCH} == "i386" This seems to have broken the i386 build [1]. Did you mean to MFC it with r321483? [1] https://ci.freebsd.org/job/FreeBSD-stable-11-i386-build/1521/ From owner-svn-src-all@freebsd.org Tue Sep 12 10:43:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 531BEE024C3; Tue, 12 Sep 2017 10:43:04 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12A3C6C5D6; Tue, 12 Sep 2017 10:43:04 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CAh3YL066740; Tue, 12 Sep 2017 10:43:03 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CAh2tE066737; Tue, 12 Sep 2017 10:43:02 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201709121043.v8CAh2tE066737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Tue, 12 Sep 2017 10:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323490 - head/sys/arm/ti X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/arm/ti X-SVN-Commit-Revision: 323490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 10:43:04 -0000 Author: cognet Date: Tue Sep 12 10:43:02 2017 New Revision: 323490 URL: https://svnweb.freebsd.org/changeset/base/323490 Log: Some devices come with the same name as TI devices, so we can't rely on the "probe" method of those drivers to mean we're on e TI SoC. Introduce a new function, ti_soc_is_supported(), and use it to be sure we're really a TI system. PR: 222250 Modified: head/sys/arm/ti/ti_cpuid.c head/sys/arm/ti/ti_cpuid.h head/sys/arm/ti/ti_scm.c Modified: head/sys/arm/ti/ti_cpuid.c ============================================================================== --- head/sys/arm/ti/ti_cpuid.c Tue Sep 12 06:34:02 2017 (r323489) +++ head/sys/arm/ti/ti_cpuid.c Tue Sep 12 10:43:02 2017 (r323490) @@ -272,11 +272,7 @@ am335x_get_revision(void) static void ti_cpu_ident(void *dummy) { - phandle_t root; - - root = OF_finddevice("/"); - if (!ofw_bus_node_is_compatible(root, "ti,omap4") && - !ofw_bus_node_is_compatible(root, "ti,am33xx")) + if (!ti_soc_is_supported()) return; switch(ti_chip()) { case CHIP_OMAP_4: Modified: head/sys/arm/ti/ti_cpuid.h ============================================================================== --- head/sys/arm/ti/ti_cpuid.h Tue Sep 12 06:34:02 2017 (r323489) +++ head/sys/arm/ti/ti_cpuid.h Tue Sep 12 10:43:02 2017 (r323490) @@ -80,4 +80,10 @@ static __inline int ti_chip(void) uint32_t ti_revision(void); +static __inline bool ti_soc_is_supported(void) +{ + + return (_ti_chip != -1); +} + #endif /* _TI_CPUID_H_ */ Modified: head/sys/arm/ti/ti_scm.c ============================================================================== --- head/sys/arm/ti/ti_scm.c Tue Sep 12 06:34:02 2017 (r323489) +++ head/sys/arm/ti/ti_scm.c Tue Sep 12 10:43:02 2017 (r323490) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include "ti_scm.h" +#include "ti_cpuid.h" static struct resource_spec ti_scm_res_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Control memory window */ @@ -86,6 +87,10 @@ static struct ti_scm_softc *ti_scm_sc; static int ti_scm_probe(device_t dev) { + + if (!ti_soc_is_supported()) + return (ENXIO); + if (!ofw_bus_status_okay(dev)) return (ENXIO); From owner-svn-src-all@freebsd.org Tue Sep 12 13:21:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C8B1E09025; Tue, 12 Sep 2017 13:21:16 +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 ED4DD70FF7; Tue, 12 Sep 2017 13:21:15 +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 v8CDLFhJ030733; Tue, 12 Sep 2017 13:21:15 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CDLF4n030732; Tue, 12 Sep 2017 13:21:15 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709121321.v8CDLF4n030732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 12 Sep 2017 13:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323491 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 13:21:16 -0000 Author: avg Date: Tue Sep 12 13:21:14 2017 New Revision: 323491 URL: https://svnweb.freebsd.org/changeset/base/323491 Log: fix a fallout from the ZTOV tightening, r323479 MFC after: 13 days X-MFC with: r323479 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue Sep 12 10:43:02 2017 (r323490) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue Sep 12 13:21:14 2017 (r323491) @@ -1602,7 +1602,10 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va boolean_t trim = B_FALSE; boolean_t inherited = B_FALSE; - ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); + if ((flag & IS_ROOT_NODE) == 0) + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); + else + ASSERT(dzp->z_vnode == NULL); bzero(acl_ids, sizeof (zfs_acl_ids_t)); acl_ids->z_mode = MAKEIMODE(vap->va_type, vap->va_mode); From owner-svn-src-all@freebsd.org Tue Sep 12 13:34:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F054E09B0E; Tue, 12 Sep 2017 13:34:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 191E371A2E; Tue, 12 Sep 2017 13:34:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CDYiFU036670; Tue, 12 Sep 2017 13:34:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CDYieb036667; Tue, 12 Sep 2017 13:34:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709121334.v8CDYieb036667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 12 Sep 2017 13:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323492 - in head: sys/netinet usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: sys/netinet usr.bin/sockstat X-SVN-Commit-Revision: 323492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 13:34:45 -0000 Author: tuexen Date: Tue Sep 12 13:34:43 2017 New Revision: 323492 URL: https://svnweb.freebsd.org/changeset/base/323492 Log: Add support to print the TCP stack being used. Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_var.h head/usr.bin/sockstat/sockstat.1 head/usr.bin/sockstat/sockstat.c Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Tue Sep 12 13:21:14 2017 (r323491) +++ head/sys/netinet/tcp_var.h Tue Sep 12 13:34:43 2017 (r323492) @@ -655,7 +655,7 @@ struct tcp_hhook_data { struct xtcpcb { size_t xt_len; /* length of this structure */ struct xinpcb xt_inp; - char xt_stack[TCP_FUNCTION_NAME_LEN_MAX]; /* (n) */ + char xt_stack[TCP_FUNCTION_NAME_LEN_MAX]; /* (s) */ int64_t spare64[8]; int32_t t_state; /* (s,p) */ uint32_t t_flags; /* (s,p) */ Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Tue Sep 12 13:21:14 2017 (r323491) +++ head/usr.bin/sockstat/sockstat.1 Tue Sep 12 13:34:43 2017 (r323492) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2015 +.Dd September 12, 2017 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nd list open sockets .Sh SYNOPSIS .Nm -.Op Fl 46cLlsu +.Op Fl 46cLlSsu .Op Fl j Ar jid .Op Fl p Ar ports .Op Fl P Ar protocols @@ -83,6 +83,9 @@ The argument is a comma-separated list of protocol names, as they are defined in .Xr protocols 5 . +.It Fl S +Display the protocol stack, if applicable. +This is currently only implemented for TCP. .It Fl s Display the protocol state, if applicable. This is currently only implemented for SCTP and TCP. @@ -143,6 +146,14 @@ if the endpoint could not be determined. (Internet sockets only) The address the foreign end of the socket is bound to (see .Xr getpeername 2 ) . +.It Li STATE +The protocol state if +.Fl s +is specified (only for SCTP or TCP). +.It Li STACK +The protocol stack if +.Fl S +is specified (only for TCP). .El .Pp If a socket is associated with more than one file descriptor, Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Tue Sep 12 13:21:14 2017 (r323491) +++ head/usr.bin/sockstat/sockstat.c Tue Sep 12 13:34:43 2017 (r323492) @@ -73,6 +73,7 @@ static int opt_c; /* Show connected sockets */ static int opt_j; /* Show specified jail */ static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ static int opt_l; /* Show listening sockets */ +static int opt_S; /* Show protocol stack if applicable */ static int opt_s; /* Show protocol state if applicable */ static int opt_u; /* Show Unix domain sockets */ static int opt_v; /* Verbose mode */ @@ -106,6 +107,7 @@ struct sock { int proto; int state; const char *protoname; + char stack[TCP_FUNCTION_NAME_LEN_MAX]; struct addr *laddr; struct addr *faddr; struct sock *next; @@ -698,8 +700,11 @@ gather_inet(int proto) sock->laddr = laddr; sock->faddr = faddr; sock->vflag = xip->inp_vflag; - if (proto == IPPROTO_TCP) + if (proto == IPPROTO_TCP) { sock->state = xtp->t_state; + memcpy(sock->stack, xtp->xt_stack, + TCP_FUNCTION_NAME_LEN_MAX); + } sock->protoname = protoname; hash = (int)((uintptr_t)sock->socket % HASHSIZE); sock->next = sockhash[hash]; @@ -1040,22 +1045,37 @@ displaysock(struct sock *s, int pos) default: abort(); } - if (first && opt_s && - (s->proto == IPPROTO_SCTP || s->proto == IPPROTO_TCP)) { - while (pos < 80) - pos += xprintf(" "); - switch (s->proto) { - case IPPROTO_SCTP: - pos += xprintf("%s", sctp_state(s->state)); - break; - case IPPROTO_TCP: - if (s->state >= 0 && s->state < TCP_NSTATES) - pos += - xprintf("%s", tcpstates[s->state]); - else - pos += xprintf("?"); - break; + if (first) { + if (opt_s && + (s->proto == IPPROTO_SCTP || + s->proto == IPPROTO_TCP)) { + while (pos < 80) + pos += xprintf(" "); + switch (s->proto) { + case IPPROTO_SCTP: + pos += xprintf("%s", + sctp_state(s->state)); + break; + case IPPROTO_TCP: + if (s->state >= 0 && + s->state < TCP_NSTATES) + pos += + xprintf("%s", + tcpstates[s->state]); + else + pos += xprintf("?"); + break; + } } + if (opt_S && s->proto == IPPROTO_TCP) { + while (pos < 80) + pos += xprintf(" "); + if (opt_s) + while (pos < 93) + pos += xprintf(" "); + xprintf("%.*s", TCP_FUNCTION_NAME_LEN_MAX, + s->stack); + } } if (laddr != NULL) laddr = laddr->next; @@ -1083,6 +1103,8 @@ display(void) "LOCAL ADDRESS", "FOREIGN ADDRESS"); if (opt_s) printf(" %-12s", "STATE"); + if (opt_S) + printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); printf("\n"); setpassent(1); for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { @@ -1153,7 +1175,7 @@ static void usage(void) { fprintf(stderr, - "usage: sockstat [-46cLlsu] [-j jid] [-p ports] [-P protocols]\n"); + "usage: sockstat [-46cLlSsu] [-j jid] [-p ports] [-P protocols]\n"); exit(1); } @@ -1164,7 +1186,7 @@ main(int argc, char *argv[]) int o, i; opt_j = -1; - while ((o = getopt(argc, argv, "46cj:Llp:P:suv")) != -1) + while ((o = getopt(argc, argv, "46cj:Llp:P:Ssuv")) != -1) switch (o) { case '4': opt_4 = 1; @@ -1189,6 +1211,9 @@ main(int argc, char *argv[]) break; case 'P': protos_defined = parse_protos(optarg); + break; + case 'S': + opt_S = 1; break; case 's': opt_s = 1; From owner-svn-src-all@freebsd.org Tue Sep 12 13:39:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7B9AE09D2C; Tue, 12 Sep 2017 13:39:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8272371C47; Tue, 12 Sep 2017 13:39:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CDdipP036960; Tue, 12 Sep 2017 13:39:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CDdiWH036958; Tue, 12 Sep 2017 13:39:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709121339.v8CDdiWH036958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 12 Sep 2017 13:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323493 - head/usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/tcpdrop X-SVN-Commit-Revision: 323493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 13:39:45 -0000 Author: tuexen Date: Tue Sep 12 13:39:44 2017 New Revision: 323493 URL: https://svnweb.freebsd.org/changeset/base/323493 Log: Allow TCP connections to be filtered by stack and state. Choose the command line options to be consistent with the ones of sockstat. Sponsored by: Netflix, Inc. Modified: head/usr.sbin/tcpdrop/tcpdrop.8 head/usr.sbin/tcpdrop/tcpdrop.c Modified: head/usr.sbin/tcpdrop/tcpdrop.8 ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.8 Tue Sep 12 13:34:43 2017 (r323492) +++ head/usr.sbin/tcpdrop/tcpdrop.8 Tue Sep 12 13:39:44 2017 (r323493) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2013 +.Dd September 12, 2017 .Dt TCPDROP 8 .Os .Sh NAME @@ -32,6 +32,16 @@ .Nm tcpdrop .Op Fl l .Fl a +.Nm tcpdrop +.Op Fl l +.Fl S Ar stack +.Nm tcpdrop +.Op Fl l +.Fl s Ar state +.Nm tcpdrop +.Op Fl l +.Fl S Ar stack +.Fl s Ar state .Sh DESCRIPTION The .Nm @@ -41,15 +51,49 @@ If .Fl a is specified then .Nm -will attempt to drop all active connections. +will attempt to drop all TCP connections. +.Pp +If +.Fl S Ar stack +is specified then +.Nm +will attempt to drop all connections using the TCP stack +.Ar stack . +.Pp +If +.Fl s Ar state +is specified then +.Nm +will attempt to drop all TCP connections being in the state +.Ar state . +.Ar state +is one of +.Dv SYN_SENT , +.Dv SYN_RCVD , +.Dv ESTABLISHED , +.Dv CLOSE_WAIT , +.Dv FIN_WAIT_1 , +.Dv CLOSING , +.Dv LAST_ACK , +.Dv FIN_WAIT_2 , or +.Dv TIME_WAIT . +.Pp The .Fl l -flag may be given to list the tcpdrop invocation to drop all active +flag may be given in addition to the +.Fl a , +.Fl S , +or +.Fl s +options to list the tcpdrop invocation to drop all corresponding TCP connections one at a time. .Pp -If -.Fl a -is not specified then only the connection between the given local +If none of the +.Fl a , +.Fl S , +or +.Fl s +options are specified then only the connection between the given local address .Ar local-address , port @@ -88,6 +132,23 @@ port 22, the port used by .Xr sshd 8 : .Bd -literal -offset indent # tcpdrop -l -a | grep -vw 22 | sh +.Ed +.Pp +The following command will drop all connections using the TCP stack +fastack: +.Bd -literal -offset indent +# tcpdrop -S fastack +.Ed +.Pp +To drop all TCP connections in the LAST_ACK state use: +.Bd -literal -offset indent +# tcpdrop -s LAST_ACK +.Ed +.Pp +To drop all TCP connections using the TCP stack fastack and being in the +LAST_ACK state use: +.Bd -literal -offset indent +# tcpdrop -S fastack -s LAST_ACK .Ed .Sh SEE ALSO .Xr netstat 1 , Modified: head/usr.sbin/tcpdrop/tcpdrop.c ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.c Tue Sep 12 13:34:43 2017 (r323492) +++ head/usr.sbin/tcpdrop/tcpdrop.c Tue Sep 12 13:39:44 2017 (r323493) @@ -54,7 +54,7 @@ static char *findport(const char *); static struct xinpgen *getxpcblist(const char *); static void sockinfo(const struct sockaddr *, struct host_service *); static bool tcpdrop(const struct sockaddr *, const struct sockaddr *); -static bool tcpdropall(void); +static bool tcpdropall(const char *, int); static bool tcpdropbyname(const char *, const char *, const char *, const char *); static bool tcpdropconn(const struct in_conninfo *); @@ -66,13 +66,17 @@ static void usage(void); int main(int argc, char *argv[]) { + char stack[TCP_FUNCTION_NAME_LEN_MAX]; char *lport, *fport; - bool dropall; - int ch; + bool dropall, dropallstack; + int ch, state; dropall = false; + dropallstack = false; + memset(stack, 0, TCP_FUNCTION_NAME_LEN_MAX); + state = -1; - while ((ch = getopt(argc, argv, "al")) != -1) { + while ((ch = getopt(argc, argv, "alS:s:")) != -1) { switch (ch) { case 'a': dropall = true; @@ -80,6 +84,17 @@ main(int argc, char *argv[]) case 'l': tcpdrop_list_commands = true; break; + case 'S': + dropallstack = true; + strncpy(stack, optarg, TCP_FUNCTION_NAME_LEN_MAX); + break; + case 's': + dropallstack = true; + for (state = 0; state < TCP_NSTATES; state++) { + if (strcmp(tcpstates[state], optarg) == 0) + break; + } + break; default: usage(); } @@ -87,10 +102,16 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (dropall) { + if (state == TCP_NSTATES || + state == TCPS_CLOSED || + state == TCPS_LISTEN) + usage(); + if (dropall && dropallstack) + usage(); + if (dropall || dropallstack) { if (argc != 0) usage(); - if (!tcpdropall()) + if (!tcpdropall(stack, state)) exit(1); exit(0); } @@ -202,7 +223,7 @@ tcpdrop(const struct sockaddr *lsa, const struct socka } static bool -tcpdropall(void) +tcpdropall(const char *stack, int state) { struct xinpgen *head, *xinp; struct xtcpcb *xtp; @@ -234,6 +255,15 @@ tcpdropall(void) if (xtp->t_state == TCPS_LISTEN) continue; + /* If requested, skip sockets not having the requested state. */ + if ((state != -1) && (xtp->t_state != state)) + continue; + + /* If requested, skip sockets not having the requested stack. */ + if (strnlen(stack, TCP_FUNCTION_NAME_LEN_MAX) > 0 && + strncmp(xtp->xt_stack, stack, TCP_FUNCTION_NAME_LEN_MAX)) + continue; + if (!tcpdropconn(&xip->inp_inc)) ok = false; } @@ -348,6 +378,9 @@ usage(void) "usage: tcpdrop local-address local-port foreign-address foreign-port\n" " tcpdrop local-address:local-port foreign-address:foreign-port\n" " tcpdrop local-address.local-port foreign-address.foreign-port\n" -" tcpdrop [-l] -a\n"); +" tcpdrop [-l] -a\n" +" tcpdrop [-l] -S stack\n" +" tcpdrop [-l] -s state\n" +" tcpdrop [-l] -S stack -s state\n"); exit(1); } From owner-svn-src-all@freebsd.org Tue Sep 12 13:45:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21F3EE0A40B; Tue, 12 Sep 2017 13:45:06 +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 ED979723DC; Tue, 12 Sep 2017 13:45:05 +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 v8CDj50W040973; Tue, 12 Sep 2017 13:45:05 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CDj401040971; Tue, 12 Sep 2017 13:45:04 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709121345.v8CDj401040971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 12 Sep 2017 13:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323494 - in head/sys: boot/zfs cddl/boot/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/sys: boot/zfs cddl/boot/zfs X-SVN-Commit-Revision: 323494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 13:45:06 -0000 Author: tsoome Date: Tue Sep 12 13:45:04 2017 New Revision: 323494 URL: https://svnweb.freebsd.org/changeset/base/323494 Log: loader should support large_dnode The zfsonlinux feature large_dnode is not yet supported by the loader. Reviewed by: avg, allanjude Differential Revision: https://reviews.freebsd.org/D12288 Modified: head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Tue Sep 12 13:39:44 2017 (r323493) +++ head/sys/boot/zfs/zfsimpl.c Tue Sep 12 13:45:04 2017 (r323494) @@ -60,6 +60,7 @@ static const char *features_for_read[] = { "org.open-zfs:large_blocks", "org.illumos:sha512", "org.illumos:skein", + "org.zfsonlinux:large_dnode", NULL }; @@ -420,7 +421,7 @@ vdev_read_phys(vdev_t *vdev, const blkptr_t *bp, void psize = size; } - /*printf("ZFS: reading %d bytes at 0x%jx to %p\n", psize, (uintmax_t)offset, buf);*/ + /*printf("ZFS: reading %zu bytes at 0x%jx to %p\n", psize, (uintmax_t)offset, buf);*/ rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize); if (rc) return (rc); @@ -2280,7 +2281,7 @@ zfs_dnode_stat(const spa_t *spa, dnode_phys_t *dn, str sahdrp = (sa_hdr_phys_t *)DN_BONUS(dn); else { if ((dn->dn_flags & DNODE_FLAG_SPILL_BLKPTR) != 0) { - blkptr_t *bp = &dn->dn_spill; + blkptr_t *bp = DN_SPILL_BLKPTR(dn); int error; size = BP_GET_LSIZE(bp); @@ -2330,7 +2331,7 @@ zfs_dnode_readlink(const spa_t *spa, dnode_phys_t *dn, if ((dn->dn_flags & DNODE_FLAG_SPILL_BLKPTR) == 0) return (EIO); - bp = &dn->dn_spill; + bp = DN_SPILL_BLKPTR(dn); size = BP_GET_LSIZE(bp); buf = zfs_alloc(size); Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Tue Sep 12 13:39:44 2017 (r323493) +++ head/sys/cddl/boot/zfs/zfsimpl.h Tue Sep 12 13:45:04 2017 (r323494) @@ -859,10 +859,19 @@ struct uberblock { /* * Derived constants. */ -#define DNODE_SIZE (1 << DNODE_SHIFT) -#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT) -#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT)) -#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) +#define DNODE_MIN_SIZE (1 << DNODE_SHIFT) +#define DNODE_MAX_SIZE (1 << DNODE_BLOCK_SHIFT) +#define DNODE_BLOCK_SIZE (1 << DNODE_BLOCK_SHIFT) +#define DNODE_MIN_SLOTS (DNODE_MIN_SIZE >> DNODE_SHIFT) +#define DNODE_MAX_SLOTS (DNODE_MAX_SIZE >> DNODE_SHIFT) +#define DN_BONUS_SIZE(dnsize) ((dnsize) - DNODE_CORE_SIZE - \ + (1 << SPA_BLKPTRSHIFT)) +#define DN_SLOTS_TO_BONUSLEN(slots) DN_BONUS_SIZE((slots) << DNODE_SHIFT) +#define DN_OLD_MAX_BONUSLEN (DN_BONUS_SIZE(DNODE_MIN_SIZE)) +#define DN_MAX_NBLKPTR ((DNODE_MIN_SIZE - DNODE_CORE_SIZE) >> \ + SPA_BLKPTRSHIFT) +#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) +#define DN_ZERO_BONUSLEN (DN_BONUS_SIZE(DNODE_MAX_SIZE) + 1) #define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) #define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) @@ -898,7 +907,8 @@ typedef struct dnode_phys { uint8_t dn_flags; /* DNODE_FLAG_* */ uint16_t dn_datablkszsec; /* data block size in 512b sectors */ uint16_t dn_bonuslen; /* length of dn_bonus */ - uint8_t dn_pad2[4]; + uint8_t dn_extra_slots; /* # of subsequent slots consumed */ + uint8_t dn_pad2[3]; /* accounting is protected by dn_dirty_mtx */ uint64_t dn_maxblkid; /* largest allocated block ID */ @@ -906,10 +916,39 @@ typedef struct dnode_phys { uint64_t dn_pad3[4]; - blkptr_t dn_blkptr[1]; - uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof (blkptr_t)]; - blkptr_t dn_spill; + /* + * The tail region is 448 bytes for a 512 byte dnode, and + * correspondingly larger for larger dnode sizes. The spill + * block pointer, when present, is always at the end of the tail + * region. There are three ways this space may be used, using + * a 512 byte dnode for this diagram: + * + * 0 64 128 192 256 320 384 448 (offset) + * +---------------+---------------+---------------+-------+ + * | dn_blkptr[0] | dn_blkptr[1] | dn_blkptr[2] | / | + * +---------------+---------------+---------------+-------+ + * | dn_blkptr[0] | dn_bonus[0..319] | + * +---------------+-----------------------+---------------+ + * | dn_blkptr[0] | dn_bonus[0..191] | dn_spill | + * +---------------+-----------------------+---------------+ + */ + union { + blkptr_t dn_blkptr[1+DN_OLD_MAX_BONUSLEN/sizeof (blkptr_t)]; + struct { + blkptr_t __dn_ignore1; + uint8_t dn_bonus[DN_OLD_MAX_BONUSLEN]; + }; + struct { + blkptr_t __dn_ignore2; + uint8_t __dn_ignore3[DN_OLD_MAX_BONUSLEN - + sizeof (blkptr_t)]; + blkptr_t dn_spill; + }; + }; } dnode_phys_t; + +#define DN_SPILL_BLKPTR(dnp) (blkptr_t *)((char *)(dnp) + \ + (((dnp)->dn_extra_slots + 1) << DNODE_SHIFT) - (1 << SPA_BLKPTRSHIFT)) typedef enum dmu_object_byteswap { DMU_BSWAP_UINT8, From owner-svn-src-all@freebsd.org Tue Sep 12 13:47:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0E93E0A73A; Tue, 12 Sep 2017 13:47:55 +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 7D6AE72775; Tue, 12 Sep 2017 13:47:55 +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 v8CDlsxU041111; Tue, 12 Sep 2017 13:47:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CDlsjb041110; Tue, 12 Sep 2017 13:47:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709121347.v8CDlsjb041110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 12 Sep 2017 13:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323495 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 323495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 13:47:55 -0000 Author: markj Date: Tue Sep 12 13:47:54 2017 New Revision: 323495 URL: https://svnweb.freebsd.org/changeset/base/323495 Log: MFC r323166: Use O_CLOEXEC when opening persistent handles in libdtrace. Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Sep 12 13:45:04 2017 (r323494) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Sep 12 13:47:54 2017 (r323495) @@ -965,7 +965,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *d (void) snprintf(path, sizeof (path), "/dev/dtrace/%s", p1); - if ((fd = open(path, O_RDONLY)) == -1) + if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) continue; /* failed to open driver; just skip it */ if (((prov = malloc(sizeof (dt_provmod_t))) == NULL) || @@ -1102,7 +1102,7 @@ dt_vopen(int version, int flags, int *errp, */ dt_provmod_open(&provmod, &df); - dtfd = open("/dev/dtrace/dtrace", O_RDWR); + dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC); err = errno; /* save errno from opening dtfd */ #if defined(__FreeBSD__) /* @@ -1118,7 +1118,7 @@ dt_vopen(int version, int flags, int *errp, #ifdef illumos ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR); #else - ftfd = open("/dev/dtrace/fasttrap", O_RDWR); + ftfd = open("/dev/dtrace/fasttrap", O_RDWR | O_CLOEXEC); #endif fterr = ftfd == -1 ? errno : 0; /* save errno from open ftfd */ @@ -1147,9 +1147,6 @@ dt_vopen(int version, int flags, int *errp, } return (set_open_errno(dtp, errp, err)); } - - (void) fcntl(dtfd, F_SETFD, FD_CLOEXEC); - (void) fcntl(ftfd, F_SETFD, FD_CLOEXEC); alloc: if ((dtp = malloc(sizeof (dtrace_hdl_t))) == NULL) { From owner-svn-src-all@freebsd.org Tue Sep 12 13:51:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AACFE0AAE9; Tue, 12 Sep 2017 13:51:19 +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 058F872999; Tue, 12 Sep 2017 13:51:18 +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 v8CDpIcB042021; Tue, 12 Sep 2017 13:51:18 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CDpIOd042020; Tue, 12 Sep 2017 13:51:18 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709121351.v8CDpIOd042020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 12 Sep 2017 13:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323496 - head/lib/libstand X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/lib/libstand X-SVN-Commit-Revision: 323496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 13:51:19 -0000 Author: tsoome Date: Tue Sep 12 13:51:18 2017 New Revision: 323496 URL: https://svnweb.freebsd.org/changeset/base/323496 Log: libstand: tftp_open() can leak pkt on error The memory can be leaked if we will have pkt set and will get an error during tftp_open() processing. Differential Revision: https://reviews.freebsd.org/D12202 Modified: head/lib/libstand/tftp.c Modified: head/lib/libstand/tftp.c ============================================================================== --- head/lib/libstand/tftp.c Tue Sep 12 13:47:54 2017 (r323495) +++ head/lib/libstand/tftp.c Tue Sep 12 13:51:18 2017 (r323496) @@ -467,6 +467,7 @@ tftp_open(const char *path, struct open_file *f) if (res) { free(tftpfile->path); + free(tftpfile->pkt); free(tftpfile); return (res); } From owner-svn-src-all@freebsd.org Tue Sep 12 14:18:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F6AFE0BA2D; Tue, 12 Sep 2017 14:18:46 +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 5C55E737CC; Tue, 12 Sep 2017 14:18:46 +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 v8CEIjPH053660; Tue, 12 Sep 2017 14:18:45 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CEIjX5053659; Tue, 12 Sep 2017 14:18:45 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709121418.v8CEIjX5053659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 12 Sep 2017 14:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323497 - 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: 323497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 14:18:46 -0000 Author: tsoome Date: Tue Sep 12 14:18:45 2017 New Revision: 323497 URL: https://svnweb.freebsd.org/changeset/base/323497 Log: libefi: efipart_open should check the status from disk_open In case of error from disk_open(), we should clean up properly. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12340 Modified: head/sys/boot/efi/libefi/efipart.c Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Tue Sep 12 13:51:18 2017 (r323496) +++ head/sys/boot/efi/libefi/efipart.c Tue Sep 12 14:18:45 2017 (r323497) @@ -723,9 +723,20 @@ efipart_open(struct open_file *f, ...) pd->pd_bcache = bcache_allocate(); if (dev->d_dev->dv_type == DEVT_DISK) { - return (disk_open(dev, + int rc; + + rc = disk_open(dev, blkio->Media->BlockSize * (blkio->Media->LastBlock + 1), - blkio->Media->BlockSize)); + blkio->Media->BlockSize); + if (rc != 0) { + pd->pd_open--; + if (pd->pd_open == 0) { + pd->pd_blkio = NULL; + bcache_free(pd->pd_bcache); + pd->pd_bcache = NULL; + } + } + return (rc); } return (0); } From owner-svn-src-all@freebsd.org Tue Sep 12 14:38:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36C18E0C7BF; Tue, 12 Sep 2017 14:38:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F41A1742A2; Tue, 12 Sep 2017 14:38:11 +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 v8CEcA9w061543; Tue, 12 Sep 2017 14:38:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CEcAM4061542; Tue, 12 Sep 2017 14:38:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709121438.v8CEcAM4061542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 12 Sep 2017 14:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323498 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 323498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 14:38:12 -0000 Author: markj Date: Tue Sep 12 14:38:10 2017 New Revision: 323498 URL: https://svnweb.freebsd.org/changeset/base/323498 Log: Add a O_CLOEXEC use missed in r323166. PR: 199810 Reported by: Jukka A. Ukkonen MFC after: 3 days Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Sep 12 14:18:45 2017 (r323497) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Sep 12 14:38:10 2017 (r323498) @@ -1109,7 +1109,7 @@ dt_vopen(int version, int flags, int *errp, */ if (err == ENOENT && modfind("dtraceall") < 0) { kldload("dtraceall"); /* ignore the error */ - dtfd = open("/dev/dtrace/dtrace", O_RDWR); + dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC); err = errno; } #endif From owner-svn-src-all@freebsd.org Tue Sep 12 16:00:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CFCEE0FEC4; Tue, 12 Sep 2017 16:00:53 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FEF17735F; Tue, 12 Sep 2017 16:00:53 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CG0qLn096680; Tue, 12 Sep 2017 16:00:52 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CG0qBW096679; Tue, 12 Sep 2017 16:00:52 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201709121600.v8CG0qBW096679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 12 Sep 2017 16:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323499 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs X-SVN-Commit-Revision: 323499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 16:00:53 -0000 Author: lwhsu (ports committer) Date: Tue Sep 12 16:00:51 2017 New Revision: 323499 URL: https://svnweb.freebsd.org/changeset/base/323499 Log: Fix DTrace test tst_inet_ntop_d: remove definitions are already in libdtrace We have D definitions for the named values in socket.h after r323253. Remove them in test script to prevent compiling failure. Reviewed by: markj, gnn Differential Revision: https://reviews.freebsd.org/D12334 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d Tue Sep 12 14:38:10 2017 (r323498) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d Tue Sep 12 16:00:51 2017 (r323499) @@ -28,9 +28,6 @@ #pragma D option quiet -inline int AF_INET = 2; -inline int AF_INET6 = 28; - in_addr_t *ip4a; in_addr_t *ip4b; in_addr_t *ip4c; From owner-svn-src-all@freebsd.org Tue Sep 12 17:06:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BAE7E12D09; Tue, 12 Sep 2017 17:06:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 733607D8DE; Tue, 12 Sep 2017 17:06:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CH6Z2e024988; Tue, 12 Sep 2017 17:06:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CH6ZAG024985; Tue, 12 Sep 2017 17:06:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709121706.v8CH6ZAG024985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 12 Sep 2017 17:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323500 - in head: . libexec/rtld-elf/arm X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . libexec/rtld-elf/arm X-SVN-Commit-Revision: 323500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 17:06:36 -0000 Author: imp Date: Tue Sep 12 17:06:35 2017 New Revision: 323500 URL: https://svnweb.freebsd.org/changeset/base/323500 Log: End softfp->hardfp transition period for arm On hard-float 32-bit arm platforms, always search for the soft float binaries in the alternative locations. Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D12274 MFC After: 1 week Modified: head/UPDATING head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/arm/rtld_machdep.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Sep 12 16:00:51 2017 (r323499) +++ head/UPDATING Tue Sep 12 17:06:35 2017 (r323500) @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170912: + For 32-bit arm compiled for hard-float support, soft-floating point + binaries now always get their shared libraries from + LD_SOFT_LIBRARY_PATH (in the past, this was only used if + /usr/libsoft also existed). Only users with a hard-float ld.so, but + soft-float everything else should be affected. + 20170826: During boot the geli passphrase will be hidden. To restore previous behavior see geli(8) configuration options. Modified: head/libexec/rtld-elf/arm/reloc.c ============================================================================== --- head/libexec/rtld-elf/arm/reloc.c Tue Sep 12 16:00:51 2017 (r323499) +++ head/libexec/rtld-elf/arm/reloc.c Tue Sep 12 17:06:35 2017 (r323500) @@ -18,11 +18,18 @@ __FBSDID("$FreeBSD$"); #include "rtld.h" #include "paths.h" +#ifdef __ARM_FP +/* + * On processors that have hard floating point supported, we also support + * running soft float binaries. If we're being built with hard float support, + * check the ELF headers to make sure that this is a hard float binary. If it is + * a soft float binary, force the dynamic linker to use the alternative soft + * float path. + */ void arm_abi_variant_hook(Elf_Auxinfo **aux_info) { Elf_Word ehdr; - struct stat sb; /* * If we're running an old kernel that doesn't provide any data fail @@ -40,17 +47,6 @@ arm_abi_variant_hook(Elf_Auxinfo **aux_info) return; /* - * If there's no /usr/libsoft, then we don't have a system with both - * hard and soft float. In that case, hope for the best and just - * return. Such systems are required to have all soft or all hard - * float ABI binaries and libraries. This is, at best, a transition - * compatibility hack. Once we're fully hard-float, this should - * be removed. - */ - if (stat("/usr/libsoft", &sb) != 0 || !S_ISDIR(sb.st_mode)) - return; - - /* * This is a soft float ABI binary. We need to use the soft float * settings. */ @@ -60,6 +56,7 @@ arm_abi_variant_hook(Elf_Auxinfo **aux_info) ld_standard_library_path = SOFT_STANDARD_LIBRARY_PATH; ld_env_prefix = LD_SOFT_; } +#endif void init_pltgot(Obj_Entry *obj) Modified: head/libexec/rtld-elf/arm/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/arm/rtld_machdep.h Tue Sep 12 16:00:51 2017 (r323499) +++ head/libexec/rtld-elf/arm/rtld_machdep.h Tue Sep 12 17:06:35 2017 (r323500) @@ -31,6 +31,7 @@ #include #include +#include struct Struct_Obj_Entry; @@ -74,7 +75,11 @@ extern void *__tls_get_addr(tls_index *ti); extern void arm_abi_variant_hook(Elf_Auxinfo **); +#ifdef __ARM_FP #define md_abi_variant_hook(x) arm_abi_variant_hook(x) #define RTLD_VARIANT_ENV_NAMES +#else +#define md_abi_variant_hook(x) +#endif #endif From owner-svn-src-all@freebsd.org Tue Sep 12 17:46:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 372F8E14C36; Tue, 12 Sep 2017 17:46:32 +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 04DA37EF18; Tue, 12 Sep 2017 17:46:31 +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 v8CHkVeh041476; Tue, 12 Sep 2017 17:46:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CHkUdL041453; Tue, 12 Sep 2017 17:46:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709121746.v8CHkUdL041453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 12 Sep 2017 17:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323501 - in head: libexec/rtld-elf libexec/rtld-elf/mips sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: libexec/rtld-elf libexec/rtld-elf/mips sys/sys X-SVN-Commit-Revision: 323501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 17:46:32 -0000 Author: jhb Date: Tue Sep 12 17:46:30 2017 New Revision: 323501 URL: https://svnweb.freebsd.org/changeset/base/323501 Log: Handle relocations for newer non-PIC MIPS ABI. Newer binutils supports extensions to the MIPS ABI for non-PIC code that is used when compiling O32 binaries with clang 5 (but not used for N64 oddly enough). These extensions require support for R_MIPS_COPY relocations as well as a second PLT GOT using R_MIPS_JUMP_SLOT relocations. For R_MIPS_COPY, use the same approach as on other architectures where fixups are deferred to the MD do_copy_relocations. The additional PLT GOT for jump slots is located in a .got.plt section which is identified by a DT_MIPS_PLTGOT dynamic entry. This GOT also requires fixups for the first two GOT entries just as the normal GOT. However, the entry point for this second GOT uses a different calling convention. Rather than passing an offset into the GOT, it passes an offset into the .rel.plt section. This requires a second entry point (_rtld_pltbind_start) which calls the normal _rtld_bind() rather than _mips_rtld_bind(). This also means providing a real version of reloc_jmpslot() which is used by _rtld_bind(). In addition, add real implementions of reloc_plt() and reloc_jmpslots() which walk .rel.plt handling R_MIPS_JUMP_SLOT relocations. Reviewed by: kib Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D12326 Modified: head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/mips/rtld_start.S head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/sys/sys/elf_common.h Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Tue Sep 12 17:06:35 2017 (r323500) +++ head/libexec/rtld-elf/mips/reloc.c Tue Sep 12 17:46:30 2017 (r323501) @@ -67,21 +67,98 @@ __FBSDID("$FreeBSD$"); #define GOT1_RESERVED_FOR_RTLD(got) ((got)[1] & GOT1_MASK) #endif +#ifdef __mips_n64 +/* + * ELF64 MIPS encodes the relocs uniquely. The first 32-bits of info contain + * the symbol index. The top 32-bits contain three relocation types encoded + * in big-endian integer with first relocation in LSB. This means for little + * endian we have to byte swap that integer (r_type). + */ +#define Elf_Sxword Elf64_Sxword +#define ELF_R_NXTTYPE_64_P(r_type) ((((r_type) >> 8) & 0xff) == R_TYPE(64)) +#if BYTE_ORDER == LITTLE_ENDIAN +#undef ELF_R_SYM +#undef ELF_R_TYPE +#define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) +#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) +#endif +#else +#define ELF_R_NXTTYPE_64_P(r_type) (0) +#define Elf_Sxword Elf32_Sword +#endif + +void _rtld_pltbind_start(void); + void init_pltgot(Obj_Entry *obj) { + if (obj->pltgot != NULL) { obj->pltgot[0] = (Elf_Addr) &_rtld_bind_start; if (GOT1_RESERVED_FOR_RTLD(obj->pltgot)) obj->pltgot[1] = (Elf_Addr) obj | GOT1_MASK; } + if (obj->mips_pltgot != NULL) { + obj->mips_pltgot[0] = (Elf_Addr) &_rtld_pltbind_start; + obj->mips_pltgot[1] = (Elf_Addr) obj; + } } int do_copy_relocations(Obj_Entry *dstobj) { - /* Do nothing */ - return 0; + const Obj_Entry *srcobj, *defobj; + const Elf_Rel *rellim; + const Elf_Rel *rel; + const Elf_Sym *srcsym; + const Elf_Sym *dstsym; + const void *srcaddr; + const char *name; + void *dstaddr; + SymLook req; + size_t size; + int res; + + /* + * COPY relocs are invalid outside of the main program + */ + assert(dstobj->mainprog); + + rellim = (const Elf_Rel *)((caddr_t)dstobj->rel + dstobj->relsize); + for (rel = dstobj->rel; rel < rellim; rel++) { + if (ELF_R_TYPE(rel->r_info) != R_MIPS_COPY) + continue; + + dstaddr = (void *)(dstobj->relocbase + rel->r_offset); + dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info); + name = dstobj->strtab + dstsym->st_name; + size = dstsym->st_size; + + symlook_init(&req, name); + req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rel->r_info)); + req.flags = SYMLOOK_EARLY; + + for (srcobj = globallist_next(dstobj); srcobj != NULL; + srcobj = globallist_next(srcobj)) { + res = symlook_obj(&req, srcobj); + if (res == 0) { + srcsym = req.sym_out; + defobj = req.defobj_out; + break; + } + } + if (srcobj == NULL) { + _rtld_error( +"Undefined symbol \"%s\" referenced from COPY relocation in %s", + name, dstobj->path); + return (-1); + } + + srcaddr = (const void *)(defobj->relocbase + srcsym->st_value); + memcpy(dstaddr, srcaddr, size); + } + + return (0); } void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr); @@ -90,26 +167,6 @@ void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr); * It is possible for the compiler to emit relocations for unaligned data. * We handle this situation with these inlines. */ -#ifdef __mips_n64 -/* - * ELF64 MIPS encodes the relocs uniquely. The first 32-bits of info contain - * the symbol index. The top 32-bits contain three relocation types encoded - * in big-endian integer with first relocation in LSB. This means for little - * endian we have to byte swap that integer (r_type). - */ -#define Elf_Sxword Elf64_Sxword -#define ELF_R_NXTTYPE_64_P(r_type) ((((r_type) >> 8) & 0xff) == R_TYPE(64)) -#if BYTE_ORDER == LITTLE_ENDIAN -#undef ELF_R_SYM -#undef ELF_R_TYPE -#define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) -#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) -#endif -#else -#define ELF_R_NXTTYPE_64_P(r_type) (0) -#define Elf_Sxword Elf32_Sword -#endif - static __inline Elf_Sxword load_ptr(void *where, size_t len) { @@ -475,6 +532,20 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int break; } + case R_TYPE(COPY): + /* + * These are deferred until all other relocations have + * been done. All we do here is make sure that the + * COPY relocation is not in a shared library. They + * are allowed only in executable files. + */ + if (!obj->mainprog) { + _rtld_error("%s: Unexpected R_MIPS_COPY " + "relocation in shared library", obj->path); + return (-1); + } + break; + #ifdef __mips_n64 case R_TYPE(TLS_DTPMOD64): #else @@ -581,23 +652,25 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int int reloc_plt(Obj_Entry *obj) { -#if 0 const Elf_Rel *rellim; const Elf_Rel *rel; - - dbg("reloc_plt obj:%p pltrel:%p sz:%s", obj, obj->pltrel, (int)obj->pltrelsize); - dbg("gottable %p num syms:%s", obj->pltgot, obj->symtabno ); - dbg("*****************************************************"); - rellim = (const Elf_Rel *)((char *)obj->pltrel + - obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { + + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { Elf_Addr *where; - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - *where += (Elf_Addr )obj->relocbase; + + switch (ELF_R_TYPE(rel->r_info)) { + case R_MIPS_JUMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + *where += (Elf_Addr )obj->relocbase; + break; + default: + _rtld_error("Unknown relocation type %u in PLT", + (unsigned int)ELF_R_TYPE(rel->r_info)); + return (-1); + } } -#endif - /* PLT fixups were done above in the GOT relocation. */ return (0); } @@ -607,9 +680,34 @@ reloc_plt(Obj_Entry *obj) int reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockState *lockstate) { - /* Do nothing */ - obj->jmpslots_done = true; - + const Obj_Entry *defobj; + const Elf_Rel *rellim; + const Elf_Rel *rel; + const Elf_Sym *def; + + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + Elf_Addr *where; + + switch (ELF_R_TYPE(rel->r_info)) { + case R_MIPS_JUMP_SLOT: + def = find_symdef(ELF_R_SYM(rel->r_info), obj, + &defobj, SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) { + dbg("reloc_jmpslots: sym not found"); + return (-1); + } + + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + *where = (Elf_Addr)(defobj->relocbase + def->st_value); + break; + default: + _rtld_error("Unknown relocation type %u in PLT", + (unsigned int)ELF_R_TYPE(rel->r_info)); + return (-1); + } + } + return (0); } @@ -635,9 +733,11 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const const Obj_Entry *obj, const Elf_Rel *rel) { - /* Do nothing */ + assert(ELF_R_TYPE(rel->r_info) == R_MIPS_JUMP_SLOT); - return target; + if (*where != target && !ld_bind_not) + *where = target; + return (target); } void Modified: head/libexec/rtld-elf/mips/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/mips/rtld_start.S Tue Sep 12 17:06:35 2017 (r323500) +++ head/libexec/rtld-elf/mips/rtld_start.S Tue Sep 12 17:46:30 2017 (r323501) @@ -100,6 +100,9 @@ END(rtld_start) #define XCALLFRAME_A4 (0*SZREG) #endif +/* + * Trampoline for "old" PLT stubs which use .got entries. + */ .globl _rtld_bind_start .ent _rtld_bind_start _rtld_bind_start: @@ -188,3 +191,94 @@ _rtld_bind_start: nop .cfi_endproc END(_rtld_bind_start) + + +/* + * Trampoline for PLT stubs using .pltrel entries and .got.plt. + */ + .globl _rtld_pltbind_start + .ent _rtld_pltbind_start +_rtld_pltbind_start: + .frame sp, XCALLFRAME_SIZ, $15 + .cfi_startproc simple + .cfi_register ra, $15 +#if defined(__mips_o32) + move v1, gp /* save pointer to .got.plt */ +#else + move v1, t2 /* save pointer to .got.plt */ +#endif +#if defined(__mips_o32) || defined(__mips_o64) + PTR_ADDU t9, 8 /* modify T9 to point at .cpload */ +#endif + SETUP_GP + PTR_SUBU sp, XCALLFRAME_SIZ /* save arguments and sp value in stack */ + .cfi_def_cfa sp, XCALLFRAME_SIZ + SETUP_GP64(XCALLFRAME_GP, _rtld_pltbind_start) + SAVE_GP(XCALLFRAME_GP) +#if defined(__mips_n32) || defined(__mips_n64) + REG_S a4, XCALLFRAME_A4(sp) + .cfi_rel_offset a4, XCALLFRAME_A4 + REG_S a5, XCALLFRAME_A5(sp) + .cfi_rel_offset a5, XCALLFRAME_A5 + REG_S a6, XCALLFRAME_A6(sp) + .cfi_rel_offset a6, XCALLFRAME_A6 + REG_S a7, XCALLFRAME_A7(sp) + .cfi_rel_offset a7, XCALLFRAME_A7 +#endif + REG_S a0, XCALLFRAME_A0(sp) + .cfi_rel_offset a0, XCALLFRAME_A0 + REG_S a1, XCALLFRAME_A1(sp) + .cfi_rel_offset a1, XCALLFRAME_A1 + REG_S a2, XCALLFRAME_A2(sp) + .cfi_rel_offset a2, XCALLFRAME_A2 + REG_S a3, XCALLFRAME_A3(sp) + .cfi_rel_offset a3, XCALLFRAME_A3 + REG_S $15, XCALLFRAME_RA(sp) /* ra is in t7/t3 */ + .cfi_rel_offset ra, XCALLFRAME_RA + REG_S s0, XCALLFRAME_S0(sp) + .cfi_rel_offset s0, XCALLFRAME_S0 + move s0, sp + + move a0, v1 /* .got.plt */ +#if defined(__mips_n64) + ld a0, 8(a0) /* object = .got.plt[1] */ + sll a1, t8, 4 /* PLT entry index to .rel.plt offset */ +#else + lw a0, 4(a0) /* object = .got.plt[1] */ + sll a1, t8, 3 /* PLT entry index to .rel.plt offset */ +#endif + + PTR_LA t9, _C_LABEL(_rtld_bind) + jalr t9 + nop + + move sp, s0 + REG_L ra, XCALLFRAME_RA(sp) + .cfi_restore ra + REG_L s0, XCALLFRAME_S0(sp) + .cfi_restore s0 + REG_L a0, XCALLFRAME_A0(sp) + .cfi_restore a0 + REG_L a1, XCALLFRAME_A1(sp) + .cfi_restore a1 + REG_L a2, XCALLFRAME_A2(sp) + .cfi_restore a2 + REG_L a3, XCALLFRAME_A3(sp) + .cfi_restore a3 +#if defined(__mips_n32) || defined(__mips_n64) + REG_L a4, XCALLFRAME_A4(sp) + .cfi_restore a4 + REG_L a5, XCALLFRAME_A5(sp) + .cfi_restore a5 + REG_L a6, XCALLFRAME_A6(sp) + .cfi_restore a6 + REG_L a7, XCALLFRAME_A7(sp) + .cfi_restore a7 +#endif + RESTORE_GP64 + PTR_ADDU sp, XCALLFRAME_SIZ + move t9, v0 + jr t9 + nop + .cfi_endproc +END(_rtld_pltbind_start) Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Sep 12 17:06:35 2017 (r323500) +++ head/libexec/rtld-elf/rtld.c Tue Sep 12 17:46:30 2017 (r323501) @@ -1257,6 +1257,12 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D case DT_MIPS_RLD_MAP: *((Elf_Addr *)(dynp->d_un.d_ptr)) = (Elf_Addr) &r_debug; break; + + case DT_MIPS_PLTGOT: + obj->mips_pltgot = (Elf_Addr *) (obj->relocbase + + dynp->d_un.d_ptr); + break; + #endif #ifdef __powerpc64__ Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Tue Sep 12 17:06:35 2017 (r323500) +++ head/libexec/rtld-elf/rtld.h Tue Sep 12 17:46:30 2017 (r323501) @@ -187,6 +187,7 @@ typedef struct Struct_Obj_Entry { Elf_Word local_gotno; /* Number of local GOT entries */ Elf_Word symtabno; /* Number of dynamic symbols */ Elf_Word gotsym; /* First dynamic symbol in GOT */ + Elf_Addr *mips_pltgot; /* Second PLT GOT */ #endif #ifdef __powerpc64__ Elf_Addr glink; /* GLINK PLT call stub section */ Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Tue Sep 12 17:06:35 2017 (r323500) +++ head/sys/sys/elf_common.h Tue Sep 12 17:46:30 2017 (r323501) @@ -1059,6 +1059,8 @@ typedef struct { #define R_MIPS_CALLLO16 31 /* lower 16 bit GOT entry for function */ #define R_MIPS_JALR 37 #define R_MIPS_TLS_GD 42 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 #define R_PPC_NONE 0 /* No relocation. */ #define R_PPC_ADDR32 1 From owner-svn-src-all@freebsd.org Tue Sep 12 19:20:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC663E18FA4; Tue, 12 Sep 2017 19:20:25 +0000 (UTC) (envelope-from adridg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B5D2826A5; Tue, 12 Sep 2017 19:20:25 +0000 (UTC) (envelope-from adridg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CJKOH9078630; Tue, 12 Sep 2017 19:20:24 GMT (envelope-from adridg@FreeBSD.org) Received: (from adridg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CJKOgM078629; Tue, 12 Sep 2017 19:20:24 GMT (envelope-from adridg@FreeBSD.org) Message-Id: <201709121920.v8CJKOgM078629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adridg set sender to adridg@FreeBSD.org using -f From: Adriaan de Groot Date: Tue, 12 Sep 2017 19:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323502 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: adridg X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 323502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 19:20:25 -0000 Author: adridg (ports committer) Date: Tue Sep 12 19:20:24 2017 New Revision: 323502 URL: https://svnweb.freebsd.org/changeset/base/323502 Log: Add self to mentor-mentee data, procedure 1.5. Approved by: tcberner (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Tue Sep 12 17:46:30 2017 (r323501) +++ head/share/misc/committers-ports.dot Tue Sep 12 19:20:24 2017 (r323502) @@ -43,6 +43,7 @@ node [color=lightblue2, style=filled, bgcolor=black]; ache [label="Andrey Chernov\nache@FreeBSD.org\n1994/11/15"] acm [label="Jose Alonso Cardenas Marquez\nacm@FreeBSD.org\n2006/07/18"] adamw [label="Adam Weinberger\nadamw@FreeBSD.org\n2002/10/16"] +adridg [label="Adriaan de Groot\nadridg@FreeBSD.org\n2017/09/08"] ahze [label="Michael Johnson\nahze@FreeBSD.org\n2004/10/29"] ak [label="Alex Kozlov\nak@FreeBSD.org\n2012/02/29"] ale [label="Alex Dupre\nale@FreeBSD.org\n2004/01/12"] @@ -575,6 +576,7 @@ pi -> tz rafan -> chinsan +rakuco -> adridg rakuco -> alonso rakuco -> tcberner @@ -641,6 +643,8 @@ tabthorpe -> pgj tabthorpe -> rene tabthorpe -> zi tabthorpe -> gblach + +tcberner -> adridg thierry -> jadawin thierry -> riggs From owner-svn-src-all@freebsd.org Tue Sep 12 19:36:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B444EE19D06; Tue, 12 Sep 2017 19:36: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 903F48344B; Tue, 12 Sep 2017 19:36:25 +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 v8CJaOZI086919; Tue, 12 Sep 2017 19:36:24 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CJaOYf086916; Tue, 12 Sep 2017 19:36:24 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201709121936.v8CJaOYf086916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 12 Sep 2017 19:36:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323503 - in head: . sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: . sys/cam/ctl X-SVN-Commit-Revision: 323503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 19:36:25 -0000 Author: asomers Date: Tue Sep 12 19:36:24 2017 New Revision: 323503 URL: https://svnweb.freebsd.org/changeset/base/323503 Log: Remove spaces from CTL devices' default serial numbers It's awkward to have spaces in CAM device serial numbers. That leads to such things as device nodes named "/dev/diskid/MYSERIAL%20%20%201". Better to replace the spaces with "0"s. This change only affects the default serial numbers for users who don't provide their own. Reviewed by: ken, mav MFC after: Never Relnotes: Yes Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12263 Modified: head/UPDATING head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Sep 12 19:20:24 2017 (r323502) +++ head/UPDATING Tue Sep 12 19:36:24 2017 (r323503) @@ -52,6 +52,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** 20170912: + The default serial number format for CTL LUNs has changed. This will + affect users who use /dev/diskid/* device nodes, or whose FibreChannel + or iSCSI clients care about their LUNs' serial numbers. Users who + require serial number stability should hardcode serial numbers in + /etc/ctl.conf . + +20170912: For 32-bit arm compiled for hard-float support, soft-floating point binaries now always get their shared libraries from LD_SOFT_LIBRARY_PATH (in the past, this was only used if Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Tue Sep 12 19:20:24 2017 (r323502) +++ head/sys/cam/ctl/ctl_backend_block.c Tue Sep 12 19:36:24 2017 (r323503) @@ -2324,7 +2324,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, cbe_lun->be = &ctl_be_block_driver; if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) { - snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d", + snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%04d", softc->num_luns); strncpy((char *)cbe_lun->serial_num, tmpstr, MIN(sizeof(cbe_lun->serial_num), sizeof(tmpstr))); @@ -2338,7 +2338,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, sizeof(params->serial_num))); } if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) { - snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns); + snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%04d", softc->num_luns); strncpy((char *)cbe_lun->device_id, tmpstr, MIN(sizeof(cbe_lun->device_id), sizeof(tmpstr))); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Sep 12 19:20:24 2017 (r323502) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Sep 12 19:36:24 2017 (r323503) @@ -1096,7 +1096,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc cbe_lun->lun_config_status = ctl_backend_ramdisk_lun_config_status; cbe_lun->be = &ctl_be_ramdisk_driver; if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) { - snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d", + snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%04d", softc->num_luns); strncpy((char *)cbe_lun->serial_num, tmpstr, MIN(sizeof(cbe_lun->serial_num), sizeof(tmpstr))); @@ -1110,7 +1110,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc sizeof(params->serial_num))); } if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) { - snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns); + snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%04d", softc->num_luns); strncpy((char *)cbe_lun->device_id, tmpstr, MIN(sizeof(cbe_lun->device_id), sizeof(tmpstr))); From owner-svn-src-all@freebsd.org Tue Sep 12 21:07:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3CF5E1DFEB; Tue, 12 Sep 2017 21:07:49 +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 9DA173309; Tue, 12 Sep 2017 21:07:49 +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 v8CL7mgG027038; Tue, 12 Sep 2017 21:07:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CL7muK027036; Tue, 12 Sep 2017 21:07:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709122107.v8CL7muK027036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 12 Sep 2017 21:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323504 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 323504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 21:07:49 -0000 Author: tuexen Date: Tue Sep 12 21:07:48 2017 New Revision: 323504 URL: https://svnweb.freebsd.org/changeset/base/323504 Log: Add printing of the remote encapsulation port for SCTP associations. Sponsored by: Netflix, Inc. Modified: head/usr.bin/sockstat/sockstat.1 head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Tue Sep 12 19:36:24 2017 (r323503) +++ head/usr.bin/sockstat/sockstat.1 Tue Sep 12 21:07:48 2017 (r323504) @@ -35,7 +35,7 @@ .Nd list open sockets .Sh SYNOPSIS .Nm -.Op Fl 46cLlSsu +.Op Fl 46cLlSsUu .Op Fl j Ar jid .Op Fl p Ar ports .Op Fl P Ar protocols @@ -89,6 +89,9 @@ This is currently only implemented for TCP. .It Fl s Display the protocol state, if applicable. This is currently only implemented for SCTP and TCP. +.It Fl U +Display the remote UDP encapsulation port number, if applicable. +This is currently only implemented for SCTP. .It Fl u Show .Dv AF_LOCAL @@ -146,6 +149,10 @@ if the endpoint could not be determined. (Internet sockets only) The address the foreign end of the socket is bound to (see .Xr getpeername 2 ) . +.It Li ENCAPS +The remote UDP encapsulation port number if +.Fl U +is specified (only for SCTP). .It Li STATE The protocol state if .Fl s Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Tue Sep 12 19:36:24 2017 (r323503) +++ head/usr.bin/sockstat/sockstat.c Tue Sep 12 21:07:48 2017 (r323504) @@ -75,6 +75,7 @@ static int opt_L; /* Don't show IPv4 or IPv6 loopbac static int opt_l; /* Show listening sockets */ static int opt_S; /* Show protocol stack if applicable */ static int opt_s; /* Show protocol state if applicable */ +static int opt_U; /* Show remote UDP encapsulation port number */ static int opt_u; /* Show Unix domain sockets */ static int opt_v; /* Verbose mode */ @@ -95,6 +96,7 @@ static int *ports; struct addr { struct sockaddr_storage address; + unsigned int encaps_port; struct addr *next; }; @@ -531,6 +533,7 @@ gather_sctp(void) "address family %d not supported", xraddr->address.sa.sa_family); } + faddr->encaps_port = xraddr->encaps_port; faddr->next = NULL; if (prev_faddr == NULL) sock->faddr = faddr; @@ -979,7 +982,7 @@ static void displaysock(struct sock *s, int pos) { void *p; - int hash, first; + int hash, first, offset; struct addr *laddr, *faddr; struct sock *s_tmp; @@ -1045,34 +1048,46 @@ displaysock(struct sock *s, int pos) default: abort(); } - if (first) { - if (opt_s && - (s->proto == IPPROTO_SCTP || - s->proto == IPPROTO_TCP)) { - while (pos < 80) + offset = 80; + if (opt_U) { + if (faddr != NULL && + s->proto == IPPROTO_SCTP && + s->state != SCTP_CLOSED && + s->state != SCTP_BOUND && + s->state != SCTP_LISTEN) { + while (pos < offset) pos += xprintf(" "); - switch (s->proto) { - case IPPROTO_SCTP: - pos += xprintf("%s", - sctp_state(s->state)); - break; - case IPPROTO_TCP: - if (s->state >= 0 && - s->state < TCP_NSTATES) - pos += - xprintf("%s", - tcpstates[s->state]); - else - pos += xprintf("?"); - break; + pos += xprintf("%u", + ntohs(faddr->encaps_port)); + } + offset += 7; + } + if (first) { + if (opt_s) { + if (s->proto == IPPROTO_SCTP || + s->proto == IPPROTO_TCP) { + while (pos < offset) + pos += xprintf(" "); + switch (s->proto) { + case IPPROTO_SCTP: + pos += xprintf("%s", + sctp_state(s->state)); + break; + case IPPROTO_TCP: + if (s->state >= 0 && + s->state < TCP_NSTATES) + pos += xprintf("%s", + tcpstates[s->state]); + else + pos += xprintf("?"); + break; + } } + offset += 13; } if (opt_S && s->proto == IPPROTO_TCP) { - while (pos < 80) + while (pos < offset) pos += xprintf(" "); - if (opt_s) - while (pos < 93) - pos += xprintf(" "); xprintf("%.*s", TCP_FUNCTION_NAME_LEN_MAX, s->stack); } @@ -1101,6 +1116,8 @@ display(void) printf("%-8s %-10s %-5s %-2s %-6s %-21s %-21s", "USER", "COMMAND", "PID", "FD", "PROTO", "LOCAL ADDRESS", "FOREIGN ADDRESS"); + if (opt_U) + printf(" %-6s", "ENCAPS"); if (opt_s) printf(" %-12s", "STATE"); if (opt_S) @@ -1186,7 +1203,7 @@ main(int argc, char *argv[]) int o, i; opt_j = -1; - while ((o = getopt(argc, argv, "46cj:Llp:P:Ssuv")) != -1) + while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuv")) != -1) switch (o) { case '4': opt_4 = 1; @@ -1217,6 +1234,9 @@ main(int argc, char *argv[]) break; case 's': opt_s = 1; + break; + case 'U': + opt_U = 1; break; case 'u': opt_u = 1; From owner-svn-src-all@freebsd.org Tue Sep 12 21:08:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CB4DE1E0D2; Tue, 12 Sep 2017 21:08:52 +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 F00543475; Tue, 12 Sep 2017 21:08:51 +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 v8CL8pOC027117; Tue, 12 Sep 2017 21:08:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CL8p3L027115; Tue, 12 Sep 2017 21:08:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709122108.v8CL8p3L027115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 12 Sep 2017 21:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323505 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 323505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 21:08:52 -0000 Author: tuexen Date: Tue Sep 12 21:08:50 2017 New Revision: 323505 URL: https://svnweb.freebsd.org/changeset/base/323505 Log: Export the UDP encapsualation port and the path state. Modified: head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_uio.h Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Tue Sep 12 21:07:48 2017 (r323504) +++ head/sys/netinet/sctp_sysctl.c Tue Sep 12 21:08:50 2017 (r323505) @@ -506,6 +506,14 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xraddr.rtt = net->rtt / 1000; xraddr.heartbeat_interval = net->heart_beat_delay; xraddr.ssthresh = net->ssthresh; + xraddr.encaps_port = net->port; + if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { + xraddr.state = SCTP_UNCONFIRMED; + } else if (net->dest_state & SCTP_ADDR_REACHABLE) { + xraddr.state = SCTP_ACTIVE; + } else { + xraddr.state = SCTP_INACTIVE; + } xraddr.start_time.tv_sec = (uint32_t)net->start_time.tv_sec; xraddr.start_time.tv_usec = (uint32_t)net->start_time.tv_usec; SCTP_INP_RUNLOCK(inp); Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Tue Sep 12 21:07:48 2017 (r323504) +++ head/sys/netinet/sctp_uio.h Tue Sep 12 21:08:50 2017 (r323505) @@ -1239,7 +1239,9 @@ struct xsctp_raddr { uint32_t rtt; uint32_t heartbeat_interval; uint32_t ssthresh; - uint32_t extra_padding[30]; /* future */ + uint16_t encaps_port; + uint16_t state; + uint32_t extra_padding[29]; /* future */ }; #define SCTP_MAX_LOGGING_SIZE 30000 From owner-svn-src-all@freebsd.org Tue Sep 12 21:12:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8851E1E485; Tue, 12 Sep 2017 21:12:05 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E1323927; Tue, 12 Sep 2017 21:12:05 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CLC42F030435; Tue, 12 Sep 2017 21:12:04 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CLC4qA030434; Tue, 12 Sep 2017 21:12:04 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201709122112.v8CLC4qA030434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Tue, 12 Sep 2017 21:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323506 - head/usr.sbin/iovctl X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/usr.sbin/iovctl X-SVN-Commit-Revision: 323506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 21:12:06 -0000 Author: rstone Date: Tue Sep 12 21:12:04 2017 New Revision: 323506 URL: https://svnweb.freebsd.org/changeset/base/323506 Log: Fix incorrect error message in iovctl If the iovctl command was invoked with only the -C flag, the user would receive a message claiming that they needed to also supply either the -d flag or the -f flag. However, in the case of the -C mode, only the -f flag is acceptable. Correct this error message in this case. PR: 222050 Submitted by: Heinz N. Gies Reported by: Heinz N. Gies MFC after: 1 week Modified: head/usr.sbin/iovctl/iovctl.c Modified: head/usr.sbin/iovctl/iovctl.c ============================================================================== --- head/usr.sbin/iovctl/iovctl.c Tue Sep 12 21:08:50 2017 (r323505) +++ head/usr.sbin/iovctl/iovctl.c Tue Sep 12 21:12:04 2017 (r323506) @@ -230,15 +230,19 @@ main(int argc, char **argv) usage(); } - if (device == NULL && filename == NULL) { + if (device == NULL && filename == NULL && action != CONFIG) { warnx("Either the -d or -f flag must be specified"); usage(); } switch (action) { case CONFIG: - if (filename == NULL) { + if (device != NULL) { warnx("-d flag cannot be used with the -C flag"); + usage(); + } + if (filename == NULL) { + warnx("The -f flag must be specified"); usage(); } config_action(filename, dryrun); From owner-svn-src-all@freebsd.org Tue Sep 12 21:36:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD655E1F915; Tue, 12 Sep 2017 21:36:14 +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 A950963D59; Tue, 12 Sep 2017 21:36:14 +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 v8CLaDC5039574; Tue, 12 Sep 2017 21:36:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CLaDqg039572; Tue, 12 Sep 2017 21:36:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709122136.v8CLaDqg039572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 12 Sep 2017 21:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323507 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 323507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 21:36:14 -0000 Author: tuexen Date: Tue Sep 12 21:36:13 2017 New Revision: 323507 URL: https://svnweb.freebsd.org/changeset/base/323507 Log: Add support for printing the path state for SCTP association. Modified: head/usr.bin/sockstat/sockstat.1 head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Tue Sep 12 21:12:04 2017 (r323506) +++ head/usr.bin/sockstat/sockstat.1 Tue Sep 12 21:36:13 2017 (r323507) @@ -153,8 +153,12 @@ The address the foreign end of the socket is bound to The remote UDP encapsulation port number if .Fl U is specified (only for SCTP). -.It Li STATE -The protocol state if +.It Li PATH STATE +The path state if +.Fl s +is specified (only for SCTP). +.It Li CONN STATE +The connection state if .Fl s is specified (only for SCTP or TCP). .It Li STACK Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Tue Sep 12 21:12:04 2017 (r323506) +++ head/usr.bin/sockstat/sockstat.c Tue Sep 12 21:36:13 2017 (r323507) @@ -97,6 +97,7 @@ static int *ports; struct addr { struct sockaddr_storage address; unsigned int encaps_port; + int state; struct addr *next; }; @@ -534,6 +535,7 @@ gather_sctp(void) xraddr->address.sa.sa_family); } faddr->encaps_port = xraddr->encaps_port; + faddr->state = xraddr->state; faddr->next = NULL; if (prev_faddr == NULL) sock->faddr = faddr; @@ -939,7 +941,7 @@ check_ports(struct sock *s) } static const char * -sctp_state(int state) +sctp_conn_state(int state) { switch (state) { case SCTP_CLOSED: @@ -978,6 +980,25 @@ sctp_state(int state) } } +static const char * +sctp_path_state(int state) +{ + switch (state) { + case SCTP_UNCONFIRMED: + return "UNCONFIRMED"; + break; + case SCTP_ACTIVE: + return "ACTIVE"; + break; + case SCTP_INACTIVE: + return "INACTIVE"; + break; + default: + return "UNKNOWN"; + break; + } +} + static void displaysock(struct sock *s, int pos) { @@ -1062,6 +1083,19 @@ displaysock(struct sock *s, int pos) } offset += 7; } + if (opt_s) { + if (faddr != NULL && + s->proto == IPPROTO_SCTP && + s->state != SCTP_CLOSED && + s->state != SCTP_BOUND && + s->state != SCTP_LISTEN) { + while (pos < offset) + pos += xprintf(" "); + pos += xprintf("%s", + sctp_path_state(faddr->state)); + } + offset += 13; + } if (first) { if (opt_s) { if (s->proto == IPPROTO_SCTP || @@ -1071,7 +1105,7 @@ displaysock(struct sock *s, int pos) switch (s->proto) { case IPPROTO_SCTP: pos += xprintf("%s", - sctp_state(s->state)); + sctp_conn_state(s->state)); break; case IPPROTO_TCP: if (s->state >= 0 && @@ -1118,8 +1152,10 @@ display(void) "LOCAL ADDRESS", "FOREIGN ADDRESS"); if (opt_U) printf(" %-6s", "ENCAPS"); - if (opt_s) - printf(" %-12s", "STATE"); + if (opt_s) { + printf(" %-12s", "PATH STATE"); + printf(" %-12s", "CONN STATE"); + } if (opt_S) printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); printf("\n"); From owner-svn-src-all@freebsd.org Tue Sep 12 22:19:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9714E21B1F; Tue, 12 Sep 2017 22:19:22 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7084B65854; Tue, 12 Sep 2017 22:19:22 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CMJLXc055786; Tue, 12 Sep 2017 22:19:21 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CMJLtl055785; Tue, 12 Sep 2017 22:19:21 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201709122219.v8CMJLtl055785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 12 Sep 2017 22:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323508 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 323508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 22:19:22 -0000 Author: rpokala Date: Tue Sep 12 22:19:21 2017 New Revision: 323508 URL: https://svnweb.freebsd.org/changeset/base/323508 Log: When doing a non-interactive installation, don't display an interactive warning about a filesystem which doesn't have a mountpoint. Presumably, the person who wrote the install script knew what they were doing. Submitted by: Brian Mueller MFC after: 1 month Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D12346 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Tue Sep 12 21:36:13 2017 (r323507) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Tue Sep 12 22:19:21 2017 (r323508) @@ -1043,14 +1043,17 @@ addpartform: /* Warn if no mountpoint set */ if (strcmp(items[0].text, "freebsd-ufs") == 0 && items[2].text[0] != '/') { - dialog_vars.defaultno = TRUE; - choice = dialog_yesno("Warning", - "This partition does not have a valid mountpoint " - "(for the partition from which you intend to boot the " - "operating system, the mountpoint should be /). Are you " - "sure you want to continue?" - , 0, 0); - dialog_vars.defaultno = FALSE; + choice = 0; + if (interactive) { + dialog_vars.defaultno = TRUE; + choice = dialog_yesno("Warning", + "This partition does not have a valid mountpoint " + "(for the partition from which you intend to boot the " + "operating system, the mountpoint should be /). Are you " + "sure you want to continue?" + , 0, 0); + dialog_vars.defaultno = FALSE; + } if (choice == 1) /* cancel */ goto addpartform; } From owner-svn-src-all@freebsd.org Tue Sep 12 23:37:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 325F5E24F1D; Tue, 12 Sep 2017 23:37:01 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A68ED687A0; Tue, 12 Sep 2017 23:37:00 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CNaxgV088526; Tue, 12 Sep 2017 23:36:59 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CNaw9B088517; Tue, 12 Sep 2017 23:36:58 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201709122336.v8CNaw9B088517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 12 Sep 2017 23:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323509 - in head: share/man/man4 sys/conf sys/contrib/dev/liquidio sys/dev/liquidio sys/dev/liquidio/base sys/modules sys/modules/lio X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/contrib/dev/liquidio sys/dev/liquidio sys/dev/liquidio/base sys/modules sys/modules/lio X-SVN-Commit-Revision: 323509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 23:37:01 -0000 Author: sbruno Date: Tue Sep 12 23:36:58 2017 New Revision: 323509 URL: https://svnweb.freebsd.org/changeset/base/323509 Log: The diff is the initial submission of Cavium Liquidio 2350/2360 10/25G Intelligent NIC driver. The submission conconsists of firmware binary file and driver sources. Submitted by: pkanneganti@cavium.com (Prasad V Kanneganti) Relnotes: Yes Sponsored by: Cavium Networks Differential Revision: https://reviews.freebsd.org/D11927 Added: head/share/man/man4/liquidio.4 (contents, props changed) head/sys/contrib/dev/liquidio/ head/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu head/sys/dev/liquidio/ head/sys/dev/liquidio/base/ head/sys/dev/liquidio/base/cn23xx_pf_device.c (contents, props changed) head/sys/dev/liquidio/base/cn23xx_pf_device.h (contents, props changed) head/sys/dev/liquidio/base/cn23xx_pf_regs.h (contents, props changed) head/sys/dev/liquidio/base/lio_common.h (contents, props changed) head/sys/dev/liquidio/base/lio_config.h (contents, props changed) head/sys/dev/liquidio/base/lio_console.c (contents, props changed) head/sys/dev/liquidio/base/lio_ctrl.c (contents, props changed) head/sys/dev/liquidio/base/lio_ctrl.h (contents, props changed) head/sys/dev/liquidio/base/lio_device.c (contents, props changed) head/sys/dev/liquidio/base/lio_device.h (contents, props changed) head/sys/dev/liquidio/base/lio_droq.c (contents, props changed) head/sys/dev/liquidio/base/lio_droq.h (contents, props changed) head/sys/dev/liquidio/base/lio_image.h (contents, props changed) head/sys/dev/liquidio/base/lio_iq.h (contents, props changed) head/sys/dev/liquidio/base/lio_mem_ops.c (contents, props changed) head/sys/dev/liquidio/base/lio_mem_ops.h (contents, props changed) head/sys/dev/liquidio/base/lio_request_manager.c (contents, props changed) head/sys/dev/liquidio/base/lio_response_manager.c (contents, props changed) head/sys/dev/liquidio/base/lio_response_manager.h (contents, props changed) head/sys/dev/liquidio/lio_bsd.h (contents, props changed) head/sys/dev/liquidio/lio_core.c (contents, props changed) head/sys/dev/liquidio/lio_ioctl.c (contents, props changed) head/sys/dev/liquidio/lio_ioctl.h (contents, props changed) head/sys/dev/liquidio/lio_main.c (contents, props changed) head/sys/dev/liquidio/lio_main.h (contents, props changed) head/sys/dev/liquidio/lio_network.h (contents, props changed) head/sys/dev/liquidio/lio_rss.c (contents, props changed) head/sys/dev/liquidio/lio_rss.h (contents, props changed) head/sys/dev/liquidio/lio_rxtx.c (contents, props changed) head/sys/dev/liquidio/lio_rxtx.h (contents, props changed) head/sys/dev/liquidio/lio_sysctl.c (contents, props changed) head/sys/modules/lio/ head/sys/modules/lio/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/altq.4 head/share/man/man4/vlan.4 head/sys/conf/NOTES head/sys/conf/files head/sys/conf/files.amd64 head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue Sep 12 22:19:21 2017 (r323508) +++ head/share/man/man4/Makefile Tue Sep 12 23:36:58 2017 (r323509) @@ -253,6 +253,7 @@ MAN= aac.4 \ led.4 \ lge.4 \ ${_linux.4} \ + liquidio.4 \ lm75.4 \ lmc.4 \ lo.4 \ Modified: head/share/man/man4/altq.4 ============================================================================== --- head/share/man/man4/altq.4 Tue Sep 12 22:19:21 2017 (r323508) +++ head/share/man/man4/altq.4 Tue Sep 12 23:36:58 2017 (r323509) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 12, 2017 +.Dd August 28, 2017 .Dt ALTQ 4 .Os .Sh NAME @@ -152,6 +152,7 @@ They have been applied to the following hardware drive .Xr ixgbe 4 , .Xr jme 4 , .Xr le 4 , +.Xr liquidio 4 , .Xr msk 4 , .Xr mxge 4 , .Xr my 4 , Added: head/share/man/man4/liquidio.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/liquidio.4 Tue Sep 12 23:36:58 2017 (r323509) @@ -0,0 +1,133 @@ +.\" BSD LICENSE +.\" +.\" Copyright(c) 2017 Cavium, Inc.. All rights reserved. +.\" 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 Cavium, Inc. nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" $FreeBSD$ +.\" +.Dd August 17, 2017 +.Dt LIQUIDIO 4 +.Os +.Sh NAME +.Nm liquidio +.Nd "Cavium 10Gb/25Gb Ethernet driver for the FreeBSD operating system" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device lio" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_lio_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for 23XX 10Gb/25Gb Ethernet adapters. +The driver supports Jumbo Frames, Transmit/Receive checksum +offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), +VLAN tag insertion/extraction, VLAN checksum offload, +VLAN TSO, and Receive Side Steering (RSS) +.Pp +Support for Jumbo Frames is provided via the interface MTU setting. +Selecting an MTU larger than 1500 bytes with the +.Xr ifconfig 8 +utility configures the adapter to receive and transmit Jumbo Frames. +The maximum MTU size for Jumbo Frames is 16000. +.Pp +For more information on configuring this device, see ifconfig(8). +.Sh HARDWARE +The +.Nm +driver supports the following cards: +.Pp +.Bl -bullet -compact +.It +LiquidIO II CN2350 210SV/225SV +.It +LiquidIO II CN2360 210SV/225SV +.El +.Sh LOADER TUBABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Pp +.Bl -tag -width indent +.It Va hw.lio.fw_type +.Pp +String that specifies type of firmware to be loaded. +Default is "nic". Use "none" to load firmware from flash. +.It Va hw.lio.num_queues_per_pf0 +.Pp +Unsigned integers that specify number of queues per PF0. +Valid range is 0 to 64. +Use 0 to derive autoconfigures based on the number of +cpus with a max of 8 +.It Va hw.lio.num_queues_per_pf1 +.Pp +Unsigned integers that specify number of queues per PF1. +Valid range is 0 to 64. +Use 0 to derive autoconfigures based on the number of +cpus with a max of 8 +.It Va hw.lio.console_bitmask +.Pp +Bitmask indicating which consoles have debug output +redirected to syslog. +.It Va hw.lio.rss +.Pp +To enable/disable driver RSS support +.It Va hw.lio.hwlro +.Pp +To enable/disable hardware LRO +.Sh SUPPORT +For general information and support, +go to the Cavium support website at: +.Pa http://support.cavium.com . +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Derek Chickles Aq Mt derek.chickles@cavium.com . Modified: head/share/man/man4/vlan.4 ============================================================================== --- head/share/man/man4/vlan.4 Tue Sep 12 22:19:21 2017 (r323508) +++ head/share/man/man4/vlan.4 Tue Sep 12 23:36:58 2017 (r323509) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 8, 2016 +.Dd August 28, 2017 .Dt VLAN 4 .Os .Sh NAME @@ -135,6 +135,7 @@ in hardware: .Xr ixgb 4 , .Xr ixgbe 4 , .Xr jme 4 , +.Xr liquidio 4 , .Xr msk 4 , .Xr mxge 4 , .Xr nxge 4 , Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Tue Sep 12 22:19:21 2017 (r323508) +++ head/sys/conf/NOTES Tue Sep 12 23:36:58 2017 (r323509) @@ -1984,6 +1984,7 @@ device xmphy # XaQti XMAC II # lge: Support for PCI gigabit ethernet adapters based on the Level 1 # LXT1001 NetCellerator chipset. This includes the D-Link DGE-500SX, # SMC TigerCard 1000 (SMC9462SX), and some Addtron cards. +# lio: Support for Cavium 23XX Ethernet adapters # malo: Marvell Libertas wireless NICs. # mwl: Marvell 88W8363 802.11n wireless NICs. # Requires the mwl firmware module @@ -2143,6 +2144,7 @@ device ixgb # Intel Pro/10Gbe PCI-X Ethernet device ix # Intel Pro/10Gbe PCIE Ethernet device ixv # Intel Pro/10Gbe PCIE Ethernet VF device le # AMD Am7900 LANCE and Am79C9xx PCnet +device lio # Cavium 23XX Ethernet device mxge # Myricom Myri-10G 10GbE NIC device nxge # Neterion Xframe 10GbE Server/Storage Adapter device oce # Emulex 10 GbE (OneConnect Ethernet) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Sep 12 22:19:21 2017 (r323508) +++ head/sys/conf/files Tue Sep 12 23:36:58 2017 (r323509) @@ -2216,6 +2216,62 @@ dev/le/if_le_pci.c optional le pci dev/le/lance.c optional le dev/led/led.c standard dev/lge/if_lge.c optional lge +dev/liquidio/base/cn23xx_pf_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_console.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_ctrl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_droq.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_mem_ops.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_request_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_response_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_core.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_ioctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_main.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rss.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rxtx.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_sysctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +lio.c optional lio \ + compile-with "${AWK} -f $S/tools/fw_stub.awk lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "lio.c" +lio_23xx_nic.bin.fw.fwo optional lio \ + dependency "lio_23xx_nic.bin.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "lio_23xx_nic.bin.fw.fwo" +lio_23xx_nic.bin.fw optional lio \ + dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "lio_23xx_nic.bin.fw" dev/lmc/if_lmc.c optional lmc dev/malo/if_malo.c optional malo dev/malo/if_malohal.c optional malo Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Sep 12 22:19:21 2017 (r323508) +++ head/sys/conf/files.amd64 Tue Sep 12 23:36:58 2017 (r323509) @@ -328,6 +328,62 @@ dev/hyperv/vmbus/vmbus_res.c optional hyperv dev/hyperv/vmbus/vmbus_xact.c optional hyperv dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv +dev/liquidio/base/cn23xx_pf_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_console.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_ctrl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_droq.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_mem_ops.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_request_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_response_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_core.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_ioctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_main.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rss.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rxtx.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_sysctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +lio.c optional lio \ + compile-with "${AWK} -f $S/tools/fw_stub.awk lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "lio.c" +lio_23xx_nic.bin.fw.fwo optional lio \ + dependency "lio_23xx_nic.bin.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "lio_23xx_nic.bin.fw.fwo" +lio_23xx_nic.bin.fw optional lio \ + dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "lio_23xx_nic.bin.fw" dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb Added: head/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu Tue Sep 12 23:36:58 2017 (r323509) @@ -0,0 +1,28149 @@ +begin 644 lio_23xx_nic.bin +M0TY)0S$N-BXQ``````````````!B;V]T;V-T(#!X,C$P,#`P,#`@;G5M8V]R +M97,])"AN=6UC;W)E]`#``````/`(4&&>]_\B,0E:, +M_[$`"```B"W_OP`P_[4`*/^T`"#_LP`8_[(`$!!```3_L```/`00"PP"?WID +MA#F`/!#__#P4__`V$``)-I0`)0`0A#@`%*7X-A!``3P3$`M\$@`[-I0!`WY2 +M"<,`$(=X/!44&&9S.9``$I$\`!2E.`)0$"4\`P`@W$8```(#&"V.HE:,`D,8 +M)680``APQ2CR`+0H+0"R*"7]`#@4 +MH``$`````/R````#X``(`````-RB``A\I4@!?$,(`GQ"2((``QR\``(5/`!B +M$"4`12@E_(4```/@``@`````?(9Z`#P%``T`!C(``(`0+32E`P!\`K@'0`-X +M``#%*"L0H``N/`4#`!1%``@\!0#_`&0P)C2E_Q``Q2@D%*``&B0"``$#X``( +M`````!1```<`9#`F-*7_#P#%*"04H``2)`(``0/@``@`````/`4!`!1%``<\ +M!@(``&0H)GRE>@`4H``))`(``0/@``@`````%$8`!0!D$"8DI?\?`$4H)!"@ +M_^@D`@`!?((&@!1```,\!0#_`^``"```$"TTI?\0`&48)`"%("0`9!@K$&#_ +M^20"``$#X``(`````!1%``@\!0#_`&0P)C2E_T``Q2@D%*``)20"``$#X``( +M`````!1```<`9#`F-*7_/P#%*"04H``=)`(``0/@``@`````/`4(`!1%``@\ +M!0#_`&0P)C2E_S@`Q2@D%*``$R0"``$#X``(`````#P%`@`410`(/`4`_P!D +M,"8TI?]``,4H)!2@``DD`@`!`^``"``````\!0$`%$4`!`!D*"9\I7H`$*#_ +ML"0"``%\@@=`$$``"#P%__)\8K@`-*7]`#0&C0``12@A`*8H*Q2@_Z8D`@`! +M?(('@!!```<\!?_R?&:X`#2E<```Q2@A+*4$`!2@_YTD`@`!!($`!SP%__)\ +M9K@`-*5L``#%*"$LI0$`%*#_E20"``%\@@<`$$``"'R"!H`\!0`-?&:X`#2E +ME0``Q2@K$*#_C"0"``%\@@:`$$#_I0`````\`@#_-$+_0`!B&"0`@A`D`&(0 +M*Q!`_YX``````^``""0"``$`````9[W_./^_`,#_O@"X`(#P+?^Q`(``H(@M +M_[<`L/^V`*C_M0"@_[0`F/^S`)#_L@"(#`(P7O^P`'@,`(=Z`$`@+3P%``,\ +M`Q0`)`(``?QE1<@D!20`/`,4`#P&``?\947`)`4`0#P#%``TQO___&5%N#P# +M%`#\8$6P/`4`/S2E__X\`Q0`_&5%J#P#%`#\8D6@)`4`"(^$@8`\`Q0`_&5% +MF#P#%`#\9D60/`,4`/QB18@\`Q0`#`"(&*QB18`00`#W/`,4``P`&#@````` +M#`!^N``````40`"3/`(4&`P`?'*,1%=D%$``=#P$$`L,`&[6`````!1``-\\ +M`Q0`D&(!&!!``63_HP!P/`0!SCP&$`LTA!@`)`4`@&3&/M@,`+1>/!`4`!!` +M`-C^`D8(/`8!S@!`("T``"@M#`)F8#3&&``\`Q08W&)6@#P$$`O>`T8(/`40 +M"SP&$`L\!Q`+9(0^\&2E/Q#\0P`X9,8_&`P`%Y9DYS\@*\(`!!1``&\GWO_\ +M9B(`('/>^/)F,0`8`%[P+3P7$`L\%A`+/!40"SP4$`L\$Q`+"``!<3P2$`L, +M`C@L9@0`#-XP``!FI3]8)`8`#0P"@G0"`"`M$$``-P`````"`"`M9H4_:`P" +M@G0D!@`/$$``3``````"`"`M9F4_>`P"@G0D!@`1$$``0@`````"`"`M9D4_ +MD`P"@G0D!@`.$$``.`````!F,0`($CX`1SP$$`O>,```/`40"V2E/S@D!@`' +M#`*"=`(`("T40``&`@`@+20#``$\`A0`K$-%U-XP```"`"`M9N4_0`P"@G0D +M!@`'%$``!@(`("TD`P`!/`(4&*Q#5HS>,````@`@+6;%/T@,`H)T)`8`#!!` +M_\<"`"`M9J4_6`P"@G0D!@`-%$#_S`(`("T,`C?^``````@``5S>,```#``7 +MEF2$/GC?OP#`)`(``=^^`+C?MP"PW[8`J-^U`*#?M`"8W[,`D-^R`(C?L0"` +MW[``>`/@``AGO0#(#`(X9&8$``X(``%O9C$`"`P",%8`````"``!:-XP```, +M`CA&9@0`#P@``6+>,```/`00"PP`%Y9DA#Y`"``!F=^_`,`\!!`+/`40"V2$ +M/Z!DI3^P`Z`P+0P`%Y8\$!(4/`@Q+C4(-BX\`A(4K$B^,#P&$`L\!Q`+9$.^ +M,&3&/\ADYS_@9@2^H"0%`&HD`C$`#`)_UJ1B``1F!;Z@`Z`@+0P"@?"@H`!I +M#``%I@`````,`'W8CX2!@!1`_\7?OP#`#``&L@`````40/_!W[\`P#P#%!C< +M8E:`/`,4&-QC5WC\0P``/`(4&-Q%5H!DI`!@#`#..&2E`&@\`A08W$-6@#P" +M%!ED0IY8/`0`"P!$("UD8P!PW$@``-Q'``C<1@`0W$4`&&1"`"#\:```_&<` +M"/QF`!#\90`8%$3_]F1C`"`,`#[<`````!1`_Z'?OP#`#``^W@`````,`C%T +M``````P`?>@`````$$``$#P$$`L,`!>69(1`(`@``9G?OP#`/`00"PP`%Y9D +MA#ZH"``!F=^_`,`\!!`+#``7EF2$/_`(``&9W[\`P/^C`'`,`(=L``````P` +M!T``````#`(Q#@`````,`(@8CX2!@!!``$??HP!PD&(!&!!``)LD!0(`#`$X +M'"0$#``,`)3H)`0``0P`B$0\$@"O/!4``GP$`#M\A`G##`%93@``@"T,`3R. +M/!$4`#P4`,1F4X0`-K6A@-XB1@``5!@MC&20,`($*"H0H``+`````'(5&`,F +M$``!`$,H+0!S("T"12@M`$0@+0P`09;\H(0@"``"+MXB1@`,`)1PC&60-`P` +M``H`````/`4`#7P$`#LTI?`5#`#`)'R$"<,D`X`!``, +M`E:`W$,``-Q$`&#<10!H/`(4&`P`SD#\0U=X)`0``PP!.&(``"@MW@56@#P# +M%!D\!``+9&.>6&2B`'``1"`MW$D``-Q(``C<1P`0W$8`&&1"`"#\:0``_&@` +M"/QG`!#\9@`8%$3_]F1C`"#``"$/A^0A(*`$#X"0````#>`A5X`%$8*Q1@__AD0@`!#``" +MO@`````\`A`+9$(V8!!```4D`@`!/`00#@P"S9ADA)P`)`(``:)B%7#?OP`@ +MW[,`&-^R`!#?L0`(W[````/@``AGO0`H9[W_^/^_``#?OP```^``"&>]``@` +M````/`(0"V>]__AD0C/8$$``!O^_```\!!`./`42$F2$G``,`LSV9*45@#P$ +M$@_<@MJX$$``!CP"``!D0@``$$``!-^_````0/@)9(3:N-^_```(``+.9[T` +M"&>]__C_OP``W[\```/@``AGO0`(````````$"```!@@```@(```*"```#`@ +M```X(```0"```$@@``!0(```6"```&`@``!H(```<"```'@@``"H(```L"`` +M`+@@``#`(```R"```-`@``#8(```X"```/`@``#X(#P<$A-GG)'```#X+0.@ +M\"T\"2``0`A@``$)0"4\"00``0E`)4"(8``\"0$`1,GX`"0)__]$J0``1*D( +M`$2I$`!$J1@`1*D@`$2I*`!$J3``1*DX`$2I0`!$J4@`1*E0`$2I6`!$J6`` +M1*EH`$2I<`!$J7@`1*F``$2IB`!$J9``1*F8`$2IH`!$J:@`1*FP`$2IN`!$ +MJ<``1*G(`$2IT`!$J=@`1*G@`$2IZ`!$J?``1*GX`&($```\&1(29SD58`P" +M9M#_)````````#P9$A)G.15@WR0``#P9$`=G.<\8$R``!@`````#(/@)```` +M`!```!\``````````$`9>`$D!/P``R3()"0$``T`!"`\-(0`#?\D`(#_)`$` +M_R0!@/\D`@#_)`*`_R0#`/\D`X#_)`0`_R0$@````0\```$/0!E@`#P$_[\T +MA/__`R3()$"98``\&1`*9SG?F`,@^`D`````$````@``````````/!D0`&]_@`\`@#$ +M_[0!T#P4%`#_MP'HWI=&`/^_`?C_O@'P_[8!X`+B$"W_M0'8_[,!R/^R`<#_ +ML0&X_[`!L(Q"D#000`#]_Z0!J#P2$A(\%0`)9E(>,```F"T``(`M/!$4&#:U +MH(```````Z`@+0``*"TD!@&@#`)F8'X6^`,T`JZ`X@`(V%X` +MX8XB5HP40`$R/`00"P``N"T``'@M``!P+0``:"T``&`M``!8+0``4"T``$@M +M``!`+0``."T``#`M```H+0``("T``!@M``#`+0`6\3@`%LBX/`(4``/9R"_< +M0D8(`S;(+3P>`^"T`61`M`_/X+61"`&@`````W%X`&-Q9 +M````?A@M_Z,`>`,9P"W<60`@`)D@+?^D`(#<60#H`+DH+?^E`4C<60$``-DP +M+?^F`6#<60$X`/DX+?^G`9C<60$(`1E`+?^H`6C<60!``3E(+?^I`*#<60!( +M`5E0+?^J`*C<60!0`7E8+?^K`+#<60!8`9E@+?^L`+C<60!@`;EH+?^M`,#< +M60!H`=EP+?^N`,C<60!P`?EX+?^O`-#<60!X`%40+0+YN"T47__3_[<`V#0" +MKH`#H"@MD +M`:#<2```W$<`"-Q&`!#<10`89$(`(/QH``#\9P`(_&8`$/QE`!@41/_V9&,` +M(-Z71@`\`@#$)A```692`:`"XA`MC$*0-`("$"L40/\-9G,!H-^_`?C?O@'P +MW[#?M0'8W[0!T-^S`69(0[6(XB5HS?I0#8$*``!P`````00/^R`````#P$$`L,`!>69(0[>(XB +M5HP00/^LWZ8!J#P"%!C<0U=H/`00"]^B`4ADA#N8WD4!2`##`!\`8`'T`$`P +M+0!%$"\``!@2`$,`'P!@`?0,`!>6```H$@@`!)".(E:,#``7EF2$.]B.(E:, +MWZ4!0!"@``<`````$$#_MP.@$"T\!!`+#``7EF2$._".(E:,$$#_L#P$$`T, +M`!>69(0HN`@`!+0#H!`M/`00"PP`%Y9DA#GXCB)6C-^E`(`0H/\]WZ,`B!1` +M`&@`````"``$3P``$"T``````@`H+0P`%Y9DA#G`W[@`8-^C`'C?I`"`WZ4! +M2-^F`6#?IP&8WZ@!:-^I`*#?J@"HWZL`L-^L`+C?K0#`WZX`R-^O`-`(``/R +MW[<`V-^E`:@\`A08W$-7:#P$$`O>0@!@9(0YT`+`,"T`HP`?`&`!]`+"$"\` +M`"@2`$4`'P"@`?0,`!>6```H$@@`!#Z.(E:,/`00"PP`%Y9DA#NX"``$E8XB +M5HP\!!`+#``7EF2$.Q@(``2&CB)6C#P$$`L,`!>69(0[.`@`!(N.(E:,/`00 +M"PP`%Y9DA#GH"``$FHXB5HP\!!`+#``7EF2$.?@(``2?CB)6C#P$$`L,`!>6 +M9(0[R`@`!*2.(E:,WZ(!H#P$$`MDA#H@`N(H+0"^*"T,`!>6`+8H+P@`!$^. +M(E:,/`00"PP`%Y9DA#HP"``$5(XB5HP\!!`+#``7EF2$.D@(``19CB)6C#P$ +M$`L,`!>69(0Z"`@`!*F.(E:,/`00"PP`%Y9DA#H@"``$KHXB5HP\!!`+#``7 +MEF2$.>@(``1#CB)6C#P$$`L,`!>69(0Z"`@`!$J.(E:,/`00"PP`%Y9DA#I@ +M"``$7HXB5HP\!!`+#``7EF2$.G@(``1CCB)6C#P$$`L,`!>69(0ZD`@`!&B. +M(E:,/`00"PP`%Y9DA#JH"``$;8XB5HP\!!`+#``7EF2$.K@(``1RCB)6C#P$ +M$`L,`!>69(0ZT`@`!'>.(E:,/`00"PP`%Y9DA#KH"``$?(XB5HP\!!`+#``7 +MEF2$.P`(``2!CB)6C``````\!!`+9[W_^/^_```,`!>69(0\`#P$$`L,`!>6 +M9(0\(-^_```\!!`-9[T`"`@`%Y9DA"BX`````&>]_Z@`@$`M_[(`&#P2%!B. +M0E:,_[\`4/^^`$C_MP!`_[8`./^U`##_M``H_[,`(/^Q`!`40`!L_[``"#P4 +M%!B.@E=D$$``-3P3`H\\%108-G-<*3P6`#``$YQX``"`+69SZX5FM5:0`!.< +M^#P7%``VUN1@"``%V#9S]<,`````)A```0("$"L00``ECD)6C'X1^`,`$1"X +M?J(0"A!`__B.@E=DWN5&``(V("W?@H,0``0@N`"D("T00`!6C)X`(`!>$"T` +M`"`M```!#W!$)-^.0E:,%$``("0")Q#>Y$8``C:(+=^"@Q``$8BX`)&(+1!` +M`$..,0`@`%$0+280``$```$/_$```````0^.@E=D`@(0*Q1`_]]^$?@#CD)6 +MC!1``"3?OP!0W[X`2-^W`$#?M@`XW[4`,-^T`"C?LP`@W[(`&-^Q`!#?L``( +M`^``"&>]`%@``````@`H+7""$`,\!!`+_Z@``&2$/$``2``?`0`!]```$!(` +M`C"Z`-,`'0``,!``!C"Z``9(N``&.3@!)S@M``8P```'2+@`Z3@M`$69(0\,`@`!]__A\ +M!``[_[\```P`R-Y\A`G#/`00"P``*"T,`!>69(0\4#P$$`T,`!>69(0HN#P$ +M$``,`+&J)`4(`!!``#P``"`M/`40"V2E/(@`0#`M)`<(``P`R]`\"``"/`1` +M``P`L:HD!0$`$$``220$``(\!1`+9*4\F`!`,"TD!P$`#`#+T#P(`$`\!`@` +M#`"QJB0%!``00``P)`0``SP%$`MDI3RH`$`P+20'!``,`,O0/`@``CP$"``, +M`+&J)`4$`!!``#LD!``%/`40"V2E/,``0#`M)`<$``P`R]`\"``"/`0"``P` +ML:HD!0$`$$``(20$``0\!1`+9*4\V`!`,"TD!P$`#`#+T#P(``(,`(@Z```` +M`!1```PD`P`!#`&*R#P$``$``A`K"``&D'!#`#H\!!`+/`40"V2$/&@,`GZ\ +M9*4\B"0#``'?OP```&`0+0/@``AGO0`(/`00"SP%$`MDA#QH#`)^O&2E/*@( +M``:0)`,``3P$$`L\!1`+9(0\:`P"?KQDI3S8"``&D"0#``$\!!`+/`40"V2$ +M/&@,`GZ\9*4\F`@`!I`D`P`!`````#P$$`L\!1`+9(0\:`P"?KQDI3S`"``& +MD"0#``$`````9[W_N/^P```D$``!_[\`0/^W`#C_M@`P_[4`*/^T`"#_LP`8 +M_[(`$`P`!C[_L0`($$``#0````#?OP!``@`0+=^W`#C?M@`PW[4`*-^T`"#? +MLP`8W[(`$-^Q``C?L````^``"&>]`$@,`!,8`````!1``$$\!!`+#``2\@`` +M```40``W/`00"PP`%T`D$``!%$#_ZM^_`$`,`(5.`````!1`_^;?OP!`/`+_ +M@#1"`0$``A(\-$(!H-Q"``````$//!44&(ZB5V000``[/!84&#P3`#```(`M +M9M96D"04__\\%Q0`"``&\C9SY&``````CJ)79`("$"L00``P/`/_X'X1^`,` +M$1"X?L(0"A!`__@F$``!)`3__PP`T*P",X@M$%0`.@!`D"W>XD8``!&(N`!1 +MB"VN,@`@WX*#$!!``#D``````%*0+0```0_^0``````!#P@`!N^.HE=D```` +M`#P%$`MDA#T`#``7EF2E1%`(``;4`````#P%$`MDA#SH#``7EF2E1%#?OP!` +MW[<`.`(`$"W?M@`PW[4`*-^T`"#?LP`8W[(`$-^Q``C?L````^``"&>]`$@\ +M`__@)!```31C`%4``QVX-&,`#0`#'3A\`@`[?$()PS1C``@``A$\`$,0)20# +M``'\0P``#``4<@`````40/^0``````P`9.(``(`M"``&P=^_`$`\!!`+)!`` +M`0P`%Y9DA#TH"``&P=^_`$`,`-#X``````@`!P/?@H,0`````&>]__C_OP`` +M#`"%8@`````40``%)`,``0P`?>0````````!#P``&"W?OP```&`0+0/@``AG +MO0`(9[W_N/^_`$#_MP`X_[8`,/^U`"C_M``@_[,`&/^R`!#_L0`(&*``)?^P +M```D%0`!/!00"P`5JCP`@(`M``"X+0``B"UFM?_X)!;__V:4/4`(``=U`*"8 +M+7[2_\:2`@`!?&,6`I('``(P:`#_`B`H+0*`("TF,0`!#``7EGQ'>@22`@`" +MD@,``0)`@"U\8GH$,$+__Q(S``H`5[@AW@,``'QF.`$`U1`M?$(X`11`_^H` +M0)`M"``'90``D"T``+@MW[\`0`+@*"W?M@`P/`00"]^W`#ADA#UHW[4`*-^T +M`"#?LP`8W[(`$-^Q``C?L```"``7EF>]`$AGO?_(_[,`*'T31,+_L@`@,/(# +M__^P`!``@(`M_[\`,/^Q`!C<@P`(C(8`#'QD2((PB0#_`-(P)@`)2,)\`O`[ +M$$#__GX%2`$D"P"`?`H`.Q"K`)D``!`M`(!0+0`)2,!\"CC$``0B`@$J2"4` +M@%`M?2-8AB0$``'^`P`(K@8`#-X#``A\@P@&_@,`"````4\D!``!/`/__'R" +M>P8T8P`+?(*`=\L4(&?&-<`B0%`@%\<=P&``4HO"0#``$`12@D +M``,8O!"C`'4\`P`!E@4`L#1C``$R. +M`@"H?$,%@!1@`%$P0P$`_!&!`-X"`!B6!``8D@,`!'Q"2`$H8P`"%&``5WR" +M_`9\`GM&_`*!"/D1`,@D!0`"```!3SP"%!C<0E=XD$,`#0)#&",L8@"`$$`` +M!3P"%!C<0D@8?$,9BA1@`"\D!``)``X;\ +M$8$`W@(`&)8$`!B2`P`$?$)(`2AC``(08/^K?(+\!B0#``$(``?A?&)[1@`` +M``!]2@G#``E(P``*&@`(``>P`&E()0````"&`@!H/`,4`-QE1@@\`P`)-&.@ +M@'P$`#M\A/@#``(Q.'"#(`,``ABX`,,8+P!B$"T``AEX`*00+0!#$"W<0P&8 +M9&,``?Q#`9B.`@"H?$,%@!1@`'0\!``!W@,`J#2$``$`!"%\`&0H)!"D`",` +M````E@4`N"0$`@$R`P"@`&(8+8QF``!H9``,:&(`!'R%^`-\27P#`25(+0`$(#Z( +M90```24H+0`"$#Y\QAX#`*0H+0"B*"TLP@`&%$``"P`%%#HD!``4``8PN``` +M````@Q`M9(0`!(A"``!\0O@#%(;_^P"B*"T`!10Z9&0`"GRE>`,`11`M``(L +M.GQ">`,`HB@M``44.GRE>`,`11`M.$+__Z""``$``@H"H($``-X#`*@(``A< +MC@(`J-X#`)@\`@`!-$(D!R0%``,``A.\?&1(`0`#(`I\@D@%"``'Y/P"@1`` +M$EI`-2D`57#J"3,`"4J\-2D`4`%I2"T!24@EW2H``'U*>`$`"D@`?41X!0#) +M,"H0P/].K$D``'P$C`8D`@`)"``('7Q$_P8(``@`9$(=L'Q#!@`08``*,$)` +M`)8%`+C_IP```@`@+1!``$C_J``(#`!K*`````#?IP``WZ@`"-X"`*@D`P(! +M``,;O`!#("00@P`;`````)8%`+`R]_[C_MP`X?1=$PO^V`#``H+`M_[4`*`+@J"W_M``@?111@O^S`!@`X)@M +M_[(`$`$`D"W_L````("`+?^_`$#_L0`(```!3SP"`0$PX___$*``5P!B&"5\ +M`O`[$$#__CP"__PD!`!!-$(`"P`$(SQ\!0`[``(3?'RE"<,TA`"```4R`'RB +M.09\Q.T&?&(9!7Y1`,+\1```?D,$0@`1C;A^1`D"D@(`$'QQWL:6`P`(?I'4 +M!GR1_X808`$;?%&L!WQQ>`=P1`!O`!$=NCAC``$``Q@``(,8)!!@``\`%B@K +M<$,`K@!E&"048``+`````-X&``!\PU@",&0(`!2``#X`8#@M``8SO@!%*",P +MQ#``#``^V`"'("7>`@"H/`,``20%`@$T8P`!``4HO"0$``$``QE\`$4H)``$ +M(+P0I``R`$,0)!!#`%0`````C@(`J'Q#!8`48``<`````'Z2@8;Z0@#Y`F`@ +M+=X&`!@"("@M```X+20(``$,`7L\```````"$`#?OP!`W[<`.-^V`##?M0`H +MW[0`(-^S`!C?L@`0W[$`"-^P```#X``(9[T`2'P"\#L40/^K/`+__`@`"9(` +M`````````-X#`*A\9`H"$(#_XGQD"L(4@`!;)`0`098"`+``5[@A)O<``0@` +M"7U^\?8'`````#!C#_`(``EG`&`X+0`````00P!C`````(X"`*A\0P6`%&`` +M]S!"`"#>`P"H)`("`0`"$[P`8A@D$&(`A0````".`@"H?$,&`!!@_\8````` +MW@,`J'QD#`(0@/_"?&0,PA"``$DD!``A``0CO`!D&"0D!``!``0CO!!D`*

`P"@E@(`N`!B +M$"V,1@``:$0`#&A#``1\A?@#?&=\`P#E*"T`!"`^B$<```"G*"T``Q@^?,8> +M`P"D*"T`HR@M+,,`!A1@``L`!1PZ)`0`%``&,+@``````((8+62$``2(8P`` +M?&/X`Q2&__L`HR@M``4<.F1$``I\I7@#`&48+0`#+#I\8W@#`*,H+0`%'#I\ +MI7@#`&48+3AC__^@@P`!``,*`J"!```(``EZC@(`J``$(7P`9!@D)`0``0`$ +M(7P09`!G,$(`0!!`_WX"`"`ME@4`L`P`:ZH`M2@A"``)?GZ2@88`````E@(` +MN`!7N"$F]P`!"``)?7[Q]@<`````E@(`L-X#`*``8A@MC&8``&AD``QH8@`$ +M?(7X`WQ'?`,`Y3@M``0@/HAE````Y2@M``(0/GS&'@,`I"@M`*(H+2S"``84 +M0``+``44.B0$`!0`!C"X``````"#$"UDA``$B$(``'Q"^`,4AO_[`*(H+0`% +M%#ID9``*?*5X`P!%$"T``BPZ?$)X`P"B*"T`!10Z?*5X`P!%$"TX0O__H((` +M`0`""@*@@0``"``)JXX"`*B6`@"XW@,`H`!B&"V,9@``:&0`#&AB``1\A?@# +M?$=\`P#E."T`!"`^B&4```#E*"T``A`^?,8>`P"D*"T`HB@M+,(`!A1```L` +M!10Z)`0`%``&,+@``````(,0+62$``2(0@``?$+X`Q2&__L`HB@M``44.F1D +M``I\I7@#`$40+0`"+#I\0G@#`*(H+0`%%#I\I7@#`$40+3A"__^@@@`!``(* +M`J"!```(``FUC@(`J)8%`+`"`"`M#`!K*`"U*"$(``E^?I*!AI8%`+@"`"`M +M#`!K*`"U*"$(``E^?I*!ACP$$`L\!A`+/`<0"V2$/8`D!02]9,9$:`P"7IID +MYSWX/`+_@#1"`2E\`P`[``(2/'QC"<-\8CD&W$(``!!``"\D`___)`0``WQB +M_\8D`P`!``,8?'R1"`;\0P`(-`.``/Q````D!``!_$,`$'Y)!(+\0``@?E(V +MP]X#`$@`":`+`B`H+20(``'\0P!(W@,`0/Q#`$#>`P`H_%0`4'R#_P8"8"`M +M?D/5!OQ#`"A\0T@!W@8`&``"&`H`8!`M`&`X+20#__]\9T(&"``)A`!).`J6 +M!0"P$$``!0(`("T,`&LH``````@`":_>`P"H#`!KJ@`````(``FOW@,`J#P$ +M$`L,`!>69(0^&`@`"8<``!`M9[W_4/^S`)``@)@M_[(`B/^_`*C_M0"@_[0` +MF/^Q`(#_L`!XW)``&'X0.`$2``%*`,"0+20"__]\4/_&`@6`+0``J"V2`P`, +MD@(`#7QB>@0T`X$`,$+__Q!#`/$D$0`.`A&(+3P#0`".(@``CA3__`!`("U\ +M!-@$$(,`FP`4H@("("`M9Z4`2*.@`%AGI@!0_Z``2`P`:VAGIP!8DZ(`6``` +M6"UP101N<$,!K@"C&"408``&```@+=^C`$B49```E&,``@`$7``!8U@E$D`` +M.C0*__^69@`.-`C__S0)__\T!___D@4`!@`%+#C_I0`P/`40(4BE0@`\!?__ +M2*4"`8^E`#!(I0(&CZ4`-$BE`@9()`(!D@4``'R"?`,`!2PX_Z4`.#P%$"%( +MI4(`/`7__TBE`@&/I0`X2*4"!H^E`#Q(I0(&2"0"`30#__\2@``-?(5\`P`4 +MH#P\`Q`A_[0`0$BC0@`\`___2*,"`8^C`$!(HP(&CZ,`1$BC`@9((P(!?&-\ +M`Q)``-;?OP"H`$40)M^U`*``1A`FW[0`F`!#$";?LP"0W[(`B-^Q`(#?L`!X +M`^``"&>]`+#>(P`(_Z,``#P#$"%(HT(`/`/__TBC`@&/HP``2*,"!H^C``1( +MHP(&2","`=XE`!#_I0`(/`40(4BE0@!\`W@'2*,"`8^C``A(HP(&CZ,`#$BC +M`@9((P(!WB4`&``#'`(P9____Z4`$#P%$"%(I4(```,<`$BC`@&/I0`02*4" +M!H^E`!1(I0(&2"4"`=XE`"#_I0`8/`40(4BE0@!(HP(!CZ,`&$BC`@:/HP`< +M2*,"!D@I`@$`%:PX?2E\`P*B$"7_H@`@/`(0(4BB0@`\`O__2*("`8^B`"!( +MH@(&CZ(`)$BB`@9(*@(!```P+7U*?`,0@/^.-`C__P`+6#P\`A`A_ZL`*$BB +M0@`\`O__2*("`8^B`"A(H@(&CZ(`+$BB`@9(*`(!"``*[7T(?`,`````EB4` +M!@``,"V2(P`),*4__Q2@``P``"`M<&<$;G!E`:X`Y2@E$*``!WQ"'@,``A"X +M`B(0+91$``"40@`"``0T.`#","6.(@`,$D``/XXE`!"69P`.-`C__S0*__\T +M"?__D@8`!@`&-#C_I@!@/`80(4BF0@`\!O__2*8"`8^F`&!(I@(&CZ8`9$BF +M`@9()0(!D@8``'RE?`,`!C0X_Z8`:#P&$"%(ID(`/`;__TBF`@&/I@!H2*8" +M!H^F`&Q(I@(&2"0"`30#__\2@``-?(1\`P`4HCP\`A`A_[0`<$BB0@`\`O__ +M2*("`8^B`'!(H@(&CZ(`=$BB`@9((P(!?&-\`Q)``$W?OP"H`*00)M^U`*`` +M1Q`FW[0`F`!#$";?LP"0W[(`B-^Q`(#?L`!X`^``"&>]`+``````EA4`#B01 +M`!((``K,,K4/_P`%*#Q\0O@#`*(0)?^B`$@\`A`A2*)"`#P"__](H@(!CZ(` +M2$BB`@:/H@!,2*("!D@I`@$`%:PX?2E\`P*C&"4\`A`A_Z,`4$BB0@`\`O__ +M2*("`8^B`%!(H@(&CZ(`5$BB`@9(*@(!```X+7U*?`,0@/^I-`C__P`&,#P\ +M`A`A_Z8`6$BB0@`\`O__2*("`8^B`%A(H@(&CZ(`7$BB`@9(*`(!"``+AGT( +M?`,``````2`/@``AGO0"P"``*PP``@"VD +M@``@```0+0"`&"TD"0`_)`@!`-QE```D1@!`9&,`"!"@``5PIS@D``8```H+6>D!@`D!@(`_[\(8/^^"%C_MPA0/!<4`/^V"$@``+`M +M_[4(0/^T"#C_LP@P_[((*/^Q""`,`F9@_[`(&&>D!````"@M#`)F8"0&`@`` +M`"@M)`8"``P"9F!GI`(``Z`@+0``*"T,`F9@)`8"`#P%`/\\`O_P-*7_/SP$ +M``TT0@`C0`9X`#2$EP``Q2@D``(2_'"D("JOI`@```#(+0@`#+,T7@#XW0(` +M"``$)WQ\0@]"``(7?!!$`",`````)SD``20"`0`3(@`29M8(`-[H1@`T`JZ` +MJ!``" +MQS@M``!H+32EH(!F50(`-QB&H-TN````\A`M9.;^````("W<0P```$40+11& +M__T`@R`MW2\"``"`B"T`]1`M```8+=Q&````11`M%$?__0!F&"T1X``%`&`0 +M+0!O,"L4P`%1``````!O&"\1P``%_2("``".$"L40`%.``````".("\1@``) +M_3$``'!P&`-PD"`#`&P`'P&``?0``!@2`(P`'P&``?0``"`2``0P*P`#$"L` +MPA`D$$``\@``````9``?`(`!]-T&!&C=!`1X_68``/U$`````!`2+$0'T!2` +M`.P`````+$,/H!!@``5D0_!@)`,`"/UC``#]0P``9$/P8"QC#Z`08``%9$/@ +MP"0#``;]8P``_4,``&1#X,`L8P^@$&``!61#T2`D`P`$_6,``/U#``!D0]$@ +M+&,?0!!@`10L0DX@)`(``OUB``#]0@``D0(`-R6M``%E*0`(96L`"&5*``@! +MHA`J%$#_J63G``A\`O@[WZ,("`!#$"L40`$L`````'P"^#L`0Q`OW0,$0!!@ +M`2+?HP@0D0,`-A!@`&D\`Q0`/!'^,=QD1@@\`P'/-&.^"#8QY@`\&``!`$Q@ +M+0"#("T\`P`)904(J`.@,"UGIP(``L0@+0``2"TT8Z"`9C("`#<8AJ`D%0`( +M`````-RN````D1`M9(W^````6"W<2@```$,0+11-__T!:E@M$<``!0%@4"T! +M;A`K%$``^0`````!;E@OW*X"``"2$"W\J@````!0+=Q-````0Q`M%$3__0%- +M4"T1P``%`4`0+0%.:"L5H`#N``````%.4"\1@``)_*("`'%04`-Q<%@#`4P` +M'P&``?0``%`2`6P`'P&``?0``%@2``MH*P`*$"L!HA`D$$``D``````!2P`? +M`6`!]-T-!(#="P1X_.T``/S+`````!`2+$L'T!5@`(H`````+$H/H!%```)D +M2O!@_/4``"U*#Z`10``#_-4``"0*``;\Z@``9$K@P"0+``8M2@^@$4```_S+ +M```D"@`$_.H``&1*T2`D"P`$+4H?0!%``*_\RP``)`(``OSB``#\P@``D0(` +M-B4I``%DI0`(9,8`"&3G``@!(A`J%$#_K&2$``@R9``_%(``!```$"V-`PST +MC0(-``!B$".1#0`W/`X4&-W#5WC`90)T%*#__B0%``'@90)T$*#_^P`````\ +M!?^``!2C0#2E`1\"A"`E``4I/`!-&"$TI2@M`$,8*@`%*3C\I```W*0``!!@ +M`&4\!O^```(4>#3&`1\``"@M``8PO"0*`1@TQ@0!)`___P`&,;@\"0`"`$88 +M+63&`&`(``X$`$8@+0.F,"W#/"<(``T(`&\8+0`.<"<(``T.`(X@+=T*!(C=`@1P_.H```@` +M#;?\P@``)`H``BQ"3B`40/]2_,H``"0"``'\X@``"``-M_S"``#=`P1@W0($ +M +M%!C_HP`(`&`P+=_%5VC<0T6(CX2!@/^&@OAPHQ@##`"((/Q#18@40`&'```` +M``P`AVP\%/^`#`"(1C:4`0%\`P`[?&,)PP`4ICBOHP`$/`,`_S1C_S\VE``# +M0`1X`/^@`"``@Q@DKZ,`$```B"T``(`M/!44`#P6%```%*0X`````)."@P`P +M0@#_%$``!0````"3@H,!,$(`_Q!```:?@H&`)C$``20"``(2(@%1`````)^" +M@8`D`P`!``(0^`!4$"W\0P``#`"(((^$@8`40`"X``````P`B!2/A(&`%$`` +MIMZC1@!\$_@[?`+P.Q!`__Z/HP`$/`+__#1"``L``A-\?&(Y!MQ"```$0`!' +M`````'Q72`$2X`!$)`/__P+@D"U\`!#$"\`PA`K%$``$Y^$@8`\`Q0`C&)% +MU!!```4\!!0`_[(`"(R"1=`00``+GX2!@/^R``@,``.\`N`@+0P`A;@"X"`M +M#`"&B@+@("T,``6T`N`@+9^$@8`\`@`PWJ-&`#1"Y&``@A`M``(0N`!B$"V, +M4@`@?`/X.]^"@Q`00``,`'.8+P!2$"T```$/"``.KG!3`!D\`@#$`&(0+8Q$ +MD#`,`)0NC$60-`@`#L<`````#`#0^`````#?@H,0`%(0+0```0\(``ZN<%,` +M&0P`A-8`````"``.PP`````,`C!B`D`@+0@`#PL\`A!BW0(`""0#``$``B\^ +M$*,`"GQ&-0(,`'WF`D`@+1!`_X``````#`"4L`)`("T(``\+/`(08@`````\ +M`Q`+``80^&1C0%!\8A(*`$``"``````,`&RL`D`@+8Y"`*@$0`!^``````P` +M)+X"0"`M"``/"SP"$&(`````W04`$`)`("T``#`M#`!9%'[W2`%\`P`[```! +M3SP"_X!\8PG#-$(!*0`"$CQ\8CD&_%<```@`#PL\`A!B`````)97`$X"0"`M +MCD<`J``7N``,`&RL_Z<`*-^G`"@2X``,)N/__P)`$"TD!O__)`7__]Q$`$#< +M0@"8```!3W!&`!D```%/)&/__Q1E__D`@!`M!.#_10`````,`3=4`D`@+0@` +M#PL\`A!B#`!,X@)`("T(``\+/`(08MY$`#`,`>2`?O=(`7P#`#L```%//`+_ +M@'QC"<,T0@$I``(5^#1"``$``A1X?&(Y!OQ7```(``\+/`(08@`````,`>L< +M`D`@+0@`#PL\`A!B#``OA@)`("T(``\+/`(08@P`2&X"0"`M"``/"SP"$&(, +M`"YJ`D`@+0@`#PL\`A!B#``P"`)`("T(``\+/`(08@P`+?("0"`M"``/"SP" +M$&(,`"H8`D`@+0@`#PL\`A!B#``JH@)`("T(``\+/`(08@P`0QX"0"`M"``/ +M"SP"$&(,`'1(`D`@+0@`#PL\`A!B`D,@+_^D`!@(``\_`E>X+0P`K+(````` +M"``.NY^"@8`,`##&``````P`3)@"0"`M"``/-?^R`"`,`)3N``````@`#R`` +M````WD(`F````4\D`___<$,`&0```4\(``\+/`(08@P`AF8`````#`!NQ@`` +M```,`$#\``````@`#ID``````````&>]_[`\`P#$_[(`$#P2%`#>0D8`_[\` +M2/^^`$#_MP`X`$,8+?^V`##_M0`H_[0`(/^S`!C_L0`(_[```)1CD"(08`!- +M)!:``3P5__``%K2X-K4`(S;68`$`%:WX`L"@+3:U!$,`%K1X`!2D^#;6(`4` +M%:TX-I2*`0``@"TT%ZZ``!:S>#:U`$@(`!!O`!2B^##F`/\D!P$``.8H"R0' +M(```YB`+,$(`/SP(__``HB@M-0@`(P`%*C@`"$+\`+4H+34(`/@`HR@E`&@X +M)=RB```D!@`!)A```3!"`#\`@B`M``0@^`"4("T`@Q@EW&(``'S"M8=\PH0' +M_&(``-Y"1@#@!`F"T"8"`M#`$X8@!`*"U^(PL#``,9/"0% +M`@``=B`EW(8``"0$0`!\QA@"R,#_RC#'``(``"`M"``040``*"W?OP!(W[X` +M0-^W`#C?M@`PW[4`*-^T`"#?LP`8W[(`$-^Q``C?L````^``"&>]`%`0H``- +M```0+7RC/`,P8P#_+&,``A1@``1\I3`#`^``""0"``$`````)(0`?C"E`/\4 +MI/_Z``````/@``@`````/`,4&-QB5W@00``'<(<3!% +M`G00H/_[`````#P"_X!PA@$R-$(!'P`"$3PT0B@M``(1./Q'``!D0@U@`,(P +M+=S"``!\13P#,*4`_P`%*"L4H``$)(@`?CP"``%]`C`'_,(``-QF5W@0P``$ +M`````````4^LP`)T```!3Q2@`!_<95=X?$8T`GQ".`(`!"-\$*``!W!&$`/` +MI@)T%,#__B0&``'@I@)T$,#_^P`````\!O^```(4>#3&`1\`P"@M``8V.``% +M*3PTQ@`!-*4H+0`&-#@`1A`M``4I./RG``#\1```W&)7>!!```0````````! +M3ZQ``G0```%/`^``"`````!GO?_H_[````"`@"W_OP`0#`&72O^Q``@2```5 +M`$"(+0`","L`!C`O`@`@+0``*"T,`F9@,,8`")(B`,JF`@``DB(`Q*("``*2 +M(@#%H@(``Y(B`,:B`@`$DB(`QZ("``62(@#(H@(`!I(B`,FB`@`'W[\`$-^Q +M``C?L````^``"&>]`!@`````9[W^J"0&`0#_LP$@`*"8+?^P`0@``"@M_[(! +M&`"`@"W_L0$0`Z`@+?^_`5!^$?@#_[X!2#P2%`#_MP%`_[8!./^U`3`,`F9@ +M_[0!*#0$KH!R)"@#WD)&``!%*"W1$8`)`8``0""("VLD``` +MWD=&``#B$"W<1``(?,3_QGP$]T;\1``(CL0``*!``#:@0``WI$0`,*Q7#02. +MQ``0K$0`$([&`!`DQ@`6K$8`&!*``*W?HP$`?`,H!'QC^`-P91@#`.,8+=QC +M`"```R(^``,L/C"$`/\PI0#__$,`('RD>@0P@___K$,`%#0#KH`D!A70`Z`P+1!` +M`'T`0*@M```H+3P&``@,`F9@`J`@+?[3(&C^TR!@9J4`.`)@,"T``!@M9J@` +M,`@`$<<\!P`(`````-[&(&@!`Q`M9&,`0/S"``#>9``(_*0``/YB``C\L__X +M%&?_]V2E`$`,`"06`@`@+1:```0T`JZ`#``K9`(`("TT`JZ````H+7(BB`/> +M0D8`)`9```!1$"T,`F9@W$0N2#P"%!C<0E=H/`4(,=Y#1@`TI2;I``4L.``" +M(+@``C'X`,0@+S2E>-4`@B`M``44N'R$X`%D0O?/`((`'0!QB"T``"`0/`(` +MQ`!B$"T`!"$Z_B0N4)1#D"(D8P`!I$.0(H["`#PD0@`!KL(`/-^_`5#?O@%( +MW[]`5@"8"@M9(1$X`(`,"T,`!>6`J`X+0@`$8Z.P@`\ +M/`00"SP%$`MDA$4@#`)^O&2E27`\!!`+_L`@6#P%$`MDA$5(#``7EF2E26`( +M`!'ZW[\!4#P$$`L\!1`+9(1%B`P`%Y9DI4E@"``1^M^_`5!GO?VH```H+?^Q +M`A`D!@$`_[("&`"`B"W_OP)09Z0!`/^^`D@\$A0`_[<"0/^V`CC_M0(P_[0" +M*/^S`B`,`F9@_[`""-Y"1@`T`ZZ`1D8`,N4/_S"E__\R]___```0+0##&"W<9``P_'8. +M(/QW#BBL=0XP?H1[QOQD`#`0H``$_',N2"0%``%\I'.&_&0`,"0#%=`D!P!` +MD`0`,`+/* +M9Z0!`&>D`0```"@M#`)F8"0&`0`\!1`+9Z0!``*@,"T,`H!&9*5%$`P`L\IG +MI`$`/`(4`/Z`(%@(`!)WW%Y&`!!```,D`@!`"``2=ZZ"`#@(`!)WKH``.&>] +M_^C_OP`0_[$`"#P1$`L,`9=*_[```&8D1=@,`+.(``*`*P`0@"\00``1,A`` +M"-Q"```D$``!$$``!0``("T`0"`M)`+__WQ$_\8LD``!#``0Y@````#?OP`0 +M`@`0+=^Q``C?L````^``"&>]`!@\"1```@`@+0``*"T``#`M)`<`"&8H1=@, +M`+1H92E#F`@`$P@L4``!/`,4`)!C`1@48``#```0+0/@``@`````/`0`Q3P& +M$`MGO?^@-(00@"0%`(!DQD7H_[(`,#P2%`#_OP!8_[8`4/^U`$C_M`!`_[,` +M./^Q`"@,`+1>_[``(!!``27^0D8`/`8`Q0!`("T``"@M#`)F8#3&$(#>0D8` +M/`,4&```@"W<8U:`-!.N@"04`0`(`!-!_&(`"``````F$``!$A0`$-Y"1@!R +M$X@#`%&(+=XB+D@40/_Y)`1```P`L:HD!0"`$$`!$@!`J"T`0"`M```H+0P" +M9F`D!D``"``3/OXU+D@\`P#$)`4`0`!#&"TD!/__/!8``CP5`*ZL99&```"` +M+:QED80VUJ&`_&21B#:UA`#\9)&0)!0`"'(6B`,D!0#_)`8`*"80``$"-8@M +M`%$0+613(1!D42$X#`)F8`)@("T,``P,`F`@+0P`#"`"8"`M)`4`_R0&`"@, +M`F9@`B`@+0P`#`P"("`M#``,(`(@("T6%/_IWD)&`#P#`,0`0Q`M)`,``0P! +METJ@0Y`D$$``Y@````"41@#`),+_U#!#__\L8P`J%&``%#P#$`L\!1`+`Z`@ +M+0P"@$9DI490/`00"V2$1G`,`!>6`Z`H+20"___?OP!8W[8`4-^U`$C?M`!` +MW[,`.-^R`##?L0`HW[``(`/@``AGO0!@<$)X\F1C2!!\8A(*`$``"``````D +M`H`!/`7_\``"%+@\!!`,W(2/P#1"8`,``A>X-*4`(WP#`#M\8PG#-$(`,``# +M&3P`!2K\_Z0```!B$"7\0```-*4`^-Y&1@``92@EW*0``#P#`,3<1P`````@ +M+0##,"T`!S@_K,>1F"0&``C\1@``/`<0`-RE``!DYT)(W$(``#P&%`#>148` +M_,=&B#P'$````A`_9.="B`"C&"T\!A0`K&*1G`P`$*+\QT:`#``0HB0$``$\ +M"!0`90@``-Y*1@`\!`##-(20````&"TD!O__)`4`"`%$("T`@!`MK$8``"1C +M``$49?_]9$(`!(T&```8P``3/`,`KCP)``(T8X0``0`H+0%#&"T``!`M-2FA +M@`````",I@`(9*4`!*Q@`$BL9@```&D8+:R"```D0@`!C08```!&."H4X/_V +M9(0`!#P"`,0\!!`+`4)0+62$1H"M1I`P`Z`H+8T"``0,`!>6K4*0-`@`$XP` +M`!`M)`(`31#"`'$`````)`(S`*>B``0\`DY)-$)#,J^B```D`H`!/`3_\``" +M%+@TA``C-$)@`P`$(OP``A>X-(0`^'P#`#M\8PG#-$(`,``#&3P\!A```&(0 +M)0!D&"7\0```9,9"2-QC`````"`MW$,``#P"%`#>148`_$9&B#P"`,0``Q@_ +M`*(0+:Q#D9@\`Q``9&-"B#P"%``,`!"B_$-&@`P`$*(D!``!/`@4``@`$\IE +M"``H/`+_\#1"`",``A+\-$(5L-Q"```P0@`'$$``.CP#$`L\`Q`+/`@4`-QE +M1B!D8D8@90@`>-Q$``B40P`0D$(`$O^E``#_I``(IZ,`$`@`$\JCH@`2/`(W +M.#P(%``T0GAX90@`4*^B```(`!/*HZ``!#P"$`P\"!0`W$.,(&1"C""40@`( +M90@`\/^C```(`!/*IZ(`"#P"$`P\"!0`W$*,"&4(`,@(`!/*_Z(``#P"$`P\ +M"!0`W$*,J&4(`/`(`!/*_Z(``#P$$`L\!1`+9(1%^`P`%Y9DI4F("``3C"0" +M``$\!!`+/`40"V2$1I`,`!>69*5)J`@`$XPD`@`!"``3C```$"T\"!0`W&5& +M.&1B1C@(`!0P90@`H"0",P"GH@`$/`).231"0S<(`!/^KZ(````````#X``( +M`````&>]_Y@\`@"O_[``&#P0%`#>`T8`)`7___^_`&#_O@!8_[<`4`!B$"W_ +MM@!(_[4`0/^T`#C_LP`P_[(`*/^Q`"`,`2F(C$2$`-X"1@`\`P#$`$,8+8QC +MD#`L9``"%(``%``````\%``")!$``3:4H8`\$P"O/!(`Q'XC^`,D!?__<'08 +M`R8Q``$`0Q`M`F(0+0P!*8B,1(0`W@)&``!2&"V,8Y`P`B,@*Q2`__,````` +M$&``/SP$$`LD%8`!/!3_\``5K/@VE``C-K7`!P`4HOQ\$P`[`!6NN'YS"<,` +M$YD\-K5``S:4`/@\%@`"``"(+3;6H8`\$@"O`!6H^`)TH"5^/O@#)C$``7/6 +M\`,`7A`M`D(0+8Q7A``,`3AF`N`@+0P!.PX`0"`MW@-&`"0&!=P"X"`M`'X8 +M+0)#&"W<980(K&:$$"0&/H"L9H04)`8``7S%M8=\1:Q'#`$X>OQEA`@"X"`M +M#`$X9@!`\"TSW@`#<$(1,@!>\"TD`@7X`![U.`/5\"T#T_`E_\(``-X"1@#> +M@P``/`,`Q`!#&"V,8Y`P`B,8*Q1@_]=^/O@#/`00"PP`%Y9DA$;`#`"()``` +M``#>!$8`/`<`Q"0%``8``!@M`( +M`D8`_K8`*`!4$"T"0A`M9E*$`(Q&A`#_I@`0#`$X9@#`("W?I@`0`$"X+0P! +M.'H`P"`MW@1&``*2*"W_H@`0#`!!E@"%("W?H@`0)`.``3+H``<``QSX``A! +M.#1CP`N`$"$"TT8T`A``(5.``#&/@"("`M`$,0+20%``'?HP`` +M)C$``0!#$"7?HP`(_%8``-QB```D`@`$#``E//ZB`!C>!$8`/`(`Q`""$"V, +M0I`P`B(0*Q!``!\`````?C3X`SP"`*YRDQ@#-$*$`#P2`*\`8A@M`(.H+:Z@ +M`$P"H"`MKJ``4*Z@`%2NH`!$#``F*@````#>!D8`C\16C#P%`,0`Q2@MW*>0 +M*'SG>`$0@/^Y`H>P+3P$$`L"("@M`L`P+0P`%Y9DA$<("``5`W(SH`,````` +M```!#]^_`&```!`MW[X`6-^W`%#?M@!(W[4`0-^T`#C?LP`PW[(`*-^Q`"#? +ML``8`^``"&>]`&AGO?[8_[4!`/^T`/C_L@#H_[``V```@"W_OP$@_[X!&/^W +M`1#_M@$(_[,`\`P!.PS_L0#@?!(`.WY2"<,`0*`M&$``#P)`J"T`$I0`)!$` +M"0@`%7D`0)@M)A```1(3`%P`````,@0`_S2$W@`,`3L.`)(@)0`"$``44?_W +M`````"0$__\"D*`F`A0@"P``*"T,`3@H/!?_\#;W`",#H"@M`!>Z_`!`@"T, +M`2``&CHP!J`K>X):.C`&FCHP!H#`$G7J.C`&=\$``[?A`) +MPP`0A``,`3L,``"P+1A```T`0*`M"``5JP!`D"TFU@`!$M(`#"0"`#\RQ`#_ +M-(3>``P!.PX`D"`E``(0`!11__<`````$I8``R0"`#\RPP`_`&`0+3P#__`" +M8A`M-&,`(P`"$C@``QWX9G,!`#1C!$,``QTX-&,`0`!#$"T`51`EW$,``'_# +M*4?\0P``WN(``"0"`@`68O_;W[\!(```$"W?O@$8W[]^B#<8D8` +M/`0`Q/^T!;`D!?___[\%V/^^!=``1"`M_[<%R/^V!<#_M06X_[,%J/^R!:#_ +ML068_[`%D(R$D##_H`48?`,`._^@!2```QG"_Z`%*#!T``/_H`4PKZ4%&/^@ +M!-C_H`3@_Z`$Z/^@!/#_H`3X_Z`%`/^@!0@8@`$0_Z`%$#P(__P`%$D\-0@` +M"0``J"W_H`5@``A$.*^C!8`U"$`!``A'>`$H0"7_J`6(WZ,%8#P%``(TI:&` +M?!'^A'!E(`./I06`/`,`KV1FA`!\L`P`098PT@__WZ,%B`*`("TD!?__)`8`"-QB +M```P0@`_?%&L!"0"^:,,`6G`?%%X!`1``0O_H@5H9[8$W`*`("TD!?__9[`% +M&`P!:R;_M@5P`@"X+0``F"T\!1`+`L#P+=^F!5@"8#@MKN(```.@("T$0`#P +M9*5'<`P"@$8``````!,8^`(@("TD!?__`Z`P+20'"``\"``"#`#)W@.CL"TT +M!/FCKL($W``"$#^NP@38E\(``!!$`-`\!!`+`L#P+=_&!-@\!1`+W[8%<&2$ +M1XADI4G(`@"8+7S&2@(``/`M#``7EC#&__\(`!96)!<`""?>``%FF/@"@"`MCA8```.SF"W>90389A``!`+` +M,"U\I4H"#`%>[#"E__\#TB@A`H`@+0P!7Q("P#`MWF@$V#P$$`L#P#@M9(1' +MJ`+`*"U]"$H"`D`P+0P`%Y8Q"/__WF4$V`*`("TD!@`!)`<``20(!1%\I4H" +M)`D&(C"E__\D"@`!#`$A0"0+!`"OO@4\`]F!3BOI04X`H`@+=YB!-BO +MO@5$K[X%2"?>``&OH`5,?$)*`J^B!4`,`5WHKZ`%4"0&``@7QO_.WZ0%6&>E +M!``,`2@!`@"T"`"`M#`$X8@!`*"TD!H`!WZ,%>``&-+@T +MQF`!``8T>#3&(`4``RD\``8S>"ZC``(`IB`EW(0``!!@``I\A!@"`J08%^A@ +M``#3&`$@D`P`!`$80+3P&%```12@E +MWZ(%8"1"``'_H@5@W*(``"0%@`$`!2RX-*5@`3!"`#\`!2RX`((@+32E10$` +M!2LX``0@^'R%$@H`A2`MWZ4%8'QB4H=\8AC'?&((1_R"```\!/_PW,)&`#2$ +M`",`!"+\-(0`^-R#```\`P#$`$,8+8QCD#``HQ@J%&#^_M^C!6#?OP78```0 +M+=^^!=#?MP7(W[8%P-^U!;C?M`6PW[,%J-^R!:#?L068W[`%D`/@``AGO07@ +M)G,``20&``AF]P`$$F;_5&?>``@"@"`M#`%K)B0%__\\!1`+WZ8%6`)@."VN +MX@```Z`@+01!_Q)DI4=P/`00"SP%$`O?M@5P9(1'2&2E2<@,`!>6`@"8+0@` +M%E```/`M"``6V"05``(\!!`+/`40"V2$1R`,`!>69*5)R-^_!=C?O@70)`+_ +M_]^W!]!>!GO?\P +M_[\`R/^R`,#_L0"X#`'E!/^P`+`,`>4V`$`@+0P!/;@`````)`/__Q!#`$`\ +M!!`+```!#WP2`#M^4@G#)!```0)`("T,`5EZ`D"(+3P#_^`T8P!5/`+_\``# +M';@T0@`C-&,`#0`"%'@``QTX-$(`$31C``@``A:X`!*1/``1,3P"0Y`E-$(" +M`/Y`````PA`EW$,``#P'__`TYP`C`B`@+0`'.OP#H"@M-.<`^'X#2D?\0P`` +M`,] +M`-``````#``5U@`````40/_UW[\`R`@`%X'?L@#`#``7EF2$1^#?OP#(W[(` +MP"0"``'?L0"XW[``L`/@``AGO0#0`````&>]@!`T`H"8_[1_8#0#@*#_LG]0 +M_[%_2/^_?W#_M7]H_[-_6/^P?T!GO?\@`%T0+0!]&"W\10```(`0+?QF```T +M!H"H`-TP+30#@+#\QP``-`:`N`!]&"T`W3`M_&@``#0#@,#\R0``-`:`R`!] +M&"T`W3`M_&H``#0'@`#\RP``-`:`F`.F&"TT!H`0`-TP+0.G."W\PP``-`.` +M&`!`,"T`?1@M)`(`.`.@("V@8@``-`.`&20"`$``?1@MH&(``#0#@-``?1@M +M-`*`6/SC```T`X!@`%T0+0!]&"WT3```]&T``#0"@&@T`X!P`%T0+0!]&"WT +M3@``]&\``#0"@'@T`X"``%T0+0!]&"WT4```]'$``#0"@(@T`X"0`%T0+0!] +M&"WT4@``]',``#0"@`@T`X#0`'T8+0!=$"W\0P``#`*?T#0%@`"?@X&`/`44 +M`#0$@`!DI4:0`$"(+0`#D/@``QOX`D.0+20"__\"19`MCD,```!D*"L0H``% +M`Z"@+8Y%``0`I"`K%(``.P`````T%8````````(B@"H`0#`M`C`P"P`"$"H` +M$1@J`H`H+0!B$"0`P(`M$$``)`#`F"V.0@`$?$3X`P)B&"%DA``(`'48*Q1@ +M``,"1"`M`J*8(P)@@"T,`F5<`@`P+0```0^.1``$`C"((XY#```"D*`M)`+_ +M_P"3F"$R`,"8+6>]`.#?OW]PW[5_:-^T?V#? +MLW]8W[)_4-^Q?TC?L']``^``"&>]?_``````)&)__P!%$",(`!?Z,$)__SP" +M%!B,1%=D$(``$#P"%``DA/__?(3X`V1"1I``!!CX-`6`"``$(_@`12@M`&08 +M+30$@`@`HQ@MK$```*Q```0`1!`M%$/__``````\`Q``/`(4&&1C7E@#X``( +M_$-MF&>]_^@T`X``_[````"`@"W_OP`0_[$`"(R"````0R`K$(``&@````". +M!``$`(,H*Q"@`!8D17__`*0H(P`%*"]`!AGO?_0_[0`(#P4%!B.@E=D +M_[\`*/^S`!C_L@`0_[$`"!!``!G_L```/!'_@#P3%``V,0$!``"`+0`1CCAF +M]`#!GO?_X/`(>W/^E```T0F]!2*)"````$"U(H@(! +MBZ(``DBB`@:3H@`&2*("!).B``=(H@($2"("`0`"$$`D!___"``8MB1(`@`0 +M2``)`````'!#03(`PQ@MC&4`"!2G__HD0@`!WZ(``*QD``C\8@```^``"&>] +M``AGO?_@_[\`&/^R`!#_L0`(`*"(+?^P```,`3AF`("`+0(`("T,`3AZ`$"0 +M+20#@`$R4@`'``,<^#!"``,T8\`'`!*1.``#'K@"0B`M-&-``0`$)3@``QCX +M?`(`.WQ""<,`@R`M``(1/`""$"7<0P``$B``%20"``$D`@`#?$,8AWP"`#M\ +M0@G#/`7_\``"$3PTI0`C`$0@)0`%*OS\@P``-*4`^-^_`!@`11`EW[(`$-^Q +M``C?L```W$(```/@``AGO0`@``````@`&.!\0QB'9[W_X/^_`!C_L@`0_[$` +M"`"@B"W_L```#`$X9@"`@"T"`"`M#`$X>@!`D"TD`X`!,E(`!P`#'/@P0@`# +M-&/`!P`2D3@``QXX`D(@+31C$`L`!"4X``,9>'P"`#M\0@G#`(,@+0`"$3P` +M@A`EW$,``!(@`!,D`@`!?$,YQWP"`#M\0@G#/`7_\``"$3PTI0`C`$0@)0`% +M*OS\@P``-*4`^-^_`!@`11`EW[(`$-^Q``C?L```W$(```/@``AGO0`@"``9 +M$WP#.<>0B```/`,0"]R)``!D8TH@D(<`!)""``,\!!`+9(1*&'TI!<,`B!@+ +M/`00"V2$2BA\1WH$`&!`+3P#$`MD8THP`(D8"SP$$`MDA$GP"``7E@!@2"T` +M````-`*N@&>]_VAP@A`#_[(`6/^D`$`\$A0`WD1&`/^S`&#_L`!(_[\`D/^^ +M`(C_MP"`_[8`>/^U`'#_M`!H_[$`4/^E`#``@B@MD*(`-WP3`#M^148``C80+0(`("UD0@`#`Z`P+0`"$/@`HA`MW$<`('SG +M5X,PY___`.`H+0P!7<0`X/`MCZ@`"`4!_X\\!/_P/`S_\```N"TUC``C``QE +M^#6,!$D(`!F8``RM.`````#?I`!`-`.N@'"#&`,`0Q`M_$`,Z*!``#;?OP"0 +MW[X`B-^W`(#?M@!XW[4`<-^T`&C?LP!@W[(`6-^Q`%#?L`!(`^``"&>]`)@( +M`!EZ_Z,`(`@`&78``+@M,((`/Q1```0T`ZZ``^``"`````````````0A@P`$ +M(8!P@R`#/`,4`-QH1@`\`_^`-&,!*7P'`#L``QH\?.<)PWSC.0;<9P```00@ +M+9"(`CB,@PST$.``&`$#0"$`X!@M)`G__SP$__!](__&-(0``R0)`(5GO?_X +M``E-?``$(OS_OP``?.0X!?QI``#\8@`(K&4`!/QF`!````%/```H+7R'>@(, +M`(G.)`8``=^_```#X``(9[T`"#P$$`L(`!>69(1*J``````\`__P9[W_J#1C +M`"/_M@`X``,:_``$LCLT8S@8_[,`(``6L?C_MP!``L.8+?^U`#`"8+@M_[0` +M*'P7*0;_OP!0?G.2`O^^`$@PA`#__[(`&`"@H"W_L0`0`,"H+?^P``C>X@`` +M?`+&!_[B```D`@$8$F(`13P"``$\`__P-&,`(S1"``(``QK\,)(`'S1C.`!^ +M0F('`L.`+0(`B"U^$)("?!$I!OXB```D`@$8$@(`1P`````,`+=2)`0``SP# +M``$T8X:@/`0AC7!#$`,TA.]!``0D.#2$:]L`!"1X-(0TVP!$`!T``"@0``4L +MNGP"^#L\!/_P`*(H+32$`",`!"+\-(0X$`+$("U\!"D&`````'P#^#MD8P/H +M?`+X.P!#$"L40/_]`````-R"``#(40`%`````'P#^#L`91@K%&#_]`````#( +M4``$,$/__R0"`4$08@`@`````-^_`%#?O@!(W[<`0-^V`#C?M0`PW[0`*-^S +M`"#?L@`8W[$`$-^P``@#X``(9[T`6-QBR.`\`__P-&,`(SP"``$``QK\-$(` +M`C1C.``PD@`?`L.`+7Y"8@<"`(@M?A"2`GP1*0;^(@``)`(!&!8"_[L````` +M"``:?]QBR/C>X@``?`+&!_[B```D`@$8$F("#3P"__`D`P`0-$(`(P`"$OPT +M0C@(`L*P+0+`\"U^UI("?!XI!O_#```D`P$8$L,!_@`````D`@`6?D)B!_XB +M```D`@$8$@(!\SP"__!\`_@[_Z,```P`MU(D!``#/`0``32$AJ`\!2&-<$00 +M`S2E[T'?HP````4L.#2E:]L`!2QX-*4TVP!%`!W?P@`````@$``$)+K(40`/ +M`(,@+0````!\`O@[`((0*Q1```H`````?`/X.V1C`&1\`O@[`$,0*Q1`__T` +M````W\(``.A1__0`````WN(````5JL`VHP!`?`+&!_[B```D`@$8$F(!PSP" +M__`P8O___\(``"0"`1@2P@&X/`+_\"0"``%^0F('_B(``"0"`1@2`@&M/`+_ +M\'P#^#O_HP``#`"W4B0$``,\!``!-(2&H#P%(8UP1!`#-*7O0=^C````!2PX +M-*5KVP`%+'@TI33;`$4`'=_"`````"`0``0DNLA1``X`@R`M?`+X.P""$"L4 +M0``*`````'P#^#MD8P!D?`+X.P!#$"L40/_]`````-_"``#H4?_T`````-[B +M````%*"`-I0``7P"Q@?^X@``)`(!&!)B`7X\`O_P,I3__R0"`1C_U```$L(! +MX@``?`+&!_[B```D`@$8$F(! +M/#P"__#_P```)`(!&!+"`3(\`O_P)`(``WY"8@?^(@``)`(!&!("`2<\`O_P +M?`/X._^C```,`+=2)`0``SP$``$TA(:@/`4AC7!$$`,TI>]!WZ,````%+#@T +MI6O;``4L>#2E--L`10`=W\(`````(!``!"2ZR%$`#P"#("T`````?`+X.P"" +M$"L40``*`````'P#^#MD8P!D?`+X.P!#$"L40/_]`````-_"``#H4?_T```` +M`-[B```VHP!0?`+&!_[B```D`@$8$F(`^#P"__`P8O___\(``"0"`1@2P@#M *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Sep 12 23:42:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BA56E25377; Tue, 12 Sep 2017 23:42:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05F6169208; Tue, 12 Sep 2017 23:42:53 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CNgrn6092298; Tue, 12 Sep 2017 23:42:53 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CNgrmL092297; Tue, 12 Sep 2017 23:42:53 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201709122342.v8CNgrmL092297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 12 Sep 2017 23:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323510 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 323510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 23:42:54 -0000 Author: sbruno Date: Tue Sep 12 23:42:52 2017 New Revision: 323510 URL: https://svnweb.freebsd.org/changeset/base/323510 Log: Do not try to build the Cavium Liquidio driver on all architechtures. For now, limit to amd64 only. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Sep 12 23:36:58 2017 (r323509) +++ head/sys/conf/files Tue Sep 12 23:42:52 2017 (r323510) @@ -2216,62 +2216,6 @@ dev/le/if_le_pci.c optional le pci dev/le/lance.c optional le dev/led/led.c standard dev/lge/if_lge.c optional lge -dev/liquidio/base/cn23xx_pf_device.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_console.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_ctrl.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_device.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_droq.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_mem_ops.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_request_manager.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_response_manager.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_core.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_ioctl.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_main.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_rss.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_rxtx.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_sysctl.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -lio.c optional lio \ - compile-with "${AWK} -f $S/tools/fw_stub.awk lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ - no-implicit-rule before-depend local \ - clean "lio.c" -lio_23xx_nic.bin.fw.fwo optional lio \ - dependency "lio_23xx_nic.bin.fw" \ - compile-with "${NORMAL_FWO}" \ - no-implicit-rule \ - clean "lio_23xx_nic.bin.fw.fwo" -lio_23xx_nic.bin.fw optional lio \ - dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ - compile-with "${NORMAL_FW}" \ - no-obj no-implicit-rule \ - clean "lio_23xx_nic.bin.fw" dev/lmc/if_lmc.c optional lmc dev/malo/if_malo.c optional malo dev/malo/if_malohal.c optional malo From owner-svn-src-all@freebsd.org Tue Sep 12 23:44:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56B1AE254B0 for ; Tue, 12 Sep 2017 23:44:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B8D469400 for ; Tue, 12 Sep 2017 23:44:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x233.google.com with SMTP id j141so56211931ioj.4 for ; Tue, 12 Sep 2017 16:44:26 -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=zetxBxDIM/DeIQixwgJ4PFFfTW43UimabQX4W3PVpIc=; b=b60SHNL51cUOBSt+lTKFCQkA4huXtEJ3PQ+j4t3Fz0AVrn95E+3kIQXMuw6HZz25nE YZ4legyllEB9DUrMFnRpAhbuNLl/UunF5Qv8y01cD8CiXXMp99hWkO6XBqSaa7PFycDh 5ryO9tPJ2x1PMe3h32T7A9HVjCR2zecOeyeEnQJBcwjRuxUKzXu7PUL5od622iY/FxtN Tgs7VoHwIzlpWXNEttmPglkRULIwl/A1vpdjrOuWD+GXP9aFWqRV40WLRBF9x11My/uQ P16/2L7bldfyEhNIcS3U2qBJ2AHFYcJzUbI8mu9mdCCVIzpjEqjQH890kkC9lR7A/6+Y vgrw== 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=zetxBxDIM/DeIQixwgJ4PFFfTW43UimabQX4W3PVpIc=; b=oBPakT4FJ+7mPLLZyCfCFNb+4eSZgTZe0HaTepkzQhLWBJbeZ0UxcOeuTrDux6jbzZ psKNFOKN5jb8ddi9OdusG+iRv7xXVFbxuFigae03mmpSCflqBD2h2yBQLzz40gRwRkNq u/iH/vDKKtufK51FXfI80Zu/8gX34WRe1IHH8vaj0ggkp6JVZWQ2n7JD4Ome5yiYPCwR qs7zRDBAwK1IraveBcvnaWwMt0bPZJ9riLig7UNlbxSUdoqjS6xUOxwIGYmjHoUx9IST M0QPvB1EnkYt277g46QmXANhKCzrA+8seeArPVgPKY0VHRlr0ptyWBMghKbqaiFTBGCN jGqw== X-Gm-Message-State: AHPjjUj2cmoSPCAuvph9jUPsIPvWt7wi5cSPYcUx7EtHdqvLlZSEozYG U7cGHacNbz+yZcq1sNXPL3tHBHjzN1I6 X-Google-Smtp-Source: AOwi7QDhuUfHiwYSvSpMoP+ae2qdghdB0YSSYKQOqCOyHir0LrhXY5NYATLMRRt7gO2ieQuZJMrUDaMXRVhRd3VXPD4= X-Received: by 10.107.185.7 with SMTP id j7mr21841826iof.221.1505259865309; Tue, 12 Sep 2017 16:44:25 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Tue, 12 Sep 2017 16:44:24 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:60a7:d7e6:aef8:c203] In-Reply-To: <201709122342.v8CNgrmL092297@repo.freebsd.org> References: <201709122342.v8CNgrmL092297@repo.freebsd.org> From: Warner Losh Date: Tue, 12 Sep 2017 17:44:24 -0600 X-Google-Sender-Auth: Ve5RzRvqKmAU4xjx-7ZlRO3at34 Message-ID: Subject: Re: svn commit: r323510 - head/sys/conf To: Sean Bruno 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 23:44:26 -0000 This is the *WRONG* way to have it build only on 64-bit architectures. Leave it in files. Only build the *MODULE* on 64-bit architectures.... Warner On Tue, Sep 12, 2017 at 5:42 PM, Sean Bruno wrote: > Author: sbruno > Date: Tue Sep 12 23:42:52 2017 > New Revision: 323510 > URL: https://svnweb.freebsd.org/changeset/base/323510 > > Log: > Do not try to build the Cavium Liquidio driver on all architechtures. > > For now, limit to amd64 only. > > Modified: > head/sys/conf/files > > Modified: head/sys/conf/files > ============================================================ > ================== > --- head/sys/conf/files Tue Sep 12 23:36:58 2017 (r323509) > +++ head/sys/conf/files Tue Sep 12 23:42:52 2017 (r323510) > @@ -2216,62 +2216,6 @@ dev/le/if_le_pci.c optional le pci > dev/le/lance.c optional le > dev/led/led.c standard > dev/lge/if_lge.c optional lge > -dev/liquidio/base/cn23xx_pf_device.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_console.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_ctrl.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_device.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_droq.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_mem_ops.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_request_manager.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/base/lio_response_manager.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/lio_core.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/lio_ioctl.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/lio_main.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/lio_rss.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/lio_rxtx.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -dev/liquidio/lio_sysctl.c optional lio \ > - compile-with "${NORMAL_C} \ > - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" > -lio.c optional lio \ > - compile-with "${AWK} -f $S/tools/fw_stub.awk > lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ > - no-implicit-rule before-depend local \ > - clean "lio.c" > -lio_23xx_nic.bin.fw.fwo optional lio \ > - dependency "lio_23xx_nic.bin.fw" \ > - compile-with "${NORMAL_FWO}" \ > - no-implicit-rule \ > - clean "lio_23xx_nic.bin.fw.fwo" > -lio_23xx_nic.bin.fw optional lio \ > - dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ > - compile-with "${NORMAL_FW}" \ > - no-obj no-implicit-rule \ > - clean "lio_23xx_nic.bin.fw" > dev/lmc/if_lmc.c optional lmc > dev/malo/if_malo.c optional malo > dev/malo/if_malohal.c optional malo > > From owner-svn-src-all@freebsd.org Tue Sep 12 23:46:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A43E5E255F2; Tue, 12 Sep 2017 23:46:34 +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 6ED5469591; Tue, 12 Sep 2017 23:46:34 +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 v8CNkXUc092487; Tue, 12 Sep 2017 23:46:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CNkX6A092486; Tue, 12 Sep 2017 23:46:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709122346.v8CNkX6A092486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 12 Sep 2017 23:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323511 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 323511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 23:46:34 -0000 Author: imp Date: Tue Sep 12 23:46:33 2017 New Revision: 323511 URL: https://svnweb.freebsd.org/changeset/base/323511 Log: cam iosched: Limit the quanta default to hz if it's below 200 The cam_iosched_ticker() can't be scheduled more than once per tick. Some limiters depend on quanta matching the number of calls per second to enforce the proper limits. Limit the quanta to no faster than 1 per clock tick. This fixes some features when running in VMs where the default HZ is 100. PR: 221953 Obtained from: ElectroBSD Differential Revision: https://reviews.freebsd.org/D12337 Submitted by: Fabian Keil Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Tue Sep 12 23:42:52 2017 (r323510) +++ head/sys/cam/cam_iosched.c Tue Sep 12 23:46:33 2017 (r323511) @@ -1022,7 +1022,7 @@ cam_iosched_init(struct cam_iosched_softc **iscp, stru bioq_init(&(*iscp)->write_queue); (*iscp)->read_bias = 100; (*iscp)->current_read_bias = 100; - (*iscp)->quanta = 200; + (*iscp)->quanta = min(hz, 200); cam_iosched_iop_stats_init(*iscp, &(*iscp)->read_stats); cam_iosched_iop_stats_init(*iscp, &(*iscp)->write_stats); cam_iosched_iop_stats_init(*iscp, &(*iscp)->trim_stats); From owner-svn-src-all@freebsd.org Tue Sep 12 23:58:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF093E25EB8; Tue, 12 Sep 2017 23:58:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A97769C86; Tue, 12 Sep 2017 23:58:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8CNwcSA096914; Tue, 12 Sep 2017 23:58:38 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8CNwcPp096912; Tue, 12 Sep 2017 23:58:38 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201709122358.v8CNwcPp096912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 12 Sep 2017 23:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323512 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 323512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 23:58:39 -0000 Author: sbruno Date: Tue Sep 12 23:58:38 2017 New Revision: 323512 URL: https://svnweb.freebsd.org/changeset/base/323512 Log: Leave the Cavium Liquid IO driver exist in files, not files.amd64 Submitted by: imp Modified: head/sys/conf/files head/sys/conf/files.amd64 Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Sep 12 23:46:33 2017 (r323511) +++ head/sys/conf/files Tue Sep 12 23:58:38 2017 (r323512) @@ -2216,6 +2216,62 @@ dev/le/if_le_pci.c optional le pci dev/le/lance.c optional le dev/led/led.c standard dev/lge/if_lge.c optional lge +dev/liquidio/base/cn23xx_pf_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_console.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_ctrl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_droq.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_mem_ops.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_request_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_response_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_core.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_ioctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_main.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rss.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rxtx.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_sysctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +lio.c optional lio \ + compile-with "${AWK} -f $S/tools/fw_stub.awk lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "lio.c" +lio_23xx_nic.bin.fw.fwo optional lio \ + dependency "lio_23xx_nic.bin.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "lio_23xx_nic.bin.fw.fwo" +lio_23xx_nic.bin.fw optional lio \ + dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "lio_23xx_nic.bin.fw" dev/lmc/if_lmc.c optional lmc dev/malo/if_malo.c optional malo dev/malo/if_malohal.c optional malo Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Sep 12 23:46:33 2017 (r323511) +++ head/sys/conf/files.amd64 Tue Sep 12 23:58:38 2017 (r323512) @@ -328,62 +328,6 @@ dev/hyperv/vmbus/vmbus_res.c optional hyperv dev/hyperv/vmbus/vmbus_xact.c optional hyperv dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv -dev/liquidio/base/cn23xx_pf_device.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_console.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_ctrl.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_device.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_droq.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_mem_ops.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_request_manager.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/base/lio_response_manager.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_core.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_ioctl.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_main.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_rss.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_rxtx.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -dev/liquidio/lio_sysctl.c optional lio \ - compile-with "${NORMAL_C} \ - -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" -lio.c optional lio \ - compile-with "${AWK} -f $S/tools/fw_stub.awk lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ - no-implicit-rule before-depend local \ - clean "lio.c" -lio_23xx_nic.bin.fw.fwo optional lio \ - dependency "lio_23xx_nic.bin.fw" \ - compile-with "${NORMAL_FWO}" \ - no-implicit-rule \ - clean "lio_23xx_nic.bin.fw.fwo" -lio_23xx_nic.bin.fw optional lio \ - dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ - compile-with "${NORMAL_FW}" \ - no-obj no-implicit-rule \ - clean "lio_23xx_nic.bin.fw" dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb From owner-svn-src-all@freebsd.org Wed Sep 13 00:25:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61504E0113C; Wed, 13 Sep 2017 00:25:10 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30E606AAA6; Wed, 13 Sep 2017 00:25:10 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D0P9Af008818; Wed, 13 Sep 2017 00:25:09 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D0P9tp008817; Wed, 13 Sep 2017 00:25:09 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201709130025.v8D0P9tp008817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Wed, 13 Sep 2017 00:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323513 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 323513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 00:25:10 -0000 Author: mjoras Date: Wed Sep 13 00:25:09 2017 New Revision: 323513 URL: https://svnweb.freebsd.org/changeset/base/323513 Log: Allow vlan interfaces to rx through netmap(4). Normally after receiving a packet, a vlan(4) interface sends the packet back through its parent interface's rx routine so that it can be processed as an untagged frame. It does this by using the parent's ifp->if_input. This is incompatible with netmap(4), which replaces the vlan(4) interface's if_input with a netmap(4) hook. Fix this by using the vlan(4) interface's ifp instead of the parent's directly. Reported by: Harry Schmalzbauer Reviewed by: rstone Approved by: rstone (mentor) MFC after: 3 days Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12191 Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Tue Sep 12 23:58:38 2017 (r323512) +++ head/sys/net/if_vlan.c Wed Sep 13 00:25:09 2017 (r323513) @@ -1384,7 +1384,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) VLAN_RUNLOCK(); /* Pass it back through the parent's input routine. */ - (*ifp->if_input)(ifv->ifv_ifp, m); + (*ifv->ifv_ifp->if_input)(ifv->ifv_ifp, m); } static void From owner-svn-src-all@freebsd.org Wed Sep 13 00:37:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 742D7E01A29; Wed, 13 Sep 2017 00:37:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 439276B190; Wed, 13 Sep 2017 00:37:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D0bgLs013104; Wed, 13 Sep 2017 00:37:42 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D0bgPw013103; Wed, 13 Sep 2017 00:37:42 GMT (envelope-from np@FreeBSD.org) Message-Id: <201709130037.v8D0bgPw013103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 13 Sep 2017 00:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323514 - head/usr.sbin/cxgbetool X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/usr.sbin/cxgbetool X-SVN-Commit-Revision: 323514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 00:37:43 -0000 Author: np Date: Wed Sep 13 00:37:42 2017 New Revision: 323514 URL: https://svnweb.freebsd.org/changeset/base/323514 Log: cxgbetool(8): mode must be specified when creating the dump file. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/usr.sbin/cxgbetool/cxgbetool.c Modified: head/usr.sbin/cxgbetool/cxgbetool.c ============================================================================== --- head/usr.sbin/cxgbetool/cxgbetool.c Wed Sep 13 00:25:09 2017 (r323513) +++ head/usr.sbin/cxgbetool/cxgbetool.c Wed Sep 13 00:37:42 2017 (r323514) @@ -1896,7 +1896,8 @@ dumpstate(int argc, const char *argv[]) return (EINVAL); } - fd = open(fname, O_CREAT | O_TRUNC | O_EXCL | O_WRONLY); + fd = open(fname, O_CREAT | O_TRUNC | O_EXCL | O_WRONLY, + S_IRUSR | S_IRGRP); if (fd < 0) { warn("open(%s)", fname); return (errno); From owner-svn-src-all@freebsd.org Wed Sep 13 00:51:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 600D6E024AE; Wed, 13 Sep 2017 00:51:37 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29AB66B91B; Wed, 13 Sep 2017 00:51:37 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D0pa9J020155; Wed, 13 Sep 2017 00:51:36 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D0paSx020154; Wed, 13 Sep 2017 00:51:36 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709130051.v8D0paSx020154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 13 Sep 2017 00:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323515 - stable/11/lib/msun/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/11/lib/msun/tests X-SVN-Commit-Revision: 323515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 00:51:37 -0000 Author: rlibby Date: Wed Sep 13 00:51:36 2017 New Revision: 323515 URL: https://svnweb.freebsd.org/changeset/base/323515 Log: MFC r321483 (by ngie): Mask issues with duplicate definitions for __fnstcw, __fldenv, and __fldcw on i386 by ignoring -Wmacro-redefined. This is a bandaid until the code is fixed and will be reverted before MFC. This unbreaks the tinderbox build for i386. Although the head commit log suggests this would not be MFC'd, it nevertheless is being MFC'd as the commit that enabled the warnings that this silences was MFC'd without any proper fix for the warnings (head r321455, stable/11 r323299). Modified: stable/11/lib/msun/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/tests/Makefile ============================================================================== --- stable/11/lib/msun/tests/Makefile Wed Sep 13 00:37:42 2017 (r323514) +++ stable/11/lib/msun/tests/Makefile Wed Sep 13 00:51:36 2017 (r323515) @@ -84,6 +84,10 @@ SRCS.ilogb2_test= ilogb_test.c LIBADD+= m +.if ${MACHINE_CPUARCH} == "i386" +# XXX: __fldcw macro mismatch between fenv.h and ieeefp.h . +CWARNFLAGS.clang+= -Wno-error=macro-redefined +.endif WARNS?= 1 # Copied from lib/msun/Makefile From owner-svn-src-all@freebsd.org Wed Sep 13 01:18:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B972AE0352A; Wed, 13 Sep 2017 01:18:44 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 734FB6C598; Wed, 13 Sep 2017 01:18:44 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D1IhOJ029225; Wed, 13 Sep 2017 01:18:43 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D1IgvB029215; Wed, 13 Sep 2017 01:18:42 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201709130118.v8D1IgvB029215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 13 Sep 2017 01:18:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in head/sys: dev/bnxt dev/e1000 kern net sys X-SVN-Commit-Revision: 323516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 01:18:44 -0000 Author: shurd Date: Wed Sep 13 01:18:42 2017 New Revision: 323516 URL: https://svnweb.freebsd.org/changeset/base/323516 Log: Roll up iflib commits from github. This pulls in most of the work done by Matt Macy as well as other changes which he has accepted via pull request to his github repo at https://github.com/mattmacy/networking/ This should bring -CURRENT and the github repo into close enough sync to allow small feature branches rather than a large chain of interdependant patches being developed out of tree. The reset of the synchronization should be able to be completed on github by splitting the remaining changes that are not yet ready into short feature branches for later review as smaller commits. Here is a summary of changes included in this patch: 1) More checks when INVARIANTS are enabled for eariler problem detection 2) Group Task Queue cleanups - Fix use of duplicate shortdesc for gtaskqueue malloc type. Some interfaces such as memguard(9) use the short description to identify malloc types, so duplicates should be avoided. 3) Allow gtaskqueues to use ithreads in addition to taskqueues - In some cases, this can improve performance 4) Better logging when taskqgroup_attach*() fails to set interrupt affinity. 5) Do not start gtaskqueues until they're needed 6) Have mp_ring enqueue function enter the ABDICATED rather than BUSY state. This moves the TX to the gtaskq and allows processing to continue faster as well as make TX batching more likely. 7) Add an ift_txd_errata function to struct if_txrx. This allows drivers to inspect/modify mbufs before transmission. 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need checksums zeroed for checksum offload to work. This avoids modifying packet data in the TX path when possible. 9) Use ithreads for iflib I/O instead of taskqueues 10) Clean up ioctl and support async ioctl functions 11) Prefetch two cachlines from each mbuf instead of one up to 128B. We often need to parse packet header info beyond 64B. 12) Fix potential memory corruption due to fence post error in bit_nclear() usage. 13) Improved hang detection and handling 14) If the packet is smaller than MTU, disable the TSO flags. This avoids extra packet parsing when not needed. 15) Move TCP header parsing inside the IS_TSO?() test. This avoids extra packet parsing when not needed. 16) Pass chains of mbufs that are not consumed by lro to if_input() rather call if_input() for each mbuf. 17) Re-arrange packet header loads to get as much work as possible done before a cache stall. 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_POST()/ IFDI_DETACH(); 19) Attempt to distribute RX/TX tasks across cores more sensibly, especially when RX and TX share an interrupt. RX will attempt to take the first threads on a core, and TX will attempt to take successive threads. 20) Allow iflib_softirq_alloc_generic() to request affinity to the same cpus an interrupt has affinity with. This allows TX queues to ensure they are serviced by the socket the device is on. 21) Add new iflib sysctls to net.iflib: - timer_int - interval at which to run per-queue timers in ticks - force_busdma 22) Add new per-device iflib sysctls to dev.X.Y.iflib - rx_budget allows tuning the batch size on the RX path - watchdog_events Count of watchdog events seen since load 23) Fix error where netmap_rxq_init() could get called before IFDI_INIT() 24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY when waiting for firmware - After interrupts are enabled, convert all waits to sleeps - Eliminates e1000 software/firmware synchronization busy waits after startup 25) e1000: Remove special case for budget=1 in em_txrx.c - Premature optimization which may actually be incorrect with multi-segment packets 26) e1000: Split out TX interrupt rather than share an interrupt for RX and TX. - Allows better performance by keeping RX and TX paths separate 27) e1000: Separate igb from em code where suitable Much easier to understand separate functions and "if (is_igb)" than previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))" #blamebruno Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12235 Modified: head/sys/dev/bnxt/if_bnxt.c head/sys/dev/e1000/e1000_80003es2lan.c head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/e1000_82575.c head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_i210.c head/sys/dev/e1000/e1000_i210.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_mac.h head/sys/dev/e1000/e1000_osdep.h head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/net/iflib.h head/sys/net/mp_ring.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/bnxt/if_bnxt.c Wed Sep 13 01:18:42 2017 (r323516) @@ -1640,7 +1640,8 @@ bnxt_msix_intr_assign(if_ctx_t ctx, int msix) } for (i=0; iscctx->isc_ntxqsets; i++) - iflib_softirq_alloc_generic(ctx, i + 1, IFLIB_INTR_TX, NULL, i, + /* TODO: Benchmark and see if tying to the RX irqs helps */ + iflib_softirq_alloc_generic(ctx, -1, IFLIB_INTR_TX, NULL, i, "tx_cp"); return rc; Modified: head/sys/dev/e1000/e1000_80003es2lan.c ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_80003es2lan.c Wed Sep 13 01:18:42 2017 (r323516) @@ -59,7 +59,6 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw); -static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); @@ -68,7 +67,6 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e10 static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); -static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw); static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw); @@ -299,7 +297,7 @@ static s32 e1000_acquire_phy_80003es2lan(struct e1000_ DEBUGFUNC("e1000_acquire_phy_80003es2lan"); mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; - return e1000_acquire_swfw_sync_80003es2lan(hw, mask); + return e1000_acquire_swfw_sync(hw, mask); } /** @@ -315,7 +313,7 @@ static void e1000_release_phy_80003es2lan(struct e1000 DEBUGFUNC("e1000_release_phy_80003es2lan"); mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; - e1000_release_swfw_sync_80003es2lan(hw, mask); + e1000_release_swfw_sync(hw, mask); } /** @@ -333,7 +331,7 @@ static s32 e1000_acquire_mac_csr_80003es2lan(struct e1 mask = E1000_SWFW_CSR_SM; - return e1000_acquire_swfw_sync_80003es2lan(hw, mask); + return e1000_acquire_swfw_sync(hw, mask); } /** @@ -350,7 +348,7 @@ static void e1000_release_mac_csr_80003es2lan(struct e mask = E1000_SWFW_CSR_SM; - e1000_release_swfw_sync_80003es2lan(hw, mask); + e1000_release_swfw_sync(hw, mask); } /** @@ -365,14 +363,14 @@ static s32 e1000_acquire_nvm_80003es2lan(struct e1000_ DEBUGFUNC("e1000_acquire_nvm_80003es2lan"); - ret_val = e1000_acquire_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); + ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); if (ret_val) return ret_val; ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) - e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); return ret_val; } @@ -388,78 +386,7 @@ static void e1000_release_nvm_80003es2lan(struct e1000 DEBUGFUNC("e1000_release_nvm_80003es2lan"); e1000_release_nvm_generic(hw); - e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); -} - -/** - * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore - * @hw: pointer to the HW structure - * @mask: specifies which semaphore to acquire - * - * Acquire the SW/FW semaphore to access the PHY or NVM. The mask - * will also specify which port we're acquiring the lock for. - **/ -static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) -{ - u32 swfw_sync; - u32 swmask = mask; - u32 fwmask = mask << 16; - s32 i = 0; - s32 timeout = 50; - - DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); - - while (i < timeout) { - if (e1000_get_hw_semaphore_generic(hw)) - return -E1000_ERR_SWFW_SYNC; - - swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - if (!(swfw_sync & (fwmask | swmask))) - break; - - /* Firmware currently using resource (fwmask) - * or other software thread using resource (swmask) - */ - e1000_put_hw_semaphore_generic(hw); - msec_delay_irq(5); - i++; - } - - if (i == timeout) { - DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); - return -E1000_ERR_SWFW_SYNC; - } - - swfw_sync |= swmask; - E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - - e1000_put_hw_semaphore_generic(hw); - - return E1000_SUCCESS; -} - -/** - * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore - * @hw: pointer to the HW structure - * @mask: specifies which semaphore to acquire - * - * Release the SW/FW semaphore used to access the PHY or NVM. The mask - * will also specify which port we're releasing the lock for. - **/ -static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) -{ - u32 swfw_sync; - - DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); - - while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) - ; /* Empty */ - - swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - swfw_sync &= ~mask; - E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - - e1000_put_hw_semaphore_generic(hw); + e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); } /** Modified: head/sys/dev/e1000/e1000_82571.c ============================================================================== --- head/sys/dev/e1000/e1000_82571.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_82571.c Wed Sep 13 01:18:42 2017 (r323516) @@ -70,11 +70,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data); static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); -static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw); static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); -static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); -static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, @@ -125,8 +122,8 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw phy->ops.get_cable_length = e1000_get_cable_length_igp_2; phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.write_reg = e1000_write_phy_reg_igp; - phy->ops.acquire = e1000_get_hw_semaphore_82571; - phy->ops.release = e1000_put_hw_semaphore_82571; + phy->ops.acquire = e1000_get_hw_semaphore; + phy->ops.release = e1000_put_hw_semaphore; break; case e1000_82573: phy->type = e1000_phy_m88; @@ -138,12 +135,11 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.read_reg = e1000_read_phy_reg_m88; phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.acquire = e1000_get_hw_semaphore_82571; - phy->ops.release = e1000_put_hw_semaphore_82571; + phy->ops.acquire = e1000_get_hw_semaphore; + phy->ops.release = e1000_put_hw_semaphore; break; case e1000_82574: case e1000_82583: - E1000_MUTEX_INIT(&hw->dev_spec._82571.swflag_mutex); phy->type = e1000_phy_bm; phy->ops.get_cfg_done = e1000_get_cfg_done_generic; @@ -506,99 +502,21 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) } /** - * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore + * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore * @hw: pointer to the HW structure * - * Acquire the HW semaphore to access the PHY or NVM - **/ -static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) -{ - u32 swsm; - s32 sw_timeout = hw->nvm.word_size + 1; - s32 fw_timeout = hw->nvm.word_size + 1; - s32 i = 0; - - DEBUGFUNC("e1000_get_hw_semaphore_82571"); - - /* If we have timedout 3 times on trying to acquire - * the inter-port SMBI semaphore, there is old code - * operating on the other port, and it is not - * releasing SMBI. Modify the number of times that - * we try for the semaphore to interwork with this - * older code. - */ - if (hw->dev_spec._82571.smb_counter > 2) - sw_timeout = 1; - - /* Get the SW semaphore */ - while (i < sw_timeout) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - i++; - } - - if (i == sw_timeout) { - DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); - hw->dev_spec._82571.smb_counter++; - } - /* Get the FW semaphore. */ - for (i = 0; i < fw_timeout; i++) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); - - /* Semaphore acquired if bit latched */ - if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) - break; - - usec_delay(50); - } - - if (i == fw_timeout) { - /* Release semaphores */ - e1000_put_hw_semaphore_82571(hw); - DEBUGOUT("Driver can't access the NVM\n"); - return -E1000_ERR_NVM; - } - - return E1000_SUCCESS; -} - -/** - * e1000_put_hw_semaphore_82571 - Release hardware semaphore - * @hw: pointer to the HW structure - * - * Release hardware semaphore used to access the PHY or NVM - **/ -static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) -{ - u32 swsm; - - DEBUGFUNC("e1000_put_hw_semaphore_generic"); - - swsm = E1000_READ_REG(hw, E1000_SWSM); - - swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); - - E1000_WRITE_REG(hw, E1000_SWSM, swsm); -} - -/** - * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore - * @hw: pointer to the HW structure - * * Acquire the HW semaphore during reset. * **/ -static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw) +static s32 +e1000_get_hw_semaphore_82574(struct e1000_hw *hw) { u32 extcnf_ctrl; s32 i = 0; - + /* XXX assert that mutex is held */ DEBUGFUNC("e1000_get_hw_semaphore_82573"); + ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); do { extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; @@ -614,7 +532,7 @@ static s32 e1000_get_hw_semaphore_82573(struct e1000_h if (i == MDIO_OWNERSHIP_TIMEOUT) { /* Release semaphores */ - e1000_put_hw_semaphore_82573(hw); + e1000_put_hw_semaphore_82574(hw); DEBUGOUT("Driver can't access the PHY\n"); return -E1000_ERR_PHY; } @@ -623,17 +541,18 @@ static s32 e1000_get_hw_semaphore_82573(struct e1000_h } /** - * e1000_put_hw_semaphore_82573 - Release hardware semaphore + * e1000_put_hw_semaphore_82574 - Release hardware semaphore * @hw: pointer to the HW structure * * Release hardware semaphore used during reset. * **/ -static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw) +static void +e1000_put_hw_semaphore_82574(struct e1000_hw *hw) { u32 extcnf_ctrl; - DEBUGFUNC("e1000_put_hw_semaphore_82573"); + DEBUGFUNC("e1000_put_hw_semaphore_82574"); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); extcnf_ctrl &= ~E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; @@ -641,41 +560,6 @@ static void e1000_put_hw_semaphore_82573(struct e1000_ } /** - * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore - * @hw: pointer to the HW structure - * - * Acquire the HW semaphore to access the PHY or NVM. - * - **/ -static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) -{ - s32 ret_val; - - DEBUGFUNC("e1000_get_hw_semaphore_82574"); - - E1000_MUTEX_LOCK(&hw->dev_spec._82571.swflag_mutex); - ret_val = e1000_get_hw_semaphore_82573(hw); - if (ret_val) - E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); - return ret_val; -} - -/** - * e1000_put_hw_semaphore_82574 - Release hardware semaphore - * @hw: pointer to the HW structure - * - * Release hardware semaphore used to access the PHY or NVM - * - **/ -static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) -{ - DEBUGFUNC("e1000_put_hw_semaphore_82574"); - - e1000_put_hw_semaphore_82573(hw); - E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); -} - -/** * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure * @active: TRUE to enable LPLU, FALSE to disable @@ -746,7 +630,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw DEBUGFUNC("e1000_acquire_nvm_82571"); - ret_val = e1000_get_hw_semaphore_82571(hw); + ret_val = e1000_get_hw_semaphore(hw); if (ret_val) return ret_val; @@ -759,7 +643,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw } if (ret_val) - e1000_put_hw_semaphore_82571(hw); + e1000_put_hw_semaphore(hw); return ret_val; } @@ -775,7 +659,7 @@ static void e1000_release_nvm_82571(struct e1000_hw *h DEBUGFUNC("e1000_release_nvm_82571"); e1000_release_nvm_generic(hw); - e1000_put_hw_semaphore_82571(hw); + e1000_put_hw_semaphore(hw); } /** @@ -1092,8 +976,6 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) */ switch (hw->mac.type) { case e1000_82573: - ret_val = e1000_get_hw_semaphore_82573(hw); - break; case e1000_82574: case e1000_82583: ret_val = e1000_get_hw_semaphore_82574(hw); @@ -1110,10 +992,6 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) /* Must release MDIO ownership and mutex after MAC reset. */ switch (hw->mac.type) { case e1000_82573: - /* Release mutex only if the hw semaphore is acquired */ - if (!ret_val) - e1000_put_hw_semaphore_82573(hw); - break; case e1000_82574: case e1000_82583: /* Release mutex only if the hw semaphore is acquired */ @@ -1121,6 +999,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) e1000_put_hw_semaphore_82574(hw); break; default: + panic("unknown mac type %x\n", hw->mac.type); break; } Modified: head/sys/dev/e1000/e1000_82575.c ============================================================================== --- head/sys/dev/e1000/e1000_82575.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_82575.c Wed Sep 13 01:18:42 2017 (r323516) @@ -79,11 +79,9 @@ static s32 e1000_valid_led_default_82575(struct e1000 static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 data); static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); -static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); -static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); @@ -511,12 +509,8 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw /* link info */ mac->ops.get_link_up_info = e1000_get_link_up_info_82575; /* acquire SW_FW sync */ - mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_82575; - mac->ops.release_swfw_sync = e1000_release_swfw_sync_82575; - if (mac->type >= e1000_i210) { - mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_i210; - mac->ops.release_swfw_sync = e1000_release_swfw_sync_i210; - } + mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync; + mac->ops.release_swfw_sync = e1000_release_swfw_sync; /* set lan id for port to determine which phy lock to use */ hw->mac.ops.set_lan_id(hw); @@ -988,7 +982,7 @@ static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw DEBUGFUNC("e1000_acquire_nvm_82575"); - ret_val = e1000_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); + ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); if (ret_val) goto out; @@ -1019,7 +1013,7 @@ static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) - e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); out: return ret_val; @@ -1038,83 +1032,7 @@ static void e1000_release_nvm_82575(struct e1000_hw *h e1000_release_nvm_generic(hw); - e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); -} - -/** - * e1000_acquire_swfw_sync_82575 - Acquire SW/FW semaphore - * @hw: pointer to the HW structure - * @mask: specifies which semaphore to acquire - * - * Acquire the SW/FW semaphore to access the PHY or NVM. The mask - * will also specify which port we're acquiring the lock for. - **/ -static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) -{ - u32 swfw_sync; - u32 swmask = mask; - u32 fwmask = mask << 16; - s32 ret_val = E1000_SUCCESS; - s32 i = 0, timeout = 200; - - DEBUGFUNC("e1000_acquire_swfw_sync_82575"); - - while (i < timeout) { - if (e1000_get_hw_semaphore_generic(hw)) { - ret_val = -E1000_ERR_SWFW_SYNC; - goto out; - } - - swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - if (!(swfw_sync & (fwmask | swmask))) - break; - - /* - * Firmware currently using resource (fwmask) - * or other software thread using resource (swmask) - */ - e1000_put_hw_semaphore_generic(hw); - msec_delay_irq(5); - i++; - } - - if (i == timeout) { - DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); - ret_val = -E1000_ERR_SWFW_SYNC; - goto out; - } - - swfw_sync |= swmask; - E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - - e1000_put_hw_semaphore_generic(hw); - -out: - return ret_val; -} - -/** - * e1000_release_swfw_sync_82575 - Release SW/FW semaphore - * @hw: pointer to the HW structure - * @mask: specifies which semaphore to acquire - * - * Release the SW/FW semaphore used to access the PHY or NVM. The mask - * will also specify which port we're releasing the lock for. - **/ -static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask) -{ - u32 swfw_sync; - - DEBUGFUNC("e1000_release_swfw_sync_82575"); - - while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) - ; /* Empty */ - - swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - swfw_sync &= ~mask; - E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - - e1000_put_hw_semaphore_generic(hw); + e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); } /** Modified: head/sys/dev/e1000/e1000_hw.h ============================================================================== --- head/sys/dev/e1000/e1000_hw.h Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_hw.h Wed Sep 13 01:18:42 2017 (r323516) @@ -934,7 +934,6 @@ struct e1000_dev_spec_82543 { struct e1000_dev_spec_82571 { bool laa_is_present; u32 smb_counter; - E1000_MUTEX swflag_mutex; }; struct e1000_dev_spec_80003es2lan { @@ -958,8 +957,6 @@ enum e1000_ulp_state { struct e1000_dev_spec_ich8lan { bool kmrn_lock_loss_workaround_enabled; struct e1000_shadow_ram shadow_ram[E1000_SHADOW_RAM_WORDS]; - E1000_MUTEX nvm_mutex; - E1000_MUTEX swflag_mutex; bool nvm_k1_enabled; bool disable_k1_off; bool eee_disable; Modified: head/sys/dev/e1000/e1000_i210.c ============================================================================== --- head/sys/dev/e1000/e1000_i210.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_i210.c Wed Sep 13 01:18:42 2017 (r323516) @@ -37,7 +37,6 @@ static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw); static void e1000_release_nvm_i210(struct e1000_hw *hw); -static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw); static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); static s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw); @@ -58,7 +57,7 @@ static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw) DEBUGFUNC("e1000_acquire_nvm_i210"); - ret_val = e1000_acquire_swfw_sync_i210(hw, E1000_SWFW_EEP_SM); + ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); return ret_val; } @@ -74,152 +73,7 @@ static void e1000_release_nvm_i210(struct e1000_hw *hw { DEBUGFUNC("e1000_release_nvm_i210"); - e1000_release_swfw_sync_i210(hw, E1000_SWFW_EEP_SM); -} - -/** - * e1000_acquire_swfw_sync_i210 - Acquire SW/FW semaphore - * @hw: pointer to the HW structure - * @mask: specifies which semaphore to acquire - * - * Acquire the SW/FW semaphore to access the PHY or NVM. The mask - * will also specify which port we're acquiring the lock for. - **/ -s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask) -{ - u32 swfw_sync; - u32 swmask = mask; - u32 fwmask = mask << 16; - s32 ret_val = E1000_SUCCESS; - s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ - - DEBUGFUNC("e1000_acquire_swfw_sync_i210"); - - while (i < timeout) { - if (e1000_get_hw_semaphore_i210(hw)) { - ret_val = -E1000_ERR_SWFW_SYNC; - goto out; - } - - swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - if (!(swfw_sync & (fwmask | swmask))) - break; - - /* - * Firmware currently using resource (fwmask) - * or other software thread using resource (swmask) - */ - e1000_put_hw_semaphore_generic(hw); - msec_delay_irq(5); - i++; - } - - if (i == timeout) { - DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); - ret_val = -E1000_ERR_SWFW_SYNC; - goto out; - } - - swfw_sync |= swmask; - E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - - e1000_put_hw_semaphore_generic(hw); - -out: - return ret_val; -} - -/** - * e1000_release_swfw_sync_i210 - Release SW/FW semaphore - * @hw: pointer to the HW structure - * @mask: specifies which semaphore to acquire - * - * Release the SW/FW semaphore used to access the PHY or NVM. The mask - * will also specify which port we're releasing the lock for. - **/ -void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask) -{ - u32 swfw_sync; - - DEBUGFUNC("e1000_release_swfw_sync_i210"); - - while (e1000_get_hw_semaphore_i210(hw) != E1000_SUCCESS) - ; /* Empty */ - - swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - swfw_sync &= ~mask; - E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - - e1000_put_hw_semaphore_generic(hw); -} - -/** - * e1000_get_hw_semaphore_i210 - Acquire hardware semaphore - * @hw: pointer to the HW structure - * - * Acquire the HW semaphore to access the PHY or NVM - **/ -static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw) -{ - u32 swsm; - s32 timeout = hw->nvm.word_size + 1; - s32 i = 0; - - DEBUGFUNC("e1000_get_hw_semaphore_i210"); - - /* Get the SW semaphore */ - while (i < timeout) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - i++; - } - - if (i == timeout) { - /* In rare circumstances, the SW semaphore may already be held - * unintentionally. Clear the semaphore once before giving up. - */ - if (hw->dev_spec._82575.clear_semaphore_once) { - hw->dev_spec._82575.clear_semaphore_once = FALSE; - e1000_put_hw_semaphore_generic(hw); - for (i = 0; i < timeout; i++) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - } - } - - /* If we do not have the semaphore here, we have to give up. */ - if (i == timeout) { - DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); - return -E1000_ERR_NVM; - } - } - - /* Get the FW semaphore. */ - for (i = 0; i < timeout; i++) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); - - /* Semaphore acquired if bit latched */ - if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) - break; - - usec_delay(50); - } - - if (i == timeout) { - /* Release semaphores */ - e1000_put_hw_semaphore_generic(hw); - DEBUGOUT("Driver can't access the NVM\n"); - return -E1000_ERR_NVM; - } - - return E1000_SUCCESS; + e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); } /** Modified: head/sys/dev/e1000/e1000_i210.h ============================================================================== --- head/sys/dev/e1000/e1000_i210.h Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_i210.h Wed Sep 13 01:18:42 2017 (r323516) @@ -43,8 +43,6 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); -s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask); -void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask); s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data); s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, Modified: head/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- head/sys/dev/e1000/e1000_ich8lan.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_ich8lan.c Wed Sep 13 01:18:42 2017 (r323516) @@ -694,9 +694,6 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_ dev_spec->shadow_ram[i].value = 0xFFFF; } - E1000_MUTEX_INIT(&dev_spec->nvm_mutex); - E1000_MUTEX_INIT(&dev_spec->swflag_mutex); - /* Function Pointers */ nvm->ops.acquire = e1000_acquire_nvm_ich8lan; nvm->ops.release = e1000_release_nvm_ich8lan; @@ -1847,7 +1844,7 @@ static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw * { DEBUGFUNC("e1000_acquire_nvm_ich8lan"); - E1000_MUTEX_LOCK(&hw->dev_spec.ich8lan.nvm_mutex); + ASSERT_CTX_LOCK_HELD(hw); return E1000_SUCCESS; } @@ -1862,9 +1859,7 @@ static void e1000_release_nvm_ich8lan(struct e1000_hw { DEBUGFUNC("e1000_release_nvm_ich8lan"); - E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.nvm_mutex); - - return; + ASSERT_CTX_LOCK_HELD(hw); } /** @@ -1881,7 +1876,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_h DEBUGFUNC("e1000_acquire_swflag_ich8lan"); - E1000_MUTEX_LOCK(&hw->dev_spec.ich8lan.swflag_mutex); + ASSERT_CTX_LOCK_HELD(hw); while (timeout) { extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); @@ -1922,9 +1917,6 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_h } out: - if (ret_val) - E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); - return ret_val; } @@ -1949,10 +1941,6 @@ static void e1000_release_swflag_ich8lan(struct e1000_ } else { DEBUGOUT("Semaphore unexpectedly released by sw/fw/hw\n"); } - - E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); - - return; } /** @@ -5022,8 +5010,6 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_FEXTNVM3, reg); } - if (!ret_val) - E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); if (ctrl & E1000_CTRL_PHY_RST) { ret_val = hw->phy.ops.get_cfg_done(hw); Modified: head/sys/dev/e1000/e1000_mac.c ============================================================================== --- head/sys/dev/e1000/e1000_mac.c Wed Sep 13 00:51:36 2017 (r323515) +++ head/sys/dev/e1000/e1000_mac.c Wed Sep 13 01:18:42 2017 (r323516) @@ -1707,76 +1707,6 @@ s32 e1000_get_speed_and_duplex_fiber_serdes_generic(st } /** - * e1000_get_hw_semaphore_generic - Acquire hardware semaphore - * @hw: pointer to the HW structure - * - * Acquire the HW semaphore to access the PHY or NVM - **/ -s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw) -{ - u32 swsm; - s32 timeout = hw->nvm.word_size + 1; - s32 i = 0; - - DEBUGFUNC("e1000_get_hw_semaphore_generic"); - - /* Get the SW semaphore */ - while (i < timeout) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - i++; - } - - if (i == timeout) { - DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); - return -E1000_ERR_NVM; - } - - /* Get the FW semaphore. */ - for (i = 0; i < timeout; i++) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); - - /* Semaphore acquired if bit latched */ - if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) - break; - - usec_delay(50); - } - - if (i == timeout) { - /* Release semaphores */ - e1000_put_hw_semaphore_generic(hw); - DEBUGOUT("Driver can't access the NVM\n"); - return -E1000_ERR_NVM; - } - - return E1000_SUCCESS; -} - -/** - * e1000_put_hw_semaphore_generic - Release hardware semaphore - * @hw: pointer to the HW structure - * - * Release hardware semaphore used to access the PHY or NVM - **/ -void e1000_put_hw_semaphore_generic(struct e1000_hw *hw) -{ - u32 swsm; - - DEBUGFUNC("e1000_put_hw_semaphore_generic"); - - swsm = E1000_READ_REG(hw, E1000_SWSM); - - swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); - - E1000_WRITE_REG(hw, E1000_SWSM, swsm); -} - -/** * e1000_get_auto_rd_done_generic - Check for auto read completion * @hw: pointer to the HW structure * @@ -2251,3 +2181,186 @@ s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw return E1000_SUCCESS; } + +/** + * e1000_get_hw_semaphore - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM + **/ +s32 e1000_get_hw_semaphore(struct e1000_hw *hw) +{ + u32 swsm; + s32 timeout = hw->nvm.word_size + 1; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore"); +#ifdef notyet + /* _82571 */ + /* If we have timedout 3 times on trying to acquire + * the inter-port SMBI semaphore, there is old code + * operating on the other port, and it is not + * releasing SMBI. Modify the number of times that + * we try for the semaphore to interwork with this + * older code. + */ + if (hw->dev_spec._82571.smb_counter > 2) + sw_timeout = 1; + +#endif + /* Get the SW semaphore */ + while (i < timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == timeout) { +#ifdef notyet + /* + * XXX This sounds more like a driver bug whereby we either + * recursed accidentally or missed clearing it previously + */ + /* In rare circumstances, the SW semaphore may already be held + * unintentionally. Clear the semaphore once before giving up. + */ + if (hw->dev_spec._82575.clear_semaphore_once) { + hw->dev_spec._82575.clear_semaphore_once = FALSE; + e1000_put_hw_semaphore_generic(hw); + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + } + } +#endif + + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + return -E1000_ERR_NVM; + } + + /* Get the FW semaphore. */ + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); + + /* Semaphore acquired if bit latched */ + if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) + break; + + usec_delay(50); + } + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 13 01:55:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC153E04E03; Wed, 13 Sep 2017 01:55:04 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53]) (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 7CAEF6D823; Wed, 13 Sep 2017 01:55:04 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f53.google.com with SMTP id i130so17329273pgc.3; Tue, 12 Sep 2017 18:55:04 -0700 (PDT) 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=3YNUYXbfTsnTcV9XciyK/qL9OggbbYQ6oGu9HkVVzD4=; b=eodRKGCPlglcmBBCWANhLCOD2wZku7Q2ve6gZrt45EKpeEfLl1AKFmEqY0XcbjJAVK aotnhubGRMOZeT0Za0NI+pfgN4AboakcZt3V2FJUGIRox1eraSm+5FTBYWkniWYMEsE6 kcMORYit8Pn27+gtUZjak9E53ObgeG0oH/8fKm30S8nYEAohkcLNn9uoosKRkIaiTshs EXQopnV9bnqQU5cuFYej4l+rWdyrzNDUKviuybW4mJ3tzmT/lqEZUygCsdVAGRP75Gnk gSvXxqH7c0kugYNUlY40E9D12y3Za2lPuKWrxK0tvBW57Jz7btLCg3P6cAo1F2PYOKch mcgg== X-Gm-Message-State: AHPjjUhaKx4zIO0ePpyBCK/oYB4VdHYTOmNqqk9Wz1E0ZKi1VfJOb4Kz sDT0fZNqdys0UrtAptxMLA== X-Received: by 10.101.68.130 with SMTP id l2mr16417937pgq.346.1505267264270; Tue, 12 Sep 2017 18:47:44 -0700 (PDT) Received: from mail-pg0-f45.google.com (mail-pg0-f45.google.com. [74.125.83.45]) by smtp.gmail.com with ESMTPSA id l85sm23819306pfb.176.2017.09.12.18.47.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 18:47:43 -0700 (PDT) Received: by mail-pg0-f45.google.com with SMTP id 188so24571655pgb.2; Tue, 12 Sep 2017 18:47:43 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6ZOmLSEXzdB2hvHH1LYA/chmdFXsJBIrLJ3W5uqmoKt4I7i5hJtLuaJV673DkNvGmF5klgrY5oe0JNOKTExzc= X-Received: by 10.84.133.35 with SMTP id 32mr18778987plf.249.1505267263009; Tue, 12 Sep 2017 18:47:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Tue, 12 Sep 2017 18:47:42 -0700 (PDT) In-Reply-To: <201709130118.v8D1IgvB029215@repo.freebsd.org> References: <201709130118.v8D1IgvB029215@repo.freebsd.org> From: Ryan Libby Date: Tue, 12 Sep 2017 18:47:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys To: Stephen Hurd Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Sean Bruno Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 01:55:04 -0000 On Tue, Sep 12, 2017 at 6:18 PM, Stephen Hurd wrote: > Author: shurd > Date: Wed Sep 13 01:18:42 2017 > New Revision: 323516 > URL: https://svnweb.freebsd.org/changeset/base/323516 > > Log: > Roll up iflib commits from github. This pulls in most of the work done > by Matt Macy as well as other changes which he has accepted via pull > request to his github repo at https://github.com/mattmacy/networking/ > > This should bring -CURRENT and the github repo into close enough sync to > allow small feature branches rather than a large chain of interdependant > patches being developed out of tree. The reset of the synchronization > should be able to be completed on github by splitting the remaining > changes that are not yet ready into short feature branches for later > review as smaller commits. > > Here is a summary of changes included in this patch: > > 1) More checks when INVARIANTS are enabled for eariler problem > detection > 2) Group Task Queue cleanups > - Fix use of duplicate shortdesc for gtaskqueue malloc type. > Some interfaces such as memguard(9) use the short description to > identify malloc types, so duplicates should be avoided. > 3) Allow gtaskqueues to use ithreads in addition to taskqueues > - In some cases, this can improve performance > 4) Better logging when taskqgroup_attach*() fails to set interrupt > affinity. > 5) Do not start gtaskqueues until they're needed > 6) Have mp_ring enqueue function enter the ABDICATED rather than BUSY > state. This moves the TX to the gtaskq and allows processing to > continue faster as well as make TX batching more likely. > 7) Add an ift_txd_errata function to struct if_txrx. This allows > drivers to inspect/modify mbufs before transmission. > 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need > checksums zeroed for checksum offload to work. This avoids modifying > packet data in the TX path when possible. > 9) Use ithreads for iflib I/O instead of taskqueues > 10) Clean up ioctl and support async ioctl functions > 11) Prefetch two cachlines from each mbuf instead of one up to 128B. We > often need to parse packet header info beyond 64B. > 12) Fix potential memory corruption due to fence post error in > bit_nclear() usage. > 13) Improved hang detection and handling > 14) If the packet is smaller than MTU, disable the TSO flags. > This avoids extra packet parsing when not needed. > 15) Move TCP header parsing inside the IS_TSO?() test. > This avoids extra packet parsing when not needed. > 16) Pass chains of mbufs that are not consumed by lro to if_input() > rather call if_input() for each mbuf. > 17) Re-arrange packet header loads to get as much work as possible done > before a cache stall. > 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_POST()/ > IFDI_DETACH(); > 19) Attempt to distribute RX/TX tasks across cores more sensibly, > especially when RX and TX share an interrupt. RX will attempt to > take the first threads on a core, and TX will attempt to take > successive threads. > 20) Allow iflib_softirq_alloc_generic() to request affinity to the same > cpus an interrupt has affinity with. This allows TX queues to > ensure they are serviced by the socket the device is on. > 21) Add new iflib sysctls to net.iflib: > - timer_int - interval at which to run per-queue timers in ticks > - force_busdma > 22) Add new per-device iflib sysctls to dev.X.Y.iflib > - rx_budget allows tuning the batch size on the RX path > - watchdog_events Count of watchdog events seen since load > 23) Fix error where netmap_rxq_init() could get called before > IFDI_INIT() > 24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY > when waiting for firmware > - After interrupts are enabled, convert all waits to sleeps > - Eliminates e1000 software/firmware synchronization busy waits after > startup > 25) e1000: Remove special case for budget=1 in em_txrx.c > - Premature optimization which may actually be incorrect with > multi-segment packets > 26) e1000: Split out TX interrupt rather than share an interrupt for > RX and TX. > - Allows better performance by keeping RX and TX paths separate > 27) e1000: Separate igb from em code where suitable > Much easier to understand separate functions and "if (is_igb)" than > previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))" > > #blamebruno > > Reviewed by: sbruno > Approved by: sbruno (mentor) > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D12235 > > Modified: > head/sys/dev/bnxt/if_bnxt.c > head/sys/dev/e1000/e1000_80003es2lan.c > head/sys/dev/e1000/e1000_82571.c > head/sys/dev/e1000/e1000_82575.c > head/sys/dev/e1000/e1000_hw.h > head/sys/dev/e1000/e1000_i210.c > head/sys/dev/e1000/e1000_i210.h > head/sys/dev/e1000/e1000_ich8lan.c > head/sys/dev/e1000/e1000_mac.c > head/sys/dev/e1000/e1000_mac.h > head/sys/dev/e1000/e1000_osdep.h > head/sys/dev/e1000/em_txrx.c > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_em.h > head/sys/kern/subr_gtaskqueue.c > head/sys/net/iflib.c > head/sys/net/iflib.h > head/sys/net/mp_ring.c > head/sys/sys/gtaskqueue.h This broke gcc builds again, e.g. [1], [2]: > /usr/src/sys/dev/e1000/e1000_osdep.h:81: warning: redundant redeclaration of 'cold' [-Wredundant-decls] > /usr/src/sys/sys/systm.h:50: warning: previous declaration of 'cold' was here sys/dev/e1000/e1000_osdep.h is already including sys/sys/systm.h directly so I think this can just be fixed by deleting extern int cold; from e1000_osdep.h. [1] https://ci.freebsd.org/job/FreeBSD-head-powerpc64-build/1104 [2] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/3039/ From owner-svn-src-all@freebsd.org Wed Sep 13 02:32:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCB30E066AA; Wed, 13 Sep 2017 02:32:20 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) (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 B364A6E918; Wed, 13 Sep 2017 02:32:20 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pf0-f174.google.com with SMTP id q76so7863648pfq.2; Tue, 12 Sep 2017 19:32:20 -0700 (PDT) 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=vkygJu6QHKkQ8wTNgFsIpmR2uDMfcVm414nG7njIlPo=; b=XyExWHEP/ZmXaeMjdcP5L+wHwy0JdfSAaNSTtKGTTCNNAhUDC271gDizRdy5/dFr5y 2fWnQK4XgnmFxtsLnn/4hr0z11ley9KNHCfxRrK66IXY7FIm1RNCjE6OG32YlfjGw6NL 3/FpGkQ+pedn+WV+5FIwR/AjtKBndGOGH+kbzavL5/8ceSz/sFAGnMisiASjWfh3IkEm t4uKR6CI8ksPkRX20lx8Auqx6W2nljRkont9un7paBI4RyEnpptCyer1VTXQQ/XXAekK Yb9P8vVF0M0872NjAGOEipgOzv847to1Lt9KPRXFmHLRjKv8BRmLfXMDsxEclVJsKNbf Kv8w== X-Gm-Message-State: AHPjjUhLxyh3oysyTsCfe6vApNF1dBonT+tUVIw7jYrb9LGy9D9aS3/Q gnbAKL/FqzpU3jAMC5iJeQ== X-Received: by 10.84.210.69 with SMTP id z63mr19294377plh.431.1505269933486; Tue, 12 Sep 2017 19:32:13 -0700 (PDT) Received: from mail-pg0-f46.google.com (mail-pg0-f46.google.com. [74.125.83.46]) by smtp.gmail.com with ESMTPSA id h88sm23532204pfa.24.2017.09.12.19.32.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 19:32:13 -0700 (PDT) Received: by mail-pg0-f46.google.com with SMTP id j16so14518094pga.1; Tue, 12 Sep 2017 19:32:13 -0700 (PDT) X-Google-Smtp-Source: ADKCNb7NkD8zpuESEd+7E18J2GMEgp8VFMV2l5iPbnGzHZ+53Z0poq4tlL+mq1I6bKsk800r8KHBTCPXgprG57LzHQ4= X-Received: by 10.99.186.81 with SMTP id l17mr16278724pgu.170.1505269932942; Tue, 12 Sep 2017 19:32:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Tue, 12 Sep 2017 19:32:12 -0700 (PDT) In-Reply-To: References: <201709080437.v884bnIh029199@repo.freebsd.org> From: Ryan Libby Date: Tue, 12 Sep 2017 19:32:12 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r323299 - stable/11/lib/msun/tests To: Ngie Cooper Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 02:32:21 -0000 On Tue, Sep 12, 2017 at 2:45 AM, Ryan Libby wrote: > On Thu, Sep 7, 2017 at 9:37 PM, Ngie Cooper wrote: >> Author: ngie >> Date: Fri Sep 8 04:37:49 2017 >> New Revision: 323299 >> URL: https://svnweb.freebsd.org/changeset/base/323299 >> >> Log: >> MFC r321455: >> >> Raise WARNS to 1 >> >> This will enable warnings with the msun tests. >> >> Modified: >> stable/11/lib/msun/tests/Makefile >> Directory Properties: >> stable/11/ (props changed) >> >> Modified: stable/11/lib/msun/tests/Makefile >> ============================================================================== >> --- stable/11/lib/msun/tests/Makefile Fri Sep 8 04:35:44 2017 (r323298) >> +++ stable/11/lib/msun/tests/Makefile Fri Sep 8 04:37:49 2017 (r323299) >> @@ -4,8 +4,6 @@ >> >> TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libm >> >> -WARNS?= 0 >> - >> # All architectures on FreeBSD have fenv.h >> CFLAGS+= -DHAVE_FENV_H >> >> @@ -85,6 +83,8 @@ IGNORE_PRAGMA= >> SRCS.ilogb2_test= ilogb_test.c >> >> LIBADD+= m >> + >> +WARNS?= 1 >> >> # Copied from lib/msun/Makefile >> .if ${MACHINE_CPUARCH} == "i386" > > This seems to have broken the i386 build [1]. Did you mean to MFC it > with r321483? > > [1] https://ci.freebsd.org/job/FreeBSD-stable-11-i386-build/1521/ I MFC'd head r321483 to stable/11 in r323515 in order to unbreak the build for i386. I realize this may not have been the plan, so, Ngie, you may like to follow up on that further. From owner-svn-src-all@freebsd.org Wed Sep 13 02:44:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 236D7E06D6D; Wed, 13 Sep 2017 02:44:52 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E69186F0EC; Wed, 13 Sep 2017 02:44:51 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D2ioUW066194; Wed, 13 Sep 2017 02:44:50 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D2ioqo066193; Wed, 13 Sep 2017 02:44:50 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201709130244.v8D2ioqo066193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 13 Sep 2017 02:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323517 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 323517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 02:44:52 -0000 Author: shurd Date: Wed Sep 13 02:44:50 2017 New Revision: 323517 URL: https://svnweb.freebsd.org/changeset/base/323517 Log: Fix GCC build failure caused by r323516 No need to declare cold when we #include Reported by: Jenkins Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12347 Modified: head/sys/dev/e1000/e1000_osdep.h Modified: head/sys/dev/e1000/e1000_osdep.h ============================================================================== --- head/sys/dev/e1000/e1000_osdep.h Wed Sep 13 01:18:42 2017 (r323516) +++ head/sys/dev/e1000/e1000_osdep.h Wed Sep 13 02:44:50 2017 (r323517) @@ -78,7 +78,6 @@ ms_scale(int x) { return (max(1, x/(1000/hz))); } } -extern int cold; static inline void safe_pause_us(int x) { From owner-svn-src-all@freebsd.org Wed Sep 13 03:56:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4268FE096E1; Wed, 13 Sep 2017 03:56:05 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D08C711FF; Wed, 13 Sep 2017 03:56:04 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D3u4nH095429; Wed, 13 Sep 2017 03:56:04 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D3u4ve095428; Wed, 13 Sep 2017 03:56:04 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201709130356.v8D3u4ve095428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 13 Sep 2017 03:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323518 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 323518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 03:56:05 -0000 Author: sbruno Date: Wed Sep 13 03:56:03 2017 New Revision: 323518 URL: https://svnweb.freebsd.org/changeset/base/323518 Log: Jenkins i386 LINT build uses NOTES to generate its LINT kernel config. ixl(4) isn't in here either, so I'll remove lio(4) too. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Sep 13 02:44:50 2017 (r323517) +++ head/sys/conf/NOTES Wed Sep 13 03:56:03 2017 (r323518) @@ -2144,7 +2144,6 @@ device ixgb # Intel Pro/10Gbe PCI-X Ethernet device ix # Intel Pro/10Gbe PCIE Ethernet device ixv # Intel Pro/10Gbe PCIE Ethernet VF device le # AMD Am7900 LANCE and Am79C9xx PCnet -device lio # Cavium 23XX Ethernet device mxge # Myricom Myri-10G 10GbE NIC device nxge # Neterion Xframe 10GbE Server/Storage Adapter device oce # Emulex 10 GbE (OneConnect Ethernet) From owner-svn-src-all@freebsd.org Wed Sep 13 04:32:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34852E0B113; Wed, 13 Sep 2017 04:32:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03C33721D3; Wed, 13 Sep 2017 04:32:23 +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 v8D4WNZh011580; Wed, 13 Sep 2017 04:32:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D4WNgF011579; Wed, 13 Sep 2017 04:32:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709130432.v8D4WNgF011579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 13 Sep 2017 04:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323519 - head/lib/libefivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libefivar X-SVN-Commit-Revision: 323519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 04:32:24 -0000 Author: imp Date: Wed Sep 13 04:32:23 2017 New Revision: 323519 URL: https://svnweb.freebsd.org/changeset/base/323519 Log: Minor fixes to edge cases in efi_get_next_variable_name Fix allocating more memory for the names (unlikely to be needed, but still best to get right) to ask for the length the kernel told use we needed, not the old length of the variable. Mind the proper NUL that we add in the space we allocate. Free the old name string before we allcoate a new one to limit what we leak to the last one (free passed in name for the last one in the list), and detect the last one by rv != 0 and errno == ENOENT, rather then just the former to avoid false positives if errno happens to be ENOENT on entry. Sponsored by: Netflix Modified: head/lib/libefivar/efivar.c Modified: head/lib/libefivar/efivar.c ============================================================================== --- head/lib/libefivar/efivar.c Wed Sep 13 03:56:03 2017 (r323518) +++ head/lib/libefivar/efivar.c Wed Sep 13 04:32:23 2017 (r323519) @@ -225,8 +225,13 @@ efi_get_next_variable_name(efi_guid_t **guid, char **n if (efi_open_dev() == -1) return -1; + /* + * Always allocate enough for an extra NUL on the end, but don't tell + * the IOCTL about it so we can NUL terminate the name before converting + * it to UTF8. + */ if (buf == NULL) - buf = malloc(buflen); + buf = malloc(buflen + sizeof(efi_char)); again: efi_var_reset(&var); @@ -244,21 +249,23 @@ again: rv = ioctl(efi_fd, EFIIOC_VAR_NEXT, &var); if (rv == 0 && var.name == NULL) { /* - * oops, too little space. Try again. + * Variable name not long enough, so allocate more space for the + * name and try again. As above, mind the NUL we add. */ - void *new = realloc(buf, buflen); - buflen = var.namesize; + void *new = realloc(buf, var.namesize + sizeof(efi_char)); if (new == NULL) { rv = -1; errno = ENOMEM; goto done; } + buflen = var.namesize; buf = new; goto again; } if (rv == 0) { - *name = NULL; /* XXX */ + free(*name); /* Free last name, to avoid leaking */ + *name = NULL; /* Force ucs2_to_utf8 to malloc new space */ var.name[var.namesize / sizeof(efi_char)] = 0; /* EFI doesn't NUL terminate */ rv = ucs2_to_utf8(var.name, name); if (rv != 0) @@ -269,9 +276,11 @@ again: errout: /* XXX The linux interface expects name to be a static buffer -- fix or leak memory? */ + /* XXX for the moment, we free just before we'd leak, but still leak last one */ done: - if (errno == ENOENT) { + if (rv != 0 && errno == ENOENT) { errno = 0; + free(*name); /* Free last name, to avoid leaking */ return 0; } From owner-svn-src-all@freebsd.org Wed Sep 13 05:56:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1516EE0E139; Wed, 13 Sep 2017 05:56:08 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7352A741EC; Wed, 13 Sep 2017 05:56:07 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x244.google.com with SMTP id f84so7134715pfj.3; Tue, 12 Sep 2017 22:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=UIBahuhI1v7yEwLdvlrdneQkF20woYUP8YJ7NsGsqKk=; b=VfDosKyXtOjlJ2gk93eJRGQtDeQ2YkQgNzk30AroLOiXBRFaJgNyWjfnITRHwbFqTI juRoZoXQ/bpYI5zSZyFQVocSHg4ifYEd0cDT120VP5rWdOIqAybzeMZV5SlviG5ig03D VO5xNuHkXIhkOFuKVHHqgJ9hb/JK8yEeIhBPopV32joWNl56hrYh8NnQnB9R3mcohnD0 6b86Vif3/ut5faQEWRZfdeQKGclVsklKzyJwyc3S61SXUNekFSfLO2TiEairm6Bth/6I TUthukS3sYKFPqf+PFdzIqOFdTckcVtzJ7x2vj84snr0khBQgRPd3kHl8A4fSHj3/U0t gGKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=UIBahuhI1v7yEwLdvlrdneQkF20woYUP8YJ7NsGsqKk=; b=KciastsIBSppFZbS8ZpH/XPoAB2+lOU2ZZnKjhMtrW9xZZZrxpPuTgMV7H8hi9POwh Qti8Ds2j25S7vzb6PBky9yQgiYpsHpnQCMy+BjKlN7e6KIH3Lt57qs7N3SG340gmW4Mh Z+ZK3gZxJuOvvbniV3YhHM/2Xf+yTIJ88070qFwLlHuNLyRSUWDPW0WyI0qa6OhVYlFv A/plW5nbjzc1qZJ2gcKtnkJMraKDSRx2ATIU5S4inMKFHezNGgR0XgfT9KwS4+4owORb 58xO6yEfybU62PXnn4mhm3C5o1ar6tiSxJuyTGJVpFDNNDFo21X5VIdrOXjbjF71NdYd AqSg== X-Gm-Message-State: AHPjjUj6rM3WoGd5DEfc64YEhEZXnNiuG+Ts5nDX2V4LVbElg981Z3Zr S240KL07hYV75x8HHYKfIg== X-Google-Smtp-Source: ADKCNb4e1Ju5M0pzN8Z7cFT02Ycydad+YqpPeffDQNZi/EA8C23x/I522fzhUshJ5x84gAepHW74nQ== X-Received: by 10.99.105.130 with SMTP id e124mr16917927pgc.420.1505282166753; Tue, 12 Sep 2017 22:56:06 -0700 (PDT) Received: from ?IPv6:2607:fb90:9dce:72a3:4135:819b:49e7:7507? ([2607:fb90:9dce:72a3:4135:819b:49e7:7507]) by smtp.gmail.com with ESMTPSA id b1sm20403258pgn.55.2017.09.12.22.56.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 22:56:05 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r323515 - stable/11/lib/msun/tests From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: <201709130051.v8D0paSx020154@repo.freebsd.org> Date: Tue, 12 Sep 2017 22:56:04 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <4BC08295-1228-4EBE-80D5-3FB2BFDDD4E9@gmail.com> References: <201709130051.v8D0paSx020154@repo.freebsd.org> To: Ryan Libby X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 05:56:08 -0000 > On Sep 12, 2017, at 17:51, Ryan Libby wrote: >=20 > Author: rlibby > Date: Wed Sep 13 00:51:36 2017 > New Revision: 323515 > URL: https://svnweb.freebsd.org/changeset/base/323515 >=20 > Log: > MFC r321483 (by ngie): >=20 > Mask issues with duplicate definitions for __fnstcw, __fldenv, and > __fldcw on i386 by ignoring -Wmacro-redefined. >=20 > This is a bandaid until the code is fixed and will be reverted before > MFC. >=20 > This unbreaks the tinderbox build for i386. Although the head commit > log suggests this would not be MFC'd, it nevertheless is being MFC'd as > the commit that enabled the warnings that this silences was MFC'd > without any proper fix for the warnings (head r321455, stable/11 > r323299). Sorry for the breakage and for fixing this mistake. I forgot to MFC this= (I usually set the MFC timers properly, but apparently I didn't this time) := /.. Cheers, -Ngie= From owner-svn-src-all@freebsd.org Wed Sep 13 06:04:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FCA0E0E6E5; Wed, 13 Sep 2017 06:04:39 +0000 (UTC) (envelope-from yaneurabeya@gmail.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 C983B746A9; Wed, 13 Sep 2017 06:04:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-io0-x22b.google.com with SMTP id d16so57579424ioj.3; Tue, 12 Sep 2017 23:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=N/zb9Qr5nGJesAkJmzryCbLMZhKvu4wzOX5JyrzjFG0=; b=jCAXgG9YM63SrxaGhKqzRZTpwrODwHFphqvVjnYpAqU65SZ2+4DokyU+vLMXNjoyDw kc20uV63W2VkT1yjFdpGC6AeriaRvp+D/tJwv3lB7sNzneuZV6Ukmv2MoTKA2E5IElQ9 S8iMKwZmFjmrbRW/LmCiSIjJwU+7EsAxmb6LkagPKK5EgwDPOfE/thqaMaM4FuOQiHBw uuJGeUzUhj6cDDnrHXfHXQymHVFP5Xx9l9m33bBwIE1GpeWxZQsUDrl5HVIvhfqugc6r BxqemlNviD+eL/sgwaESH/Vc3Rgd86CXl8ugDXpRGsnZTaTbjd/FKpUsP19U6ew/dKGN nICQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=N/zb9Qr5nGJesAkJmzryCbLMZhKvu4wzOX5JyrzjFG0=; b=Uhqk3xBAM13IQXG2ZqoaOY51QNuojn2yZLlE/TEKAtZsmVHvFZizuTPf49imzUZWm1 qdnIjX5ZBygYRyv0QIkb1iar0WgQHpMoB5aVx//fpDWB+AzfyPddXSKMxqwfKIJ/tCgg zArpRVfUrJ648PvN6bCQWI33bs2vGoE8o2DH86d1Fwtua6DzIRjEJKXHdOZ0EQLPVZSj v5i26tDn4eCQAdtSmahCwVO5xO7RT4QUzzotkxVzalMzuJ2aUYrT4/MzN8SZmO8LjBrI 6DQ9bQ2KvO6GgZZM3x4eU8X4Kc+pq+BLmtdJCcQ14TTsYXETo1az24QpGwm5OaJHlKoh 4jOg== X-Gm-Message-State: AHPjjUiKPyz2anpmcPmdLAuaf4GSLRk9659Ln3Lne37h3dUUE+jXtmuf Oqc0thHTrVgryn4vFoyeAg== X-Google-Smtp-Source: AOwi7QCOOzaSI4zYWX8CIMu676OEPygQxUUO9E+AzU4nRMXdKOKKwL5O0v0f/4WEKTgaKM43Nawp3A== X-Received: by 10.107.69.1 with SMTP id s1mr27268603ioa.267.1505282677696; Tue, 12 Sep 2017 23:04:37 -0700 (PDT) Received: from ?IPv6:2607:fb90:9dce:72a3:4135:819b:49e7:7507? ([2607:fb90:9dce:72a3:4135:819b:49e7:7507]) by smtp.gmail.com with ESMTPSA id v191sm290235ith.34.2017.09.12.23.04.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 23:04:37 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r323508 - head/usr.sbin/bsdinstall/partedit From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: <201709122219.v8CMJLtl055785@repo.freebsd.org> Date: Tue, 12 Sep 2017 23:04:34 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201709122219.v8CMJLtl055785@repo.freebsd.org> To: Ravi Pokala X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 06:04:39 -0000 > On Sep 12, 2017, at 15:19, Ravi Pokala wrote: >=20 > Author: rpokala > Date: Tue Sep 12 22:19:21 2017 > New Revision: 323508 > URL: https://svnweb.freebsd.org/changeset/base/323508 >=20 > Log: > When doing a non-interactive installation, don't display an interactive > warning about a filesystem which doesn't have a mountpoint. Presumably, t= he > person who wrote the install script knew what they were doing. This seems very counterintuitive. It should fail citing the error, not p= rompt. This only mutes the prompt. Thanks, -Ngie= From owner-svn-src-all@freebsd.org Wed Sep 13 06:07:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D049BE0E84E; Wed, 13 Sep 2017 06:07:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92283748B4; Wed, 13 Sep 2017 06:07:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D6723q048066; Wed, 13 Sep 2017 06:07:02 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D672Ib048065; Wed, 13 Sep 2017 06:07:02 GMT (envelope-from np@FreeBSD.org) Message-Id: <201709130607.v8D672Ib048065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 13 Sep 2017 06:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323520 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 323520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 06:07:03 -0000 Author: np Date: Wed Sep 13 06:07:02 2017 New Revision: 323520 URL: https://svnweb.freebsd.org/changeset/base/323520 Log: cxgbe(4): Ignore capabilities that depend on TOE when the firmware reports TOE is not available. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Sep 13 04:32:23 2017 (r323519) +++ head/sys/dev/cxgbe/t4_main.c Wed Sep 13 06:07:02 2017 (r323520) @@ -3576,6 +3576,18 @@ get_params__post_init(struct adapter *sc) READ_CAPS(iscsicaps); READ_CAPS(fcoecaps); + /* + * The firmware attempts memfree TOE configuration for -SO cards and + * will report toecaps=0 if it runs out of resources (this depends on + * the config file). It may not report 0 for other capabilities + * dependent on the TOE in this case. Set them to 0 here so that the + * driver doesn't bother tracking resources that will never be used. + */ + if (sc->toecaps == 0) { + sc->iscsicaps = 0; + sc->rdmacaps = 0; + } + if (sc->niccaps & FW_CAPS_CONFIG_NIC_ETHOFLD) { param[0] = FW_PARAM_PFVF(ETHOFLD_START); param[1] = FW_PARAM_PFVF(ETHOFLD_END); From owner-svn-src-all@freebsd.org Wed Sep 13 06:13:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2789EE0EC3E for ; Wed, 13 Sep 2017 06:13:50 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D360674DC3; Wed, 13 Sep 2017 06:13:48 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [78.35.162.209] (helo=fabiankeil.de) by smtprelay05.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1ds0vb-0001K6-2Y; Wed, 13 Sep 2017 08:13:39 +0200 Date: Wed, 13 Sep 2017 08:11:04 +0200 From: Fabian Keil To: Sean Bruno Cc: Prasad V Kanneganti , svn-src-all@freebsd.org Subject: Re: svn commit: r323509 - in head: share/man/man4 sys/conf sys/contrib/dev/liquidio sys/dev/liquidio sys/dev/liquidio/base sys/modules sys/modules/lio Message-ID: <20170913081104.09ca9446@fabiankeil.de> In-Reply-To: <201709122336.v8CNaw9B088517@repo.freebsd.org> References: <201709122336.v8CNaw9B088517@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/3vGldvIBQi1iX6hhTxnbdZv"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 06:13:50 -0000 --Sig_/3vGldvIBQi1iX6hhTxnbdZv Content-Type: multipart/mixed; boundary="MP_/ES3C/RHPqZjNG/B4EIejO+3" --MP_/ES3C/RHPqZjNG/B4EIejO+3 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sean Bruno wrote: > Author: sbruno > Date: Tue Sep 12 23:36:58 2017 > New Revision: 323509 > URL: https://svnweb.freebsd.org/changeset/base/323509 >=20 > Log: > The diff is the initial submission of Cavium Liquidio 2350/2360 10/25G > Intelligent NIC driver. > =20 > The submission conconsists of firmware binary file and driver sources. Unless I missed it, the license for the blob isn't explicitly documented. Is the blob supposed to be covered by the same "BSD LICENSE" as the driver source files? > Added: > head/share/man/man4/liquidio.4 (contents, props changed) > head/sys/contrib/dev/liquidio/ > head/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu [...] > head/sys/modules/lio/Makefile (contents, props changed) WITHOUT_SOURCELESS_UCODE isn't respected. The attached patch fixes this. Fabian --MP_/ES3C/RHPqZjNG/B4EIejO+3 Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-Don-t-try-to-build-lio-if-the-user-objects-to-binary-.diff =46rom e7642d301f1cf647f6b0e5898a5a708958d73504 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Wed, 13 Sep 2017 07:36:20 +0200 Subject: [PATCH] Don't (try to) build lio if the user objects to binary blo= bs The problem was introduced in r323509/5543e587c7. Obtained from: ElectroBSD --- sys/modules/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 43d3bd9308c9..3b607c7a647b 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -711,7 +711,9 @@ _ixl=3D ixl _ixlv=3D ixlv _linux64=3D linux64 _linux_common=3D linux_common +.if ${MK_SOURCELESS_UCODE} !=3D "no" _lio=3D lio +.endif _ntb=3D ntb _pms=3D pms _qlxge=3D qlxge --=20 2.14.1 --MP_/ES3C/RHPqZjNG/B4EIejO+3-- --Sig_/3vGldvIBQi1iX6hhTxnbdZv Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTKUNd6H/m3+ByGULIFiohV/3dUnQUCWbjL+AAKCRAFiohV/3dU nU+LAJ9QfNLKelVXGdovrdYMAWLsiVlVxQCghUYmNcUTox5rYczKWuhy4Z+GDzU= =JstM -----END PGP SIGNATURE----- --Sig_/3vGldvIBQi1iX6hhTxnbdZv-- From owner-svn-src-all@freebsd.org Wed Sep 13 06:14:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8D32E0ECD7; Wed, 13 Sep 2017 06:14:44 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::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 96F4174E1B; Wed, 13 Sep 2017 06:14:44 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id v5so7216531pgn.4; Tue, 12 Sep 2017 23:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hO1Dgci4GKz2QHN9AtOEkdwPdNqcbeskPocf7YmL3Lg=; b=DTagQTtKztTj0/cq0WFQ2aksT6ZTFbIvCDAivPC9znZhaSQ7q0fPkt7+id3NIB3M2T XF3ZdYzkc5jF5X9pmzRg/B4SxbtlCGN3ZqDXSqRJs4erXr0tn0qm0rByg66x9sXwnS7G xCSlMyzZYma85m44dvKANV/YfHjegjpRT+Yu4ew9PzvjcRfie6jwFAmnCQEnIlSqRAvb Qlf4y2OYVO0WRJGErAU96+o2DOGQR8CihpT7cv+9aTXzNBNzDjveLPPbyaPkRdpmuf1z W0jCs5qnlbuEjR5cyH7oUMQUJtQGmM4CIYYUeJhPOC7NSnuTLYyf8VpmkrHGUJxotr8x reUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hO1Dgci4GKz2QHN9AtOEkdwPdNqcbeskPocf7YmL3Lg=; b=nCnVm2+InRQlIwaR9h9jS65To1Jz6GTH8MYncn3E4m65r4iYrzT+Kwh6qJAY+/4a+Y bICIdMpMvaBKq6NDNeA+Kz7kZt8KzdMavyjXMYdgHeYoAcbn04HTKfz+8hoiwNkSZx33 +ynJUq5riyQ2MOWm8pOtFtPItUAv/oIqjxyDFkSibXASD9bj733X56uybWaUBIC8/ga3 0OLl+VCn1/lNxfoXjVS7DjhyTNWrJ4DU2chOYB6rYj0K61XJgwIH94WigUJGhDommKtG KEU/GjNEAz5cm/8N8iR3XZRzwFe8Ciq7ly7dl7uer+Mpr1lpuNQSkeGmGVNAMAiXp3AB fofA== X-Gm-Message-State: AHPjjUjClpPkyaVyFPdK/g9ltHkMhh4L38T2WN3uDIkl8rGmrC7oP04e WqNXGx05/z0fhlQ37NBqlQ== X-Google-Smtp-Source: ADKCNb6S/gDpa+qzu1Ap+CSZJyFJi9u3K1lQ1gWAP/8XWT9pQIASxmKw3ZTTg7Ks+EF1avfx/YHpow== X-Received: by 10.99.126.84 with SMTP id o20mr16410090pgn.273.1505283283734; Tue, 12 Sep 2017 23:14:43 -0700 (PDT) Received: from ?IPv6:2607:fb90:9dce:72a3:4135:819b:49e7:7507? ([2607:fb90:9dce:72a3:4135:819b:49e7:7507]) by smtp.gmail.com with ESMTPSA id v25sm22486209pfg.52.2017.09.12.23.14.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 23:14:43 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: <201709130118.v8D1IgvB029215@repo.freebsd.org> Date: Tue, 12 Sep 2017 23:14:35 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com> References: <201709130118.v8D1IgvB029215@repo.freebsd.org> To: Stephen Hurd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 06:14:44 -0000 > On Sep 12, 2017, at 18:18, Stephen Hurd wrote: > > Author: shurd > Date: Wed Sep 13 01:18:42 2017 > New Revision: 323516 > URL: https://svnweb.freebsd.org/changeset/base/323516 > > Log: > Roll up iflib commits from github. This pulls in most of the work done > by Matt Macy as well as other changes which he has accepted via pull > request to his github repo at https://github.com/mattmacy/networking/ > > This should bring -CURRENT and the github repo into close enough sync to > allow small feature branches rather than a large chain of interdependant > patches being developed out of tree. The reset of the synchronization > should be able to be completed on github by splitting the remaining > changes that are not yet ready into short feature branches for later > review as smaller commits. > > Here is a summary of changes included in this patch: > > 1) More checks when INVARIANTS are enabled for eariler problem > detection > 2) Group Task Queue cleanups > - Fix use of duplicate shortdesc for gtaskqueue malloc type. > Some interfaces such as memguard(9) use the short description to > identify malloc types, so duplicates should be avoided. > 3) Allow gtaskqueues to use ithreads in addition to taskqueues > - In some cases, this can improve performance > 4) Better logging when taskqgroup_attach*() fails to set interrupt > affinity. > 5) Do not start gtaskqueues until they're needed > 6) Have mp_ring enqueue function enter the ABDICATED rather than BUSY > state. This moves the TX to the gtaskq and allows processing to > continue faster as well as make TX batching more likely. > 7) Add an ift_txd_errata function to struct if_txrx. This allows > drivers to inspect/modify mbufs before transmission. > 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need > checksums zeroed for checksum offload to work. This avoids modifying > packet data in the TX path when possible. > 9) Use ithreads for iflib I/O instead of taskqueues > 10) Clean up ioctl and support async ioctl functions > 11) Prefetch two cachlines from each mbuf instead of one up to 128B. We > often need to parse packet header info beyond 64B. > 12) Fix potential memory corruption due to fence post error in > bit_nclear() usage. > 13) Improved hang detection and handling > 14) If the packet is smaller than MTU, disable the TSO flags. > This avoids extra packet parsing when not needed. > 15) Move TCP header parsing inside the IS_TSO?() test. > This avoids extra packet parsing when not needed. > 16) Pass chains of mbufs that are not consumed by lro to if_input() > rather call if_input() for each mbuf. > 17) Re-arrange packet header loads to get as much work as possible done > before a cache stall. > 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_POST()/ > IFDI_DETACH(); > 19) Attempt to distribute RX/TX tasks across cores more sensibly, > especially when RX and TX share an interrupt. RX will attempt to > take the first threads on a core, and TX will attempt to take > successive threads. > 20) Allow iflib_softirq_alloc_generic() to request affinity to the same > cpus an interrupt has affinity with. This allows TX queues to > ensure they are serviced by the socket the device is on. > 21) Add new iflib sysctls to net.iflib: > - timer_int - interval at which to run per-queue timers in ticks > - force_busdma > 22) Add new per-device iflib sysctls to dev.X.Y.iflib > - rx_budget allows tuning the batch size on the RX path > - watchdog_events Count of watchdog events seen since load > 23) Fix error where netmap_rxq_init() could get called before > IFDI_INIT() > 24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY > when waiting for firmware > - After interrupts are enabled, convert all waits to sleeps > - Eliminates e1000 software/firmware synchronization busy waits after > startup > 25) e1000: Remove special case for budget=1 in em_txrx.c > - Premature optimization which may actually be incorrect with > multi-segment packets > 26) e1000: Split out TX interrupt rather than share an interrupt for > RX and TX. > - Allows better performance by keeping RX and TX paths separate > 27) e1000: Separate igb from em code where suitable > Much easier to understand separate functions and "if (is_igb)" than > previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))" > > #blamebruno > > Reviewed by: sbruno > Approved by: sbruno (mentor) > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D12235 *gasps at the LoC count and number of changed drivers* Could someone please better break this up in the future..? Thank you, -Ngie From owner-svn-src-all@freebsd.org Wed Sep 13 06:57:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3810E106D9; Wed, 13 Sep 2017 06:57:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 792F675F9C; Wed, 13 Sep 2017 06:57:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8D6vq8l068584; Wed, 13 Sep 2017 06:57:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D6vqI7068582; Wed, 13 Sep 2017 06:57:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709130657.v8D6vqI7068582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 13 Sep 2017 06:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323521 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 323521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 06:57:53 -0000 Author: tuexen Date: Wed Sep 13 06:57:52 2017 New Revision: 323521 URL: https://svnweb.freebsd.org/changeset/base/323521 Log: Add a command line option for using a wider field for displaying addresses. This allows the table to be consistent when IPv6 addresses have to be printed. While there, document the -v option in the man page. Sponsored by: Netflix, Inc. Modified: head/usr.bin/sockstat/sockstat.1 head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Wed Sep 13 06:07:02 2017 (r323520) +++ head/usr.bin/sockstat/sockstat.1 Wed Sep 13 06:57:52 2017 (r323521) @@ -35,7 +35,7 @@ .Nd list open sockets .Sh SYNOPSIS .Nm -.Op Fl 46cLlSsUu +.Op Fl 46cLlSsUuvw .Op Fl j Ar jid .Op Fl p Ar ports .Op Fl P Ar protocols @@ -97,6 +97,10 @@ Show .Dv AF_LOCAL .Pq Ux sockets. +.It Fl v +Verbose mode. +.It Fl w +Use wider field size for displaying addresses. .El .Pp If neither Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Wed Sep 13 06:07:02 2017 (r323520) +++ head/usr.bin/sockstat/sockstat.c Wed Sep 13 06:57:52 2017 (r323521) @@ -78,6 +78,7 @@ static int opt_s; /* Show protocol state if applicab static int opt_U; /* Show remote UDP encapsulation port number */ static int opt_u; /* Show Unix domain sockets */ static int opt_v; /* Verbose mode */ +static int opt_w; /* Wide print area for addresses */ /* * Default protocols to use if no -P was defined. @@ -1020,7 +1021,8 @@ displaysock(struct sock *s, int pos) faddr = s->faddr; first = 1; while (laddr != NULL || faddr != NULL) { - while (pos < 36) + offset = 36; + while (pos < offset) pos += xprintf(" "); switch (s->family) { case AF_INET: @@ -1030,10 +1032,12 @@ displaysock(struct sock *s, int pos) if (s->family == AF_INET6 && pos >= 58) pos += xprintf(" "); } - while (pos < 58) + offset += opt_w ? 46 : 22; + while (pos < offset) pos += xprintf(" "); if (faddr != NULL) pos += printaddr(&faddr->address); + offset += opt_w ? 46 : 22; break; case AF_UNIX: if ((laddr == NULL) || (faddr == NULL)) @@ -1048,6 +1052,7 @@ displaysock(struct sock *s, int pos) p = *(void **)&(faddr->address); if (p == NULL) { pos += xprintf("(not connected)"); + offset += opt_w ? 92 : 44; break; } pos += xprintf("-> "); @@ -1065,11 +1070,11 @@ displaysock(struct sock *s, int pos) pos += xprintf("??"); else pos += printaddr(&s_tmp->laddr->address); + offset += opt_w ? 92 : 44; break; default: abort(); } - offset = 80; if (opt_U) { if (faddr != NULL && s->proto == IPPROTO_SCTP && @@ -1147,9 +1152,10 @@ display(void) struct sock *s; int hash, n, pos; - printf("%-8s %-10s %-5s %-2s %-6s %-21s %-21s", + printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", "USER", "COMMAND", "PID", "FD", "PROTO", - "LOCAL ADDRESS", "FOREIGN ADDRESS"); + opt_w ? 45 : 21, "LOCAL ADDRESS", + opt_w ? 45 : 21, "FOREIGN ADDRESS"); if (opt_U) printf(" %-6s", "ENCAPS"); if (opt_s) { @@ -1228,7 +1234,7 @@ static void usage(void) { fprintf(stderr, - "usage: sockstat [-46cLlSsu] [-j jid] [-p ports] [-P protocols]\n"); + "usage: sockstat [-46cLlSsUuvw] [-j jid] [-p ports] [-P protocols]\n"); exit(1); } @@ -1239,7 +1245,7 @@ main(int argc, char *argv[]) int o, i; opt_j = -1; - while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuv")) != -1) + while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuvw")) != -1) switch (o) { case '4': opt_4 = 1; @@ -1279,6 +1285,9 @@ main(int argc, char *argv[]) break; case 'v': ++opt_v; + break; + case 'w': + opt_w = 1; break; default: usage(); From owner-svn-src-all@freebsd.org Wed Sep 13 07:09:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C866E10F00; Wed, 13 Sep 2017 07:09:59 +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 1B23A76636; Wed, 13 Sep 2017 07:09:59 +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 v8D79wWC072566; Wed, 13 Sep 2017 07:09:58 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8D79w1d072565; Wed, 13 Sep 2017 07:09:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709130709.v8D79w1d072565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 07:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323522 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 323522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 07:09:59 -0000 Author: avg Date: Wed Sep 13 07:09:58 2017 New Revision: 323522 URL: https://svnweb.freebsd.org/changeset/base/323522 Log: slightly simplify zfs_vptocnp It's not necessary to look up the parent's ID to check if the node is the root node of the filesystem. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c 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 Wed Sep 13 06:57:52 2017 (r323521) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 13 07:09:58 2017 (r323522) @@ -5925,7 +5925,6 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) vnode_t *vp = ap->a_vp;; zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data; znode_t *zp = VTOZ(vp); - uint64_t parent; int ltype; int error; @@ -5936,13 +5935,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) * If we are a snapshot mounted under .zfs, run the operation * on the covered vnode. */ - if ((error = sa_lookup(zp->z_sa_hdl, - SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0) { - ZFS_EXIT(zfsvfs); - return (error); - } - - if (zp->z_id != parent || zfsvfs->z_parent == zfsvfs) { + if (zp->z_id != zfsvfs->z_root || zfsvfs->z_parent == zfsvfs) { char name[MAXNAMLEN + 1]; znode_t *dzp; size_t len; From owner-svn-src-all@freebsd.org Wed Sep 13 07:11:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E83BE1119C; Wed, 13 Sep 2017 07:11:56 +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 2142E76990; Wed, 13 Sep 2017 07:11:55 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id s1psdYJcVM9gts1ptd0hlo; Wed, 13 Sep 2017 01:11:49 -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=pGLkceISAAAA:8 a=6I5d2MoRAAAA:8 a=NEAV23lmAAAA:8 a=VwQbUJbxAAAA:8 a=YxBL1-UpAAAA:8 a=Xtwukj0D_oYdYSCqfX4A:9 a=CjuIK1q_8ugA:10 a=6kGIvZw6iX1k4Y-7sg4_:22 a=IjZwj45LgO3ly-622nXo:22 a=AjGcO6oz07-iQ99wixmX:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id C8F1442D; Wed, 13 Sep 2017 00:11:47 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v8D7BlTS003204; Wed, 13 Sep 2017 00:11:47 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201709130711.v8D7BlTS003204@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: Ngie Cooper cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys In-Reply-To: Message from Ngie Cooper of "Tue, 12 Sep 2017 23:14:35 -0700." <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 13 Sep 2017 00:11:47 -0700 X-CMAE-Envelope: MS4wfEGYLMOKqyouRaDriWyYQzVgo2OvkJgszG6/O2RQbDSD31mtk+2ELDDi0UGg2aYfFiBVeEPtKV8S1ib2vBxs74fxRNTESBBk5eq06HDMt/zpETNcoAmE Ixt84wLucAmhdq5ts4ov0s6UuAiqViISdUTSsGc5VWvOvrNu/VrNRUuV151cBoDMWVRAzTubqHcdpF0updUBZ/aoJHix2EcoOiCpUeJILO4yhpgtQ3ykOHHp 22EDGNq3K0fLHTDM2lPJCCyd3Jfk6ehSOc0Xqfimap25pUVDUxmT/OVOJ6wC45pfPiLeUgt2+1rWruNNCfiVng== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 07:11:56 -0000 In message <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com>, Ngie Cooper writes : > > > On Sep 12, 2017, at 18:18, Stephen Hurd wrote: > > > > Author: shurd > > Date: Wed Sep 13 01:18:42 2017 > > New Revision: 323516 > > URL: https://svnweb.freebsd.org/changeset/base/323516 > > > > Log: > > Roll up iflib commits from github. This pulls in most of the work done > > by Matt Macy as well as other changes which he has accepted via pull > > request to his github repo at https://github.com/mattmacy/networking/ > > > > This should bring -CURRENT and the github repo into close enough sync to > > allow small feature branches rather than a large chain of interdependant > > patches being developed out of tree. The reset of the synchronization > > should be able to be completed on github by splitting the remaining > > changes that are not yet ready into short feature branches for later > > review as smaller commits. > > > > Here is a summary of changes included in this patch: > > > > 1) More checks when INVARIANTS are enabled for eariler problem > > detection > > 2) Group Task Queue cleanups > > - Fix use of duplicate shortdesc for gtaskqueue malloc type. > > Some interfaces such as memguard(9) use the short description to > > identify malloc types, so duplicates should be avoided. > > 3) Allow gtaskqueues to use ithreads in addition to taskqueues > > - In some cases, this can improve performance > > 4) Better logging when taskqgroup_attach*() fails to set interrupt > > affinity. > > 5) Do not start gtaskqueues until they're needed > > 6) Have mp_ring enqueue function enter the ABDICATED rather than BUSY > > state. This moves the TX to the gtaskq and allows processing to > > continue faster as well as make TX batching more likely. > > 7) Add an ift_txd_errata function to struct if_txrx. This allows > > drivers to inspect/modify mbufs before transmission. > > 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need > > checksums zeroed for checksum offload to work. This avoids modifying > > packet data in the TX path when possible. > > 9) Use ithreads for iflib I/O instead of taskqueues > > 10) Clean up ioctl and support async ioctl functions > > 11) Prefetch two cachlines from each mbuf instead of one up to 128B. We > > often need to parse packet header info beyond 64B. > > 12) Fix potential memory corruption due to fence post error in > > bit_nclear() usage. > > 13) Improved hang detection and handling > > 14) If the packet is smaller than MTU, disable the TSO flags. > > This avoids extra packet parsing when not needed. > > 15) Move TCP header parsing inside the IS_TSO?() test. > > This avoids extra packet parsing when not needed. > > 16) Pass chains of mbufs that are not consumed by lro to if_input() > > rather call if_input() for each mbuf. > > 17) Re-arrange packet header loads to get as much work as possible done > > before a cache stall. > > 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_POST()/ > > IFDI_DETACH(); > > 19) Attempt to distribute RX/TX tasks across cores more sensibly, > > especially when RX and TX share an interrupt. RX will attempt to > > take the first threads on a core, and TX will attempt to take > > successive threads. > > 20) Allow iflib_softirq_alloc_generic() to request affinity to the same > > cpus an interrupt has affinity with. This allows TX queues to > > ensure they are serviced by the socket the device is on. > > 21) Add new iflib sysctls to net.iflib: > > - timer_int - interval at which to run per-queue timers in ticks > > - force_busdma > > 22) Add new per-device iflib sysctls to dev.X.Y.iflib > > - rx_budget allows tuning the batch size on the RX path > > - watchdog_events Count of watchdog events seen since load > > 23) Fix error where netmap_rxq_init() could get called before > > IFDI_INIT() > > 24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY > > when waiting for firmware > > - After interrupts are enabled, convert all waits to sleeps > > - Eliminates e1000 software/firmware synchronization busy waits after > > startup > > 25) e1000: Remove special case for budget=1 in em_txrx.c > > - Premature optimization which may actually be incorrect with > > multi-segment packets > > 26) e1000: Split out TX interrupt rather than share an interrupt for > > RX and TX. > > - Allows better performance by keeping RX and TX paths separate > > 27) e1000: Separate igb from em code where suitable > > Much easier to understand separate functions and "if (is_igb)" than > > previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))" > > > > #blamebruno > > > > Reviewed by: sbruno > > Approved by: sbruno (mentor) > > Sponsored by: Limelight Networks > > Differential Revision: https://reviews.freebsd.org/D12235 > > *gasps at the LoC count and number of changed drivers* > > Could someone please better break this up in the future..? Agreed. Down the road parsing out individual commits in this jumbo commit will be difficult to parse. IMO this may as well have simply been, import from https://github.com/mattmacy/networking/, just like Mr. Torvalds does at kernel.org. I expect to see a commit like this there but not here. Can we break this down to its functional commits? -- 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-all@freebsd.org Wed Sep 13 09:06:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B6FBE15C5F for ; Wed, 13 Sep 2017 09:06:27 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de [80.67.31.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3432D7E7D1; Wed, 13 Sep 2017 09:06:26 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [78.35.162.209] (helo=fabiankeil.de) by smtprelay06.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1ds3bC-0006DN-UB; Wed, 13 Sep 2017 11:04:46 +0200 Date: Wed, 13 Sep 2017 11:04:23 +0200 From: Fabian Keil To: Warner Losh Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r323511 - head/sys/cam Message-ID: <20170913110423.01f16291@fabiankeil.de> In-Reply-To: <201709122346.v8CNkX6A092486@repo.freebsd.org> References: <201709122346.v8CNkX6A092486@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/4OJBYBrfoM8nxZL8mHZd8rR"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 09:06:27 -0000 --Sig_/4OJBYBrfoM8nxZL8mHZd8rR Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Warner Losh wrote: > Author: imp > Date: Tue Sep 12 23:46:33 2017 > New Revision: 323511 > URL: https://svnweb.freebsd.org/changeset/base/323511 >=20 > Log: > cam iosched: Limit the quanta default to hz if it's below 200 [...] =20 > PR: 221953 > Obtained from: ElectroBSD > Differential Revision: https://reviews.freebsd.org/D12337 > Submitted by: Fabian Keil Do you intend to MFC this? If not, I'll close the PR. Fabian --Sig_/4OJBYBrfoM8nxZL8mHZd8rR Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTKUNd6H/m3+ByGULIFiohV/3dUnQUCWbj0lwAKCRAFiohV/3dU nQu6AKCnFjf2KpZHgJPQLGxqKaPqSPhp6gCePQt+zCkVTz0z39aZM6XlcJBdbh0= =IXrn -----END PGP SIGNATURE----- --Sig_/4OJBYBrfoM8nxZL8mHZd8rR-- From owner-svn-src-all@freebsd.org Wed Sep 13 10:17:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55F01E18707; Wed, 13 Sep 2017 10:17:15 +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 2B36D80D34; Wed, 13 Sep 2017 10:17:15 +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 v8DAHERl051640; Wed, 13 Sep 2017 10:17:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAHE3V051639; Wed, 13 Sep 2017 10:17:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131017.v8DAHE3V051639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323523 - vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 323523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:17:15 -0000 Author: avg Date: Wed Sep 13 10:17:14 2017 New Revision: 323523 URL: https://svnweb.freebsd.org/changeset/base/323523 Log: 8331 zfs_unshare returns wrong error code for smb unshare failure illumos/illumos-gate@4f4378cc54b7deec3a35c529dc397dbdc325b4bb https://github.com/illumos/illumos-gate/commit/4f4378cc54b7deec3a35c529dc397dbdc325b4bb https://www.illumos.org/issues/8331 zfs_unshare returns EZFS_UNSHARENFSFAILED on error for all share types. Reviewed by: Marcel Telka Reviewed by: Toomas Soome Approved by: Dan McDonald Author: Andrew Stormont Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c Wed Sep 13 07:09:58 2017 (r323522) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c Wed Sep 13 10:17:14 2017 (r323523) @@ -24,6 +24,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2016 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 RackTop Systems. */ /* @@ -91,7 +92,7 @@ zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, c zfs_share_proto_t); /* - * The share protocols table must be in the same order as the zfs_share_prot_t + * The share protocols table must be in the same order as the zfs_share_proto_t * enum in libzfs_impl.h */ typedef struct { @@ -916,7 +917,7 @@ unshare_one(libzfs_handle_t *hdl, const char *name, co if ((err = zfs_init_libshare_arg(hdl, SA_INIT_ONE_SHARE_FROM_NAME, (void *)name)) != SA_OK) { free(mntpt); /* don't need the copy anymore */ - return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, + return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), name, _sa_errorstr(err))); } @@ -927,12 +928,13 @@ unshare_one(libzfs_handle_t *hdl, const char *name, co if (share != NULL) { err = zfs_sa_disable_share(share, proto_table[proto].p_name); if (err != SA_OK) { - return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, + return (zfs_error_fmt(hdl, + proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), name, _sa_errorstr(err))); } } else { - return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, + return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': not found"), name)); } From owner-svn-src-all@freebsd.org Wed Sep 13 10:22:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71748E18A19; Wed, 13 Sep 2017 10:22: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 39D1181106; Wed, 13 Sep 2017 10:22: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 v8DAM9UN055404; Wed, 13 Sep 2017 10:22:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAM9Ax055403; Wed, 13 Sep 2017 10:22:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131022.v8DAM9Ax055403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323524 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 323524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:22:10 -0000 Author: avg Date: Wed Sep 13 10:22:09 2017 New Revision: 323524 URL: https://svnweb.freebsd.org/changeset/base/323524 Log: MFV r316932: 6280 libzfs: unshare_one() could fail with EZFS_SHARENFSFAILED illumos/illumos-gate@d1672efb6feac57c42788e27f739dfa3c4f3baf7 https://github.com/illumos/illumos-gate/commit/d1672efb6feac57c42788e27f739dfa3c4f3baf7 https://www.illumos.org/issues/6280 The unshare_one() in libzfs could fail with EZFS_SHARENFSFAILED at line 834 here: 831 /* make sure libshare initialized */ 832 if ((err = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) { 833 free(mntpt); /* don't need the copy anymore */ 834 return (zfs_error_fmt(hdl, EZFS_SHARENFSFAILED, 835 dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), 836 name, _sa_errorstr(err))); 837 } The correct error should be EZFS_UNSHARENFSFAILED instead. Reviewed by: Toomas Soome Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Marcel Telka MFC after: 4 weeks Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Sep 13 10:17:14 2017 (r323523) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Sep 13 10:22:09 2017 (r323524) @@ -20,6 +20,7 @@ */ /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov @@ -872,7 +873,7 @@ unshare_one(libzfs_handle_t *hdl, const char *name, co /* make sure libshare initialized */ if ((err = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) { free(mntpt); /* don't need the copy anymore */ - return (zfs_error_fmt(hdl, EZFS_SHARENFSFAILED, + return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), name, _sa_errorstr(err))); } From owner-svn-src-all@freebsd.org Wed Sep 13 10:23:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D66FDE18CE1; Wed, 13 Sep 2017 10:23:56 +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 B358D812C8; Wed, 13 Sep 2017 10:23:56 +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 v8DANtD8055511; Wed, 13 Sep 2017 10:23:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DANts2055510; Wed, 13 Sep 2017 10:23:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131023.v8DANts2055510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:23:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323525 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 323525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:23:57 -0000 Author: avg Date: Wed Sep 13 10:23:55 2017 New Revision: 323525 URL: https://svnweb.freebsd.org/changeset/base/323525 Log: MFV r323523: 8331 zfs_unshare returns wrong error code for smb unshare failure illumos/illumos-gate@4f4378cc54b7deec3a35c529dc397dbdc325b4bb https://github.com/illumos/illumos-gate/commit/4f4378cc54b7deec3a35c529dc397dbdc325b4bb https://www.illumos.org/issues/8331 zfs_unshare returns EZFS_UNSHARENFSFAILED on error for all share types. Reviewed by: Marcel Telka Reviewed by: Toomas Soome Approved by: Dan McDonald Author: Andrew Stormont MFC after: 4 weeks Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Sep 13 10:22:09 2017 (r323524) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Sep 13 10:23:55 2017 (r323525) @@ -24,6 +24,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 RackTop Systems. */ /* @@ -88,7 +89,7 @@ zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, c zfs_share_proto_t); /* - * The share protocols table must be in the same order as the zfs_share_prot_t + * The share protocols table must be in the same order as the zfs_share_proto_t * enum in libzfs_impl.h */ typedef struct { @@ -873,7 +874,7 @@ unshare_one(libzfs_handle_t *hdl, const char *name, co /* make sure libshare initialized */ if ((err = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) { free(mntpt); /* don't need the copy anymore */ - return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, + return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), name, _sa_errorstr(err))); } @@ -884,12 +885,13 @@ unshare_one(libzfs_handle_t *hdl, const char *name, co if (share != NULL) { err = zfs_sa_disable_share(share, proto_table[proto].p_name); if (err != SA_OK) { - return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, + return (zfs_error_fmt(hdl, + proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), name, _sa_errorstr(err))); } } else { - return (zfs_error_fmt(hdl, EZFS_UNSHARENFSFAILED, + return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': not found"), name)); } From owner-svn-src-all@freebsd.org Wed Sep 13 10:25:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7200E18E61; Wed, 13 Sep 2017 10:25:45 +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 751E781453; Wed, 13 Sep 2017 10:25:45 +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 v8DAPi0E055620; Wed, 13 Sep 2017 10:25:44 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAPieT055617; Wed, 13 Sep 2017 10:25:44 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131025.v8DAPieT055617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323526 - in vendor-sys/illumos/dist/uts/common: fs fs/zfs sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common: fs fs/zfs sys X-SVN-Commit-Revision: 323526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:25:45 -0000 Author: avg Date: Wed Sep 13 10:25:44 2017 New Revision: 323526 URL: https://svnweb.freebsd.org/changeset/base/323526 Log: 8376 cached v_path should be kept fresh illumos/illumos-gate@e2fc3408efa6cdfc5e33c73c3567efc8c7592707 https://github.com/illumos/illumos-gate/commit/e2fc3408efa6cdfc5e33c73c3567efc8c7592707 https://www.illumos.org/issues/8376 The logic for generating and maintaining the cached v_path value on vnodes could stand to be improved. If vnodes were purely ephemeral, then freshly calculating v_path at the time of lookup() would result in correct values (at a performance cost). When they persist, either as referenced by other structures (such as open files, process cwd, dnlc entries, etc), the opportunity for the v_path to become stale arises. This is exacerbated by the current behavior that, when v_path is found to be invalid (during a vnodetopath operation) will strive to recalculate it, but not preserve the result. The overall situation leads to both performance and correctness (due to lack of results) problems relating to v_path. This has been addressed in SmartOS through a series of changes. Firstly, to do proper invalidation of v_path when it's found to be stale: - OS-3891 stale v_path slows vfs lookups OS-3891 revealed that some logic made assumptions about v_path never transitioning from non-NULL to NULL. It was addressed here: - OS-4317 v_path accesses can race While the pathological stale v_path behavior had been addressed, there are still cases where the absence of valid v_path information was causing problems. The largest patch in this series addressed it by performing v_path checking and updates during vnode lookups/updates, when it is most convenient: - OS-5167 cached v_path should be kept fresh Two smaller updates are included too, to prevent erroneous behavior introduced by the prior changes: - OS-5846 procfs should follow VFS rules - OS-6134 vn_reinit balks on zeroed vnodes Reviewed by: Jerry Jelinek Reviewed by: Robert Mustacchi Approved by: Gordon Ross Author: Patrick Mooney Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c vendor-sys/illumos/dist/uts/common/sys/vnode.h Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/vnode.c Wed Sep 13 10:23:55 2017 (r323525) +++ vendor-sys/illumos/dist/uts/common/fs/vnode.c Wed Sep 13 10:25:44 2017 (r323526) @@ -21,7 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2017, Joyent, Inc. * Copyright 2016 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. */ @@ -68,6 +68,8 @@ #include #include #include +#include +#include /* Determine if this vnode is a file that is read-only */ #define ISROFILE(vp) \ @@ -104,6 +106,9 @@ kmutex_t vskstat_tree_lock; /* Global variable which enables/disables the vopstats collection */ int vopstats_enabled = 1; +/* Global used for empty/invalid v_path */ +char *vn_vpath_empty = ""; + /* * forward declarations for internal vnode specific data (vsd) */ @@ -2286,7 +2291,8 @@ vn_cache_constructor(void *buf, void *cdrarg, int kmfl cv_init(&vp->v_cv, NULL, CV_DEFAULT, NULL); rw_init(&vp->v_nbllock, NULL, RW_DEFAULT, NULL); vp->v_femhead = NULL; /* Must be done before vn_reinit() */ - vp->v_path = NULL; + vp->v_path = vn_vpath_empty; + vp->v_path_stamp = 0; vp->v_mpssdata = NULL; vp->v_vsd = NULL; vp->v_fopdata = NULL; @@ -2333,6 +2339,7 @@ void vn_recycle(vnode_t *vp) { ASSERT(vp->v_pages == NULL); + VERIFY(vp->v_path != NULL); /* * XXX - This really belongs in vn_reinit(), but we have some issues @@ -2355,10 +2362,11 @@ vn_recycle(vnode_t *vp) kmem_free(vp->v_femhead, sizeof (*(vp->v_femhead))); vp->v_femhead = NULL; } - if (vp->v_path) { + if (vp->v_path != vn_vpath_empty) { kmem_free(vp->v_path, strlen(vp->v_path) + 1); - vp->v_path = NULL; + vp->v_path = vn_vpath_empty; } + vp->v_path_stamp = 0; if (vp->v_fopdata != NULL) { free_fopdata(vp); @@ -2396,6 +2404,15 @@ vn_reinit(vnode_t *vp) vp->v_locality = NULL; vp->v_xattrdir = NULL; + /* + * In a few specific instances, vn_reinit() is used to initialize + * locally defined vnode_t instances. Lacking the construction offered + * by vn_alloc(), these vnodes require v_path initialization. + */ + if (vp->v_path == NULL) { + vp->v_path = vn_vpath_empty; + } + /* Handles v_femhead, v_path, and the r/w/map counts */ vn_recycle(vp); } @@ -2429,9 +2446,10 @@ vn_free(vnode_t *vp) */ ASSERT((vp->v_count == 0) || (vp->v_count == 1)); ASSERT(vp->v_count_dnlc == 0); - if (vp->v_path != NULL) { + VERIFY(vp->v_path != NULL); + if (vp->v_path != vn_vpath_empty) { kmem_free(vp->v_path, strlen(vp->v_path) + 1); - vp->v_path = NULL; + vp->v_path = vn_vpath_empty; } /* If FEM was in use, make sure everything gets cleaned up */ @@ -2954,125 +2972,256 @@ fs_new_caller_id() } /* - * Given a starting vnode and a path, updates the path in the target vnode in - * a safe manner. If the vnode already has path information embedded, then the - * cached path is left untouched. + * The value stored in v_path is relative to rootdir, located in the global + * zone. Zones or chroot environments which reside deeper inside the VFS + * hierarchy will have a relative view of MAXPATHLEN since they are unaware of + * what lies below their perceived root. In order to keep v_path usable for + * these child environments, its allocations are allowed to exceed MAXPATHLEN. + * + * An upper bound of max_vnode_path is placed upon v_path allocations to + * prevent the system from going too wild at the behest of pathological + * behavior from the operator. */ - size_t max_vnode_path = 4 * MAXPATHLEN; + void -vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp, - const char *path, size_t plen) +vn_clearpath(vnode_t *vp, hrtime_t compare_stamp) { - char *rpath; - vnode_t *base; - size_t rpathlen, rpathalloc; - int doslash = 1; + char *buf; - if (*path == '/') { - base = rootvp; - path++; - plen--; - } else { - base = startvp; - } - + mutex_enter(&vp->v_lock); /* - * We cannot grab base->v_lock while we hold vp->v_lock because of - * the potential for deadlock. + * If the snapshot of v_path_stamp passed in via compare_stamp does not + * match the present value on the vnode, it indicates that subsequent + * changes have occurred. The v_path value is not cleared in this case + * since the new value may be valid. */ - mutex_enter(&base->v_lock); - if (base->v_path == NULL) { - mutex_exit(&base->v_lock); + if (compare_stamp != 0 && vp->v_path_stamp != compare_stamp) { + mutex_exit(&vp->v_lock); return; } + buf = vp->v_path; + vp->v_path = vn_vpath_empty; + vp->v_path_stamp = 0; + mutex_exit(&vp->v_lock); + if (buf != vn_vpath_empty) { + kmem_free(buf, strlen(buf) + 1); + } +} - rpathlen = strlen(base->v_path); - rpathalloc = rpathlen + plen + 1; - /* Avoid adding a slash if there's already one there */ - if (base->v_path[rpathlen-1] == '/') - doslash = 0; - else - rpathalloc++; +static void +vn_setpath_common(vnode_t *pvp, vnode_t *vp, const char *name, size_t len, + boolean_t is_rename) +{ + char *buf, *oldbuf; + hrtime_t pstamp; + size_t baselen, buflen = 0; - /* - * We don't want to call kmem_alloc(KM_SLEEP) with kernel locks held, - * so we must do this dance. If, by chance, something changes the path, - * just give up since there is no real harm. - */ - mutex_exit(&base->v_lock); + /* Handle the vn_setpath_str case. */ + if (pvp == NULL) { + if (len + 1 > max_vnode_path) { + DTRACE_PROBE4(vn__setpath__too__long, vnode_t *, pvp, + vnode_t *, vp, char *, name, size_t, len + 1); + return; + } + buf = kmem_alloc(len + 1, KM_SLEEP); + bcopy(name, buf, len); + buf[len] = '\0'; - /* Paths should stay within reason */ - if (rpathalloc > max_vnode_path) + mutex_enter(&vp->v_lock); + oldbuf = vp->v_path; + vp->v_path = buf; + vp->v_path_stamp = gethrtime(); + mutex_exit(&vp->v_lock); + if (oldbuf != vn_vpath_empty) { + kmem_free(oldbuf, strlen(oldbuf) + 1); + } return; + } - rpath = kmem_alloc(rpathalloc, KM_SLEEP); + /* Take snapshot of parent dir */ + mutex_enter(&pvp->v_lock); - mutex_enter(&base->v_lock); - if (base->v_path == NULL || strlen(base->v_path) != rpathlen) { - mutex_exit(&base->v_lock); - kmem_free(rpath, rpathalloc); + if ((pvp->v_flag & VTRAVERSE) != 0) { + /* + * When the parent vnode has VTRAVERSE set in its flags, normal + * assumptions about v_path calculation no longer apply. The + * primary situation where this occurs is via the VFS tricks + * which procfs plays in order to allow /proc/PID/(root|cwd) to + * yield meaningful results. + * + * When this flag is set, v_path on the child must not be + * updated since the calculated value is likely to be + * incorrect, given the current context. + */ + mutex_exit(&pvp->v_lock); return; } - bcopy(base->v_path, rpath, rpathlen); - mutex_exit(&base->v_lock); - if (doslash) - rpath[rpathlen++] = '/'; - bcopy(path, rpath + rpathlen, plen); - rpath[rpathlen + plen] = '\0'; +retrybuf: + if (pvp->v_path == vn_vpath_empty) { + /* + * Without v_path from the parent directory, generating a child + * path from the name is impossible. + */ + if (len > 0) { + pstamp = pvp->v_path_stamp; + mutex_exit(&pvp->v_lock); + vn_clearpath(vp, pstamp); + return; + } + /* + * The only feasible case here is where a NUL lookup is being + * performed on rootdir prior to its v_path being populated. + */ + ASSERT(pvp->v_path_stamp == 0); + baselen = 0; + pstamp = 0; + } else { + pstamp = pvp->v_path_stamp; + baselen = strlen(pvp->v_path); + /* ignore a trailing slash if present */ + if (pvp->v_path[baselen - 1] == '/') { + /* This should only the be case for rootdir */ + ASSERT(baselen == 1 && pvp == rootdir); + baselen--; + } + } + mutex_exit(&pvp->v_lock); + + if (buflen != 0) { + /* Free the existing (mis-sized) buffer in case of retry */ + kmem_free(buf, buflen); + } + /* base, '/', name and trailing NUL */ + buflen = baselen + len + 2; + if (buflen > max_vnode_path) { + DTRACE_PROBE4(vn__setpath_too__long, vnode_t *, pvp, + vnode_t *, vp, char *, name, size_t, buflen); + return; + } + buf = kmem_alloc(buflen, KM_SLEEP); + + mutex_enter(&pvp->v_lock); + if (pvp->v_path_stamp != pstamp) { + size_t vlen; + + /* + * Since v_path_stamp changed on the parent, it is likely that + * v_path has been altered as well. If the length does not + * exactly match what was previously measured, the buffer + * allocation must be repeated for proper sizing. + */ + if (pvp->v_path == vn_vpath_empty) { + /* Give up if parent lack v_path */ + mutex_exit(&pvp->v_lock); + kmem_free(buf, buflen); + return; + } + vlen = strlen(pvp->v_path); + if (pvp->v_path[vlen - 1] == '/') { + vlen--; + } + if (vlen != baselen) { + goto retrybuf; + } + } + bcopy(pvp->v_path, buf, baselen); + mutex_exit(&pvp->v_lock); + + buf[baselen] = '/'; + baselen++; + bcopy(name, &buf[baselen], len + 1); + mutex_enter(&vp->v_lock); - if (vp->v_path != NULL) { + if (vp->v_path_stamp == 0) { + /* never-visited vnode can inherit stamp from parent */ + ASSERT(vp->v_path == vn_vpath_empty); + vp->v_path_stamp = pstamp; + vp->v_path = buf; mutex_exit(&vp->v_lock); - kmem_free(rpath, rpathalloc); + } else if (vp->v_path_stamp < pstamp || is_rename) { + /* + * Install the updated path and stamp, ensuring that the v_path + * pointer is valid at all times for dtrace. + */ + oldbuf = vp->v_path; + vp->v_path = buf; + vp->v_path_stamp = gethrtime(); + mutex_exit(&vp->v_lock); + kmem_free(oldbuf, strlen(oldbuf) + 1); } else { - vp->v_path = rpath; + /* + * If the timestamp matches or is greater, it means another + * thread performed the update first while locks were dropped + * here to make the allocation. We defer to the newer value. + */ mutex_exit(&vp->v_lock); + kmem_free(buf, buflen); } + ASSERT(MUTEX_NOT_HELD(&vp->v_lock)); } -/* - * Sets the path to the vnode to be the given string, regardless of current - * context. The string must be a complete path from rootdir. This is only used - * by fsop_root() for setting the path based on the mountpoint. - */ void -vn_setpath_str(struct vnode *vp, const char *str, size_t len) +vn_updatepath(vnode_t *pvp, vnode_t *vp, const char *name) { - char *buf = kmem_alloc(len + 1, KM_SLEEP); + size_t len; - mutex_enter(&vp->v_lock); - if (vp->v_path != NULL) { - mutex_exit(&vp->v_lock); - kmem_free(buf, len + 1); + /* + * If the parent is older or empty, there's nothing further to do. + */ + if (pvp->v_path == vn_vpath_empty || + pvp->v_path_stamp <= vp->v_path_stamp) { return; } - vp->v_path = buf; - bcopy(str, vp->v_path, len); - vp->v_path[len] = '\0'; + /* + * Given the lack of appropriate context, meaningful updates to v_path + * cannot be made for during lookups for the '.' or '..' entries. + */ + len = strlen(name); + if (len == 0 || (len == 1 && name[0] == '.') || + (len == 2 && name[0] == '.' && name[1] == '.')) { + return; + } - mutex_exit(&vp->v_lock); + vn_setpath_common(pvp, vp, name, len, B_FALSE); } /* + * Given a starting vnode and a path, updates the path in the target vnode in + * a safe manner. If the vnode already has path information embedded, then the + * cached path is left untouched. + */ +/* ARGSUSED */ +void +vn_setpath(vnode_t *rootvp, vnode_t *pvp, vnode_t *vp, const char *name, + size_t len) +{ + vn_setpath_common(pvp, vp, name, len, B_FALSE); +} + +/* + * Sets the path to the vnode to be the given string, regardless of current + * context. The string must be a complete path from rootdir. This is only used + * by fsop_root() for setting the path based on the mountpoint. + */ +void +vn_setpath_str(vnode_t *vp, const char *str, size_t len) +{ + vn_setpath_common(NULL, vp, str, len, B_FALSE); +} + +/* * Called from within filesystem's vop_rename() to handle renames once the * target vnode is available. */ void -vn_renamepath(vnode_t *dvp, vnode_t *vp, const char *nm, size_t len) +vn_renamepath(vnode_t *pvp, vnode_t *vp, const char *name, size_t len) { - char *tmp; - - mutex_enter(&vp->v_lock); - tmp = vp->v_path; - vp->v_path = NULL; - mutex_exit(&vp->v_lock); - vn_setpath(rootdir, dvp, vp, nm, len); - if (tmp != NULL) - kmem_free(tmp, strlen(tmp) + 1); + vn_setpath_common(pvp, vp, name, len, B_TRUE); } /* @@ -3083,37 +3232,42 @@ void vn_copypath(struct vnode *src, struct vnode *dst) { char *buf; - int alloc; + hrtime_t stamp; + size_t buflen; mutex_enter(&src->v_lock); - if (src->v_path == NULL) { + if (src->v_path == vn_vpath_empty) { mutex_exit(&src->v_lock); return; } - alloc = strlen(src->v_path) + 1; - - /* avoid kmem_alloc() with lock held */ + buflen = strlen(src->v_path) + 1; mutex_exit(&src->v_lock); - buf = kmem_alloc(alloc, KM_SLEEP); + + buf = kmem_alloc(buflen, KM_SLEEP); + mutex_enter(&src->v_lock); - if (src->v_path == NULL || strlen(src->v_path) + 1 != alloc) { + if (src->v_path == vn_vpath_empty || + strlen(src->v_path) + 1 != buflen) { mutex_exit(&src->v_lock); - kmem_free(buf, alloc); + kmem_free(buf, buflen); return; } - bcopy(src->v_path, buf, alloc); + bcopy(src->v_path, buf, buflen); + stamp = src->v_path_stamp; mutex_exit(&src->v_lock); mutex_enter(&dst->v_lock); - if (dst->v_path != NULL) { + if (dst->v_path != vn_vpath_empty) { mutex_exit(&dst->v_lock); - kmem_free(buf, alloc); + kmem_free(buf, buflen); return; } dst->v_path = buf; + dst->v_path_stamp = stamp; mutex_exit(&dst->v_lock); } + /* * XXX Private interface for segvn routines that handle vnode * large page segments. @@ -3453,9 +3607,7 @@ fop_lookup( } if (ret == 0 && *vpp) { VOPSTATS_UPDATE(*vpp, lookup); - if ((*vpp)->v_path == NULL) { - vn_setpath(rootdir, dvp, *vpp, nm, strlen(nm)); - } + vn_updatepath(dvp, *vpp, nm); } return (ret); @@ -3495,9 +3647,7 @@ fop_create( (dvp, name, vap, excl, mode, vpp, cr, flags, ct, vsecp); if (ret == 0 && *vpp) { VOPSTATS_UPDATE(*vpp, create); - if ((*vpp)->v_path == NULL) { - vn_setpath(rootdir, dvp, *vpp, name, strlen(name)); - } + vn_updatepath(dvp, *vpp, name); } return (ret); @@ -3617,10 +3767,7 @@ fop_mkdir( (dvp, dirname, vap, vpp, cr, ct, flags, vsecp); if (ret == 0 && *vpp) { VOPSTATS_UPDATE(*vpp, mkdir); - if ((*vpp)->v_path == NULL) { - vn_setpath(rootdir, dvp, *vpp, dirname, - strlen(dirname)); - } + vn_updatepath(dvp, *vpp, dirname); } return (ret); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c Wed Sep 13 10:23:55 2017 (r323525) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c Wed Sep 13 10:25:44 2017 (r323526) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. + * Copyright (c) 2015, Joyent, Inc. */ #include @@ -893,9 +894,9 @@ zfs_link_destroy(zfs_dirlock_t *dl, znode_t *zp, dmu_t if (zp->z_links <= zp_is_dir) { zfs_panic_recover("zfs: link count on %s is %u, " "should be at least %u", - zp->z_vnode->v_path ? zp->z_vnode->v_path : - "", (int)zp->z_links, - zp_is_dir + 1); + zp->z_vnode->v_path != vn_vpath_empty ? + zp->z_vnode->v_path : "", + (int)zp->z_links, zp_is_dir + 1); zp->z_links = zp_is_dir + 1; } if (--zp->z_links == zp_is_dir) { Modified: vendor-sys/illumos/dist/uts/common/sys/vnode.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/vnode.h Wed Sep 13 10:23:55 2017 (r323525) +++ vendor-sys/illumos/dist/uts/common/sys/vnode.h Wed Sep 13 10:25:44 2017 (r323526) @@ -21,7 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2017, Joyent, Inc. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. */ @@ -223,6 +223,59 @@ struct vsd_node { * In particular, file systems should not access other fields; they may * change or even be removed. The functionality which was once provided * by these fields is available through vn_* functions. + * + * VNODE PATH THEORY: + * In each vnode, the v_path field holds a cached version of the canonical + * filesystem path which that node represents. Because vnodes lack contextual + * information about their own name or position in the VFS hierarchy, this path + * must be calculated when the vnode is instantiated by operations such as + * fop_create, fop_lookup, or fop_mkdir. During said operations, both the + * parent vnode (and its cached v_path) and future name are known, so the + * v_path of the resulting object can easily be set. + * + * The caching nature of v_path is complicated in the face of directory + * renames. Filesystem drivers are responsible for calling vn_renamepath when + * a fop_rename operation succeeds. While the v_path on the renamed vnode will + * be updated, existing children of the directory (direct, or at deeper levels) + * will now possess v_path caches which are stale. + * + * It is expensive (and for non-directories, impossible) to recalculate stale + * v_path entries during operations such as vnodetopath. The best time during + * which to correct such wrongs is the same as when v_path is first + * initialized: during fop_create/fop_lookup/fop_mkdir/etc, where adequate + * context is available to generate the current path. + * + * In order to quickly detect stale v_path entries (without full lookup + * verification) to trigger a v_path update, the v_path_stamp field has been + * added to vnode_t. As part of successful fop_create/fop_lookup/fop_mkdir + * operations, where the name and parent vnode are available, the following + * rules are used to determine updates to the child: + * + * 1. If the parent lacks a v_path, clear any existing v_path and v_path_stamp + * on the child. Until the parent v_path is refreshed to a valid state, the + * child v_path must be considered invalid too. + * + * 2. If the child lacks a v_path (implying v_path_stamp == 0), it inherits the + * v_path_stamp value from its parent and its v_path is updated. + * + * 3. If the child v_path_stamp is less than v_path_stamp in the parent, it is + * an indication that the child v_path is stale. The v_path is updated and + * v_path_stamp in the child is set to the current hrtime(). + * + * It does _not_ inherit the parent v_path_stamp in order to propagate the + * the time of v_path invalidation through the directory structure. This + * prevents concurrent invalidations (operating with a now-incorrect v_path) + * at deeper levels in the tree from persisting. + * + * 4. If the child v_path_stamp is greater or equal to the parent, no action + * needs to be taken. + * + * Note that fop_rename operations do not follow this ruleset. They perform an + * explicit update of v_path and v_path_stamp (setting it to the current time) + * + * With these constraints in place, v_path invalidations and updates should + * proceed in a timely manner as vnodes are accessed. While there still are + * limited cases where vnodetopath operations will fail, the risk is minimized. */ struct fem_head; /* from fem.h */ @@ -249,6 +302,7 @@ typedef struct vnode { void *v_locality; /* hook for locality info */ struct fem_head *v_femhead; /* fs monitoring */ char *v_path; /* cached path */ + hrtime_t v_path_stamp; /* timestamp for cached path */ uint_t v_rdcnt; /* open for read count (VREG only) */ uint_t v_wrcnt; /* open for write count (VREG only) */ u_longlong_t v_mmap_read; /* mmap read count */ @@ -350,6 +404,14 @@ typedef struct vn_vfslocks_entry { #define V_SYSATTR 0x40000 /* vnode is a GFS system attribute */ /* + * Indication that VOP_LOOKUP operations on this vnode may yield results from a + * different VFS instance. The main use of this is to suppress v_path + * calculation logic when filesystems such as procfs emit results which defy + * expectations about normal VFS behavior. + */ +#define VTRAVERSE 0x80000 + +/* * Vnode attributes. A bit-mask is supplied as part of the * structure to indicate the attributes the caller wants to * set (setattr) or extract (getattr). @@ -1293,6 +1355,11 @@ void vn_setpath(vnode_t *rootvp, struct vnode *startvp const char *path, size_t plen); void vn_renamepath(vnode_t *dvp, vnode_t *vp, const char *nm, size_t len); +/* Private vnode manipulation functions */ +void vn_clearpath(vnode_t *, hrtime_t); +void vn_updatepath(vnode_t *, vnode_t *, const char *); + + /* Vnode event notification */ void vnevent_rename_src(vnode_t *, vnode_t *, char *, caller_context_t *); void vnevent_rename_dest(vnode_t *, vnode_t *, char *, caller_context_t *); @@ -1338,6 +1405,9 @@ void reparse_point_init(void); u_longlong_t fs_new_caller_id(); int vn_vmpss_usepageio(vnode_t *); + +/* Empty v_path placeholder */ +extern char *vn_vpath_empty; /* * Needed for use of IS_VMODSORT() in kernel. From owner-svn-src-all@freebsd.org Wed Sep 13 10:33:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 242D5E19382; Wed, 13 Sep 2017 10:33:11 +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 E1C0081902; Wed, 13 Sep 2017 10:33: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 v8DAX9bd059753; Wed, 13 Sep 2017 10:33:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAX9vp059752; Wed, 13 Sep 2017 10:33:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131033.v8DAX9vp059752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323527 - vendor/illumos/dist/lib/libzpool/common X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzpool/common X-SVN-Commit-Revision: 323527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:33:11 -0000 Author: avg Date: Wed Sep 13 10:33:09 2017 New Revision: 323527 URL: https://svnweb.freebsd.org/changeset/base/323527 Log: 5815 libzpool's panic function doesn't set global panicstr, ::status not as useful illumos/illumos-gate@fae6347731c9d3f46b26338313b0422927f29cf6 https://github.com/illumos/illumos-gate/commit/fae6347731c9d3f46b26338313b0422927f29cf6 https://www.illumos.org/issues/5815 When panic() is called from within ztest, the mdb ::status command isn't as useful as it could be since the global panicstr variable isn't updated. We should modify the function to make sure panicstr is set, so ::status can present the error message just like it does on a failed assertion. Reviewed by: Matthew Ahrens Reviewed by: Sebastien Roy Reviewed by: Gordon Ross Reviewed by: Rich Lowe Approved by: Dan McDonald Author: Prakash Surya Modified: vendor/illumos/dist/lib/libzpool/common/kernel.c Modified: vendor/illumos/dist/lib/libzpool/common/kernel.c ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/kernel.c Wed Sep 13 10:25:44 2017 (r323526) +++ vendor/illumos/dist/lib/libzpool/common/kernel.c Wed Sep 13 10:33:09 2017 (r323527) @@ -699,11 +699,9 @@ static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n" void vpanic(const char *fmt, va_list adx) { - (void) fprintf(stderr, "error: "); - (void) vfprintf(stderr, fmt, adx); - (void) fprintf(stderr, "\n"); - - abort(); /* think of it as a "user-level crash dump" */ + char buf[512]; + (void) vsnprintf(buf, 512, fmt, adx); + assfail(buf, NULL, 0); } void From owner-svn-src-all@freebsd.org Wed Sep 13 10:34:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38CFCE19447; Wed, 13 Sep 2017 10:34:33 +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 0217681A4A; Wed, 13 Sep 2017 10:34:32 +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 v8DAYWBw059845; Wed, 13 Sep 2017 10:34:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAYWLg059844; Wed, 13 Sep 2017 10:34:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131034.v8DAYWLg059844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323528 - head/cddl/contrib/opensolaris/lib/libzpool/common X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzpool/common X-SVN-Commit-Revision: 323528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:34:33 -0000 Author: avg Date: Wed Sep 13 10:34:31 2017 New Revision: 323528 URL: https://svnweb.freebsd.org/changeset/base/323528 Log: MFV r323527: 5815 libzpool's panic function doesn't set global panicstr, ::status not as useful illumos/illumos-gate@fae6347731c9d3f46b26338313b0422927f29cf6 https://github.com/illumos/illumos-gate/commit/fae6347731c9d3f46b26338313b0422927f29cf6 https://www.illumos.org/issues/5815 When panic() is called from within ztest, the mdb ::status command isn't as useful as it could be since the global panicstr variable isn't updated. We should modify the function to make sure panicstr is set, so ::status can present the error message just like it does on a failed assertion. Reviewed by: Matthew Ahrens Reviewed by: Sebastien Roy Reviewed by: Gordon Ross Reviewed by: Rich Lowe Approved by: Dan McDonald Author: Prakash Surya MFC after: 4 weeks Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Sep 13 10:33:09 2017 (r323527) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Sep 13 10:34:31 2017 (r323528) @@ -735,11 +735,9 @@ static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n" void vpanic(const char *fmt, va_list adx) { - (void) fprintf(stderr, "error: "); - (void) vfprintf(stderr, fmt, adx); - (void) fprintf(stderr, "\n"); - - abort(); /* think of it as a "user-level crash dump" */ + char buf[512]; + (void) vsnprintf(buf, 512, fmt, adx); + assfail(buf, NULL, 0); } void From owner-svn-src-all@freebsd.org Wed Sep 13 10:41:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55DC2E19A35; Wed, 13 Sep 2017 10:41:49 +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 2509381F30; Wed, 13 Sep 2017 10:41:49 +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 v8DAfmSF061532; Wed, 13 Sep 2017 10:41:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAfmPx061531; Wed, 13 Sep 2017 10:41:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131041.v8DAfmPx061531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323529 - vendor-sys/illumos/dist/uts/common X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common X-SVN-Commit-Revision: 323529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:41:49 -0000 Author: avg Date: Wed Sep 13 10:41:47 2017 New Revision: 323529 URL: https://svnweb.freebsd.org/changeset/base/323529 Log: 5115 Want Intel 40GbE NIC driver for illumos illumos/illumos-gate@9d26e4fc021e249c93c2861629cc665e4f5bd4d6 https://github.com/illumos/illumos-gate/commit/9d26e4fc021e249c93c2861629cc665e4f5bd4d6 https://www.illumos.org/issues/5115 Intel's NICs based on the XL710 chipset exist 1 . There exist drivers for Linux and FreeBSD 2 . It does not appear to be derived from the ixgbe driver source, so it would probably require porting the i40e source from FBSD to Illumos, unless a driver exists for a GLDv3-like platform under CDDL or similar license (none are known to currently be available or being worked on). Reviewed by: Dan McDonald Reviewed by: Hans Rosenfeld Approved by: Richard Lowe Author: Robert Mustacchi Note: this change has nothing to do with FreeBSD. Modified: vendor-sys/illumos/dist/uts/common/Makefile.files Modified: vendor-sys/illumos/dist/uts/common/Makefile.files ============================================================================== --- vendor-sys/illumos/dist/uts/common/Makefile.files Wed Sep 13 10:34:31 2017 (r323528) +++ vendor-sys/illumos/dist/uts/common/Makefile.files Wed Sep 13 10:41:47 2017 (r323529) @@ -21,11 +21,11 @@ # # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved. -# Copyright (c) 2012 Joyent, Inc. All rights reserved. # Copyright (c) 2011, 2014 by Delphix. All rights reserved. # Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -# Copyright 2014 Nexenta Systems, Inc. All rights reserved. +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# Copyright 2016 Garrett D'Amore +# Copyright 2016 Joyent, Inc. # # @@ -1951,6 +1951,17 @@ IXGBE_OBJS = ixgbe_82598.o ixgbe_82599.o ixgbe_api. ixgbe_log.o ixgbe_main.o \ ixgbe_osdep.o ixgbe_rx.o ixgbe_stat.o \ ixgbe_tx.o ixgbe_x540.o ixgbe_mbx.o + +# +# Intel 40GbE PCIe NIC driver module +# + +# illumos-written ones. +I40E_OBJS = i40e_main.o i40e_osdep.o i40e_intr.o i40e_transceiver.o \ + i40e_stats.o i40e_gld.o +# Intel-written ones. +I40E_INTC_OBJS = i40e_adminq.o i40e_common.o i40e_hmc.o i40e_lan_hmc.o \ + i40e_nvm.o # # NIU 10G/1G driver module From owner-svn-src-all@freebsd.org Wed Sep 13 10:45:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8C15E19CAD; Wed, 13 Sep 2017 10:45:50 +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 825FC821A6; Wed, 13 Sep 2017 10:45:50 +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 v8DAjn3l063850; Wed, 13 Sep 2017 10:45:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAjntu063845; Wed, 13 Sep 2017 10:45:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131045.v8DAjntu063845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323530 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/lua vendor-sys/illumo... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/lua vendor-sys/illumos/dist/uts/common/fs/zfs/... X-SVN-Commit-Revision: 323530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:45:50 -0000 Author: avg Date: Wed Sep 13 10:45:49 2017 New Revision: 323530 URL: https://svnweb.freebsd.org/changeset/base/323530 Log: 7431 ZFS Channel Programs illumos/illumos-gate@dfc115332c94a2f62058ac7f2bce7631fbd20b3d https://github.com/illumos/illumos-gate/commit/dfc115332c94a2f62058ac7f2bce7631fbd20b3d https://www.illumos.org/issues/7431 ZFS channel programs (ZCP) adds support for performing compound ZFS administrative actions via Lua scripts in a sandboxed environment (with time and memory limits). This initial commit includes both base support for running ZCP scripts, and a small initial library of API calls which support getting properties and listing, destroying, and promoting datasets. Testing: in addition to the included unit tests, channel programs have been in use at Delphix for several months for batch destroying filesystems. The dsl_destroy_snaps_nvl() call has also been replaced with For reference, the new zfs-program manpage is included below. ZFS-PROGRAM(1M) 1M ZFS-PROGRAM(1M) NAME zfs program – executes ZFS channel programs SYNOPSIS zfs program [-t timeout] [-m memory-limit] pool script DESCRIPTION The ZFS channel program interface allows ZFS administrative operations to be run programmatically as a Lua script. The entire script is executed atomically, with no other administrative operations taking effect concurrently. A library of ZFS calls is made available to channel program scripts. Channel programs may only be run with root privileges. A modified version of the Lua 5.2 interpreter is used to run channel program scripts. The Lua 5.2 manual can be found at: http://www.lua.org/manual/5.2/ ... Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Dan Kimmel Approved by: Garrett D'Amore Author: Chris Williamson Added: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/README.zfs vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lapi.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lapi.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lauxlib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lauxlib.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lbaselib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lbitlib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcode.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcode.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcompat.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcorolib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lctype.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lctype.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldebug.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldebug.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldo.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldo.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldump.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lfunc.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lfunc.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llimits.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lmem.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lmem.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lobject.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lobject.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lopcodes.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lopcodes.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lparser.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lparser.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstate.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstate.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstring.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstring.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltablib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltm.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltm.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lua.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/luaconf.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lualib.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lundump.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lundump.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lvm.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lvm.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lzio.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lzio.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp_global.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp_iter.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp_prop.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_iter.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c (contents, props changed) Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_destroy.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_vfsops.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Added: vendor/illumos/dist/man/man1m/zfs-program.1m Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_prop.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor-sys/illumos/dist/common/zfs/zfs_prop.c Wed Sep 13 10:45:49 2017 (r323530) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -381,7 +381,8 @@ zfs_prop_init(void) zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY, ZFS_TYPE_DATASET, "", "WRITTEN"); zprop_register_number(ZFS_PROP_LOGICALUSED, "logicalused", 0, - PROP_READONLY, ZFS_TYPE_DATASET, "", "LUSED"); + PROP_READONLY, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "", + "LUSED"); zprop_register_number(ZFS_PROP_LOGICALREFERENCED, "logicalreferenced", 0, PROP_READONLY, ZFS_TYPE_DATASET, "", "LREFER"); @@ -582,6 +583,15 @@ zfs_prop_readonly(zfs_prop_t prop) { return (zfs_prop_table[prop].pd_attr == PROP_READONLY || zfs_prop_table[prop].pd_attr == PROP_ONETIME); +} + +/* + * Returns TRUE if the property is visible (not hidden). + */ +boolean_t +zfs_prop_visible(zfs_prop_t prop) +{ + return (zfs_prop_table[prop].pd_visible); } /* Modified: vendor-sys/illumos/dist/uts/common/Makefile.files ============================================================================== --- vendor-sys/illumos/dist/uts/common/Makefile.files Wed Sep 13 10:41:47 2017 (r323529) +++ vendor-sys/illumos/dist/uts/common/Makefile.files Wed Sep 13 10:45:49 2017 (r323530) @@ -1308,6 +1308,35 @@ SMBFS_OBJS += smbfs_vfsops.o smbfs_vnops.o smbfs_node. $(SMBFS_COMMON_OBJS) +LUA_OBJS += \ + ldo.o \ + lvm.o \ + lbitlib.o \ + lopcodes.o \ + lstring.o \ + ltable.o \ + ltm.o \ + lcorolib.o \ + lauxlib.o \ + ldebug.o \ + lstate.o \ + lgc.o \ + lmem.o \ + lctype.o \ + lfunc.o \ + ldump.o \ + lundump.o \ + lstrlib.o \ + ltablib.o \ + lapi.o \ + lobject.o \ + lbaselib.o \ + lcompat.o \ + lzio.o \ + lcode.o \ + llex.o \ + lparser.o + ZFS_COMMON_OBJS += \ abd.o \ arc.o \ @@ -1375,6 +1404,11 @@ ZFS_COMMON_OBJS += \ zap.o \ zap_leaf.o \ zap_micro.o \ + zcp.o \ + zcp_get.o \ + zcp_global.o \ + zcp_iter.o \ + zcp_synctask.o \ zfs_byteswap.o \ zfs_debug.o \ zfs_fm.o \ @@ -1958,7 +1992,7 @@ IXGBE_OBJS = ixgbe_82598.o ixgbe_82599.o ixgbe_api. # illumos-written ones. I40E_OBJS = i40e_main.o i40e_osdep.o i40e_intr.o i40e_transceiver.o \ - i40e_stats.o i40e_gld.o + i40e_stats.o i40e_gld.o # Intel-written ones. I40E_INTC_OBJS = i40e_adminq.o i40e_common.o i40e_hmc.o i40e_lan_hmc.o \ i40e_nvm.o Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Sep 13 10:45:49 2017 (r323530) @@ -1616,7 +1616,6 @@ dsl_dataset_snapshot_tmp(const char *fsname, const cha return (error); } - void dsl_dataset_sync(dsl_dataset_t *ds, zio_t *zio, dmu_tx_t *tx) { @@ -1684,30 +1683,17 @@ dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx) dmu_buf_rele(ds->ds_dbuf, ds); } -static void -get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) +int +get_clones_stat_impl(dsl_dataset_t *ds, nvlist_t *val) { uint64_t count = 0; objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; zap_cursor_t zc; zap_attribute_t za; - nvlist_t *propval = fnvlist_alloc(); - nvlist_t *val; ASSERT(dsl_pool_config_held(ds->ds_dir->dd_pool)); /* - * We use nvlist_alloc() instead of fnvlist_alloc() because the - * latter would allocate the list with NV_UNIQUE_NAME flag. - * As a result, every time a clone name is appended to the list - * it would be (linearly) searched for for a duplicate name. - * We already know that all clone names must be unique and we - * want avoid the quadratic complexity of double-checking that - * because we can have a large number of clones. - */ - VERIFY0(nvlist_alloc(&val, 0, KM_SLEEP)); - - /* * There may be missing entries in ds_next_clones_obj * due to a bug in a previous version of the code. * Only trust it if it has the right number of entries. @@ -1716,8 +1702,9 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) VERIFY0(zap_count(mos, dsl_dataset_phys(ds)->ds_next_clones_obj, &count)); } - if (count != dsl_dataset_phys(ds)->ds_num_children - 1) - goto fail; + if (count != dsl_dataset_phys(ds)->ds_num_children - 1) { + return (ENOENT); + } for (zap_cursor_init(&zc, mos, dsl_dataset_phys(ds)->ds_next_clones_obj); zap_cursor_retrieve(&zc, &za) == 0; @@ -1731,16 +1718,43 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) dsl_dataset_rele(clone, FTAG); } zap_cursor_fini(&zc); - fnvlist_add_nvlist(propval, ZPROP_VALUE, val); - fnvlist_add_nvlist(nv, zfs_prop_to_name(ZFS_PROP_CLONES), propval); -fail: - nvlist_free(val); - nvlist_free(propval); + return (0); } -static void -get_receive_resume_stats(dsl_dataset_t *ds, nvlist_t *nv) +void +get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) { + nvlist_t *propval = fnvlist_alloc(); + nvlist_t *val; + + /* + * We use nvlist_alloc() instead of fnvlist_alloc() because the + * latter would allocate the list with NV_UNIQUE_NAME flag. + * As a result, every time a clone name is appended to the list + * it would be (linearly) searched for for a duplicate name. + * We already know that all clone names must be unique and we + * want avoid the quadratic complexity of double-checking that + * because we can have a large number of clones. + */ + VERIFY0(nvlist_alloc(&val, 0, KM_SLEEP)); + + if (get_clones_stat_impl(ds, val) == 0) { + fnvlist_add_nvlist(propval, ZPROP_VALUE, val); + fnvlist_add_nvlist(nv, zfs_prop_to_name(ZFS_PROP_CLONES), + propval); + } else { + nvlist_free(val); + nvlist_free(propval); + } +} + +/* + * Returns a string that represents the receive resume stats token. It should + * be freed with strfree(). + */ +char * +get_receive_resume_stats_impl(dsl_dataset_t *ds) +{ dsl_pool_t *dp = ds->ds_dir->dd_pool; if (dsl_dataset_has_resume_receive_state(ds)) { @@ -1807,84 +1821,359 @@ get_receive_resume_stats(dsl_dataset_t *ds, nvlist_t * ZFS_SEND_RESUME_TOKEN_VERSION, (longlong_t)cksum.zc_word[0], (longlong_t)packed_size, str); - dsl_prop_nvlist_add_string(nv, - ZFS_PROP_RECEIVE_RESUME_TOKEN, propval); kmem_free(packed, packed_size); kmem_free(str, compressed_size * 2 + 1); kmem_free(compressed, packed_size); - strfree(propval); + return (propval); } + return (strdup("")); } +/* + * Returns a string that represents the receive resume stats token of the + * dataset's child. It should be freed with strfree(). + */ +char * +get_child_receive_stats(dsl_dataset_t *ds) +{ + char recvname[ZFS_MAX_DATASET_NAME_LEN + 6]; + dsl_dataset_t *recv_ds; + dsl_dataset_name(ds, recvname); + if (strlcat(recvname, "/", sizeof (recvname)) < + sizeof (recvname) && + strlcat(recvname, recv_clone_name, sizeof (recvname)) < + sizeof (recvname) && + dsl_dataset_hold(ds->ds_dir->dd_pool, recvname, FTAG, + &recv_ds) == 0) { + char *propval = get_receive_resume_stats_impl(recv_ds); + dsl_dataset_rele(recv_ds, FTAG); + return (propval); + } + return (strdup("")); +} + +static void +get_receive_resume_stats(dsl_dataset_t *ds, nvlist_t *nv) +{ + char *propval = get_receive_resume_stats_impl(ds); + if (strcmp(propval, "") != 0) { + dsl_prop_nvlist_add_string(nv, + ZFS_PROP_RECEIVE_RESUME_TOKEN, propval); + } else { + char *childval = get_child_receive_stats(ds); + if (strcmp(childval, "") != 0) { + dsl_prop_nvlist_add_string(nv, + ZFS_PROP_RECEIVE_RESUME_TOKEN, childval); + } + strfree(childval); + } + strfree(propval); +} + +uint64_t +dsl_get_refratio(dsl_dataset_t *ds) +{ + uint64_t ratio = dsl_dataset_phys(ds)->ds_compressed_bytes == 0 ? 100 : + (dsl_dataset_phys(ds)->ds_uncompressed_bytes * 100 / + dsl_dataset_phys(ds)->ds_compressed_bytes); + return (ratio); +} + +uint64_t +dsl_get_logicalreferenced(dsl_dataset_t *ds) +{ + return (dsl_dataset_phys(ds)->ds_uncompressed_bytes); +} + +uint64_t +dsl_get_compressratio(dsl_dataset_t *ds) +{ + if (ds->ds_is_snapshot) { + return (dsl_get_refratio(ds)); + } else { + dsl_dir_t *dd = ds->ds_dir; + mutex_enter(&dd->dd_lock); + uint64_t val = dsl_dir_get_compressratio(dd); + mutex_exit(&dd->dd_lock); + return (val); + } +} + +uint64_t +dsl_get_used(dsl_dataset_t *ds) +{ + if (ds->ds_is_snapshot) { + return (dsl_dataset_phys(ds)->ds_unique_bytes); + } else { + dsl_dir_t *dd = ds->ds_dir; + mutex_enter(&dd->dd_lock); + uint64_t val = dsl_dir_get_used(dd); + mutex_exit(&dd->dd_lock); + return (val); + } +} + +uint64_t +dsl_get_creation(dsl_dataset_t *ds) +{ + return (dsl_dataset_phys(ds)->ds_creation_time); +} + +uint64_t +dsl_get_creationtxg(dsl_dataset_t *ds) +{ + return (dsl_dataset_phys(ds)->ds_creation_txg); +} + +uint64_t +dsl_get_refquota(dsl_dataset_t *ds) +{ + return (ds->ds_quota); +} + +uint64_t +dsl_get_refreservation(dsl_dataset_t *ds) +{ + return (ds->ds_reserved); +} + +uint64_t +dsl_get_guid(dsl_dataset_t *ds) +{ + return (dsl_dataset_phys(ds)->ds_guid); +} + +uint64_t +dsl_get_unique(dsl_dataset_t *ds) +{ + return (dsl_dataset_phys(ds)->ds_unique_bytes); +} + +uint64_t +dsl_get_objsetid(dsl_dataset_t *ds) +{ + return (ds->ds_object); +} + +uint64_t +dsl_get_userrefs(dsl_dataset_t *ds) +{ + return (ds->ds_userrefs); +} + +uint64_t +dsl_get_defer_destroy(dsl_dataset_t *ds) +{ + return (DS_IS_DEFER_DESTROY(ds) ? 1 : 0); +} + +uint64_t +dsl_get_referenced(dsl_dataset_t *ds) +{ + return (dsl_dataset_phys(ds)->ds_referenced_bytes); +} + +uint64_t +dsl_get_numclones(dsl_dataset_t *ds) +{ + ASSERT(ds->ds_is_snapshot); + return (dsl_dataset_phys(ds)->ds_num_children - 1); +} + +uint64_t +dsl_get_inconsistent(dsl_dataset_t *ds) +{ + return ((dsl_dataset_phys(ds)->ds_flags & DS_FLAG_INCONSISTENT) ? + 1 : 0); +} + +uint64_t +dsl_get_available(dsl_dataset_t *ds) +{ + uint64_t refdbytes = dsl_get_referenced(ds); + uint64_t availbytes = dsl_dir_space_available(ds->ds_dir, + NULL, 0, TRUE); + if (ds->ds_reserved > dsl_dataset_phys(ds)->ds_unique_bytes) { + availbytes += + ds->ds_reserved - dsl_dataset_phys(ds)->ds_unique_bytes; + } + if (ds->ds_quota != 0) { + /* + * Adjust available bytes according to refquota + */ + if (refdbytes < ds->ds_quota) { + availbytes = MIN(availbytes, + ds->ds_quota - refdbytes); + } else { + availbytes = 0; + } + } + return (availbytes); +} + +int +dsl_get_written(dsl_dataset_t *ds, uint64_t *written) +{ + dsl_pool_t *dp = ds->ds_dir->dd_pool; + dsl_dataset_t *prev; + int err = dsl_dataset_hold_obj(dp, + dsl_dataset_phys(ds)->ds_prev_snap_obj, FTAG, &prev); + if (err == 0) { + uint64_t comp, uncomp; + err = dsl_dataset_space_written(prev, ds, written, + &comp, &uncomp); + dsl_dataset_rele(prev, FTAG); + } + return (err); +} + +/* + * 'snap' should be a buffer of size ZFS_MAX_DATASET_NAME_LEN. + */ +int +dsl_get_prev_snap(dsl_dataset_t *ds, char *snap) +{ + dsl_pool_t *dp = ds->ds_dir->dd_pool; + if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) { + dsl_dataset_name(ds->ds_prev, snap); + return (0); + } else { + return (ENOENT); + } +} + +/* + * Returns the mountpoint property and source for the given dataset in the value + * and source buffers. The value buffer must be at least as large as MAXPATHLEN + * and the source buffer as least as large a ZFS_MAX_DATASET_NAME_LEN. + * Returns 0 on success and an error on failure. + */ +int +dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsname, char *value, + char *source) +{ + int error; + dsl_pool_t *dp = ds->ds_dir->dd_pool; + + /* Retrieve the mountpoint value stored in the zap opbject */ + error = dsl_prop_get_ds(ds, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), 1, + ZAP_MAXVALUELEN, value, source); + if (error != 0) { + return (error); + } + + /* Process the dsname and source to find the full mountpoint string */ + if (value[0] == '/') { + char *buf = kmem_alloc(ZAP_MAXVALUELEN, KM_SLEEP); + char *root = buf; + const char *relpath; + + /* + * If we inherit the mountpoint, even from a dataset + * with a received value, the source will be the path of + * the dataset we inherit from. If source is + * ZPROP_SOURCE_VAL_RECVD, the received value is not + * inherited. + */ + if (strcmp(source, ZPROP_SOURCE_VAL_RECVD) == 0) { + relpath = ""; + } else { + ASSERT0(strncmp(dsname, source, strlen(source))); + relpath = dsname + strlen(source); + if (relpath[0] == '/') + relpath++; + } + + spa_altroot(dp->dp_spa, root, ZAP_MAXVALUELEN); + + /* + * Special case an alternate root of '/'. This will + * avoid having multiple leading slashes in the + * mountpoint path. + */ + if (strcmp(root, "/") == 0) + root++; + + /* + * If the mountpoint is '/' then skip over this + * if we are obtaining either an alternate root or + * an inherited mountpoint. + */ + char *mnt = value; + if (value[1] == '\0' && (root[0] != '\0' || + relpath[0] != '\0')) + mnt = value + 1; + + if (relpath[0] == '\0') { + (void) snprintf(value, ZAP_MAXVALUELEN, "%s%s", + root, mnt); + } else { + (void) snprintf(value, ZAP_MAXVALUELEN, "%s%s%s%s", + root, mnt, relpath[0] == '@' ? "" : "/", + relpath); + } + kmem_free(buf, ZAP_MAXVALUELEN); + } else { + /* 'legacy' or 'none' */ + (void) snprintf(value, ZAP_MAXVALUELEN, "%s", value); + } + return (0); +} + void dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv) { dsl_pool_t *dp = ds->ds_dir->dd_pool; - uint64_t refd, avail, uobjs, aobjs, ratio; ASSERT(dsl_pool_config_held(dp)); - ratio = dsl_dataset_phys(ds)->ds_compressed_bytes == 0 ? 100 : - (dsl_dataset_phys(ds)->ds_uncompressed_bytes * 100 / - dsl_dataset_phys(ds)->ds_compressed_bytes); - - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, + dsl_get_refratio(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED, - dsl_dataset_phys(ds)->ds_uncompressed_bytes); + dsl_get_logicalreferenced(ds)); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, + dsl_get_compressratio(ds)); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED, + dsl_get_used(ds)); if (ds->ds_is_snapshot) { - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio); - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED, - dsl_dataset_phys(ds)->ds_unique_bytes); get_clones_stat(ds, nv); } else { - if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) { - char buf[ZFS_MAX_DATASET_NAME_LEN]; - dsl_dataset_name(ds->ds_prev, buf); - dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, buf); - } - + char buf[ZFS_MAX_DATASET_NAME_LEN]; + if (dsl_get_prev_snap(ds, buf) == 0) + dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, + buf); dsl_dir_stats(ds->ds_dir, nv); } - dsl_dataset_space(ds, &refd, &avail, &uobjs, &aobjs); - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_AVAILABLE, avail); - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFERENCED, refd); - + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_AVAILABLE, + dsl_get_available(ds)); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFERENCED, + dsl_get_referenced(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_CREATION, - dsl_dataset_phys(ds)->ds_creation_time); + dsl_get_creation(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_CREATETXG, - dsl_dataset_phys(ds)->ds_creation_txg); + dsl_get_creationtxg(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFQUOTA, - ds->ds_quota); + dsl_get_refquota(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRESERVATION, - ds->ds_reserved); + dsl_get_refreservation(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_GUID, - dsl_dataset_phys(ds)->ds_guid); + dsl_get_guid(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_UNIQUE, - dsl_dataset_phys(ds)->ds_unique_bytes); + dsl_get_unique(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_OBJSETID, - ds->ds_object); + dsl_get_objsetid(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USERREFS, - ds->ds_userrefs); + dsl_get_userrefs(ds)); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_DEFER_DESTROY, - DS_IS_DEFER_DESTROY(ds) ? 1 : 0); + dsl_get_defer_destroy(ds)); if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) { - uint64_t written, comp, uncomp; - dsl_pool_t *dp = ds->ds_dir->dd_pool; - dsl_dataset_t *prev; - - int err = dsl_dataset_hold_obj(dp, - dsl_dataset_phys(ds)->ds_prev_snap_obj, FTAG, &prev); - if (err == 0) { - err = dsl_dataset_space_written(prev, ds, &written, - &comp, &uncomp); - dsl_dataset_rele(prev, FTAG); - if (err == 0) { - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_WRITTEN, - written); - } + uint64_t written; + if (dsl_get_written(ds, &written) == 0) { + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_WRITTEN, + written); } } @@ -1921,27 +2210,19 @@ dsl_dataset_fast_stat(dsl_dataset_t *ds, dmu_objset_st dsl_pool_t *dp = ds->ds_dir->dd_pool; ASSERT(dsl_pool_config_held(dp)); - stat->dds_creation_txg = dsl_dataset_phys(ds)->ds_creation_txg; - stat->dds_inconsistent = - dsl_dataset_phys(ds)->ds_flags & DS_FLAG_INCONSISTENT; - stat->dds_guid = dsl_dataset_phys(ds)->ds_guid; + stat->dds_creation_txg = dsl_get_creationtxg(ds); + stat->dds_inconsistent = dsl_get_inconsistent(ds); + stat->dds_guid = dsl_get_guid(ds); stat->dds_origin[0] = '\0'; if (ds->ds_is_snapshot) { stat->dds_is_snapshot = B_TRUE; - stat->dds_num_clones = - dsl_dataset_phys(ds)->ds_num_children - 1; + stat->dds_num_clones = dsl_get_numclones(ds); } else { stat->dds_is_snapshot = B_FALSE; stat->dds_num_clones = 0; if (dsl_dir_is_clone(ds->ds_dir)) { - dsl_dataset_t *ods; - - VERIFY0(dsl_dataset_hold_obj(dp, - dsl_dir_phys(ds->ds_dir)->dd_origin_obj, - FTAG, &ods)); - dsl_dataset_name(ods, stat->dds_origin); - dsl_dataset_rele(ods, FTAG); + dsl_dir_get_origin(ds->ds_dir, stat->dds_origin); } } } @@ -2348,22 +2629,12 @@ struct promotenode { dsl_dataset_t *ds; }; -typedef struct dsl_dataset_promote_arg { - const char *ddpa_clonename; - dsl_dataset_t *ddpa_clone; - list_t shared_snaps, origin_snaps, clone_snaps; - dsl_dataset_t *origin_origin; /* origin of the origin */ - uint64_t used, comp, uncomp, unique, cloneusedsnap, originusedsnap; - char *err_ds; - cred_t *cr; -} dsl_dataset_promote_arg_t; - static int snaplist_space(list_t *l, uint64_t mintxg, uint64_t *spacep); static int promote_hold(dsl_dataset_promote_arg_t *ddpa, dsl_pool_t *dp, void *tag); static void promote_rele(dsl_dataset_promote_arg_t *ddpa, void *tag); -static int +int dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) { dsl_dataset_promote_arg_t *ddpa = arg; @@ -2375,14 +2646,19 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) uint64_t unused; uint64_t ss_mv_cnt; size_t max_snap_len; + boolean_t conflicting_snaps; err = promote_hold(ddpa, dp, FTAG); if (err != 0) return (err); hds = ddpa->ddpa_clone; + snap = list_head(&ddpa->shared_snaps); + origin_ds = snap->ds; max_snap_len = MAXNAMELEN - strlen(ddpa->ddpa_clonename) - 1; + snap = list_head(&ddpa->origin_snaps); + if (dsl_dataset_phys(hds)->ds_flags & DS_FLAG_NOPROMOTE) { promote_rele(ddpa, FTAG); return (SET_ERROR(EXDEV)); @@ -2397,9 +2673,6 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) return (0); } - snap = list_head(&ddpa->shared_snaps); - origin_ds = snap->ds; - /* compute origin's new unique space */ snap = list_tail(&ddpa->clone_snaps); ASSERT3U(dsl_dataset_phys(snap->ds)->ds_prev_snap_obj, ==, @@ -2423,6 +2696,7 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) * Note however, if we stop before we reach the ORIGIN we get: * uN + kN + kN-1 + ... + kM - uM-1 */ + conflicting_snaps = B_FALSE; ss_mv_cnt = 0; ddpa->used = dsl_dataset_phys(origin_ds)->ds_referenced_bytes; ddpa->comp = dsl_dataset_phys(origin_ds)->ds_compressed_bytes; @@ -2451,12 +2725,12 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) } err = dsl_dataset_snap_lookup(hds, ds->ds_snapname, &val); if (err == 0) { - (void) strcpy(ddpa->err_ds, snap->ds->ds_snapname); - err = SET_ERROR(EEXIST); + fnvlist_add_boolean(ddpa->err_ds, + snap->ds->ds_snapname); + conflicting_snaps = B_TRUE; + } else if (err != ENOENT) { goto out; } - if (err != ENOENT) - goto out; /* The very first snapshot does not have a deadlist */ if (dsl_dataset_phys(ds)->ds_prev_snap_obj == 0) @@ -2470,6 +2744,15 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx) } /* + * In order to return the full list of conflicting snapshots, we check + * whether there was a conflict after traversing all of them. + */ + if (conflicting_snaps) { + err = SET_ERROR(EEXIST); + goto out; + } + + /* * If we are a clone of a clone then we never reached ORIGIN, * so we need to subtract out the clone origin's used space. */ @@ -2531,7 +2814,7 @@ out: return (err); } -static void +void dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) { dsl_dataset_promote_arg_t *ddpa = arg; @@ -2856,6 +3139,7 @@ dsl_dataset_promote(const char *name, char *conflsnap) dsl_dataset_promote_arg_t ddpa = { 0 }; uint64_t numsnaps; int error; + nvpair_t *snap_pair; objset_t *os; /* @@ -2873,12 +3157,22 @@ dsl_dataset_promote(const char *name, char *conflsnap) return (error); ddpa.ddpa_clonename = name; - ddpa.err_ds = conflsnap; + ddpa.err_ds = fnvlist_alloc(); ddpa.cr = CRED(); - return (dsl_sync_task(name, dsl_dataset_promote_check, + error = dsl_sync_task(name, dsl_dataset_promote_check, dsl_dataset_promote_sync, &ddpa, - 2 + numsnaps, ZFS_SPACE_CHECK_RESERVED)); + 2 + numsnaps, ZFS_SPACE_CHECK_RESERVED); + + /* + * Return the first conflicting snapshot found. + */ + snap_pair = nvlist_next_nvpair(ddpa.err_ds, NULL); + if (snap_pair != NULL && conflsnap != NULL) + (void) strcpy(conflsnap, nvpair_name(snap_pair)); + + fnvlist_free(ddpa.err_ds); + return (error); } int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Wed Sep 13 10:45:49 2017 (r323530) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2013 by Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -41,14 +42,8 @@ #include #include #include +#include -typedef struct dmu_snapshots_destroy_arg { - nvlist_t *dsda_snaps; - nvlist_t *dsda_successful_snaps; - boolean_t dsda_defer; - nvlist_t *dsda_errlist; -} dmu_snapshots_destroy_arg_t; - int dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boolean_t defer) { @@ -85,51 +80,33 @@ dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boo return (0); } -static int +int dsl_destroy_snapshot_check(void *arg, dmu_tx_t *tx) { - dmu_snapshots_destroy_arg_t *dsda = arg; + dsl_destroy_snapshot_arg_t *ddsa = arg; + const char *dsname = ddsa->ddsa_name; + boolean_t defer = ddsa->ddsa_defer; + dsl_pool_t *dp = dmu_tx_pool(tx); - nvpair_t *pair; int error = 0; + dsl_dataset_t *ds; - if (!dmu_tx_is_syncing(tx)) + error = dsl_dataset_hold(dp, dsname, FTAG, &ds); + + /* + * If the snapshot does not exist, silently ignore it, and + * dsl_destroy_snapshot_sync() will be a no-op + * (it's "already destroyed"). + */ + if (error == ENOENT) return (0); - for (pair = nvlist_next_nvpair(dsda->dsda_snaps, NULL); - pair != NULL; pair = nvlist_next_nvpair(dsda->dsda_snaps, pair)) { - dsl_dataset_t *ds; - - error = dsl_dataset_hold(dp, nvpair_name(pair), - FTAG, &ds); - - /* - * If the snapshot does not exist, silently ignore it - * (it's "already destroyed"). - */ - if (error == ENOENT) - continue; - - if (error == 0) { - error = dsl_destroy_snapshot_check_impl(ds, - dsda->dsda_defer); - dsl_dataset_rele(ds, FTAG); - } - - if (error == 0) { - fnvlist_add_boolean(dsda->dsda_successful_snaps, - nvpair_name(pair)); - } else { - fnvlist_add_int32(dsda->dsda_errlist, - nvpair_name(pair), error); - } + if (error == 0) { + error = dsl_destroy_snapshot_check_impl(ds, defer); + dsl_dataset_rele(ds, FTAG); } - pair = nvlist_next_nvpair(dsda->dsda_errlist, NULL); - if (pair != NULL) - return (fnvpair_value_int32(pair)); - - return (0); + return (error); } struct process_old_arg { @@ -473,23 +450,22 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, bool dmu_object_free_zapified(mos, obj, tx); } -static void +void dsl_destroy_snapshot_sync(void *arg, dmu_tx_t *tx) { - dmu_snapshots_destroy_arg_t *dsda = arg; + dsl_destroy_snapshot_arg_t *ddsa = arg; + const char *dsname = ddsa->ddsa_name; + boolean_t defer = ddsa->ddsa_defer; + dsl_pool_t *dp = dmu_tx_pool(tx); - nvpair_t *pair; + dsl_dataset_t *ds; - for (pair = nvlist_next_nvpair(dsda->dsda_successful_snaps, NULL); - pair != NULL; - pair = nvlist_next_nvpair(dsda->dsda_successful_snaps, pair)) { - dsl_dataset_t *ds; - - VERIFY0(dsl_dataset_hold(dp, nvpair_name(pair), FTAG, &ds)); - - dsl_destroy_snapshot_sync_impl(ds, dsda->dsda_defer, tx); - dsl_dataset_rele(ds, FTAG); - } + int error = dsl_dataset_hold(dp, dsname, FTAG, &ds); + if (error == ENOENT) + return; + ASSERT0(error); + dsl_destroy_snapshot_sync_impl(ds, defer, tx); + dsl_dataset_rele(ds, FTAG); } /* @@ -509,25 +485,85 @@ int dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t defer, nvlist_t *errlist) { - dmu_snapshots_destroy_arg_t dsda; - int error; - nvpair_t *pair; - - pair = nvlist_next_nvpair(snaps, NULL); - if (pair == NULL) + if (nvlist_next_nvpair(snaps, NULL) == NULL) return (0); - dsda.dsda_snaps = snaps; - dsda.dsda_successful_snaps = fnvlist_alloc(); - dsda.dsda_defer = defer; - dsda.dsda_errlist = errlist; + nvlist_t *arg = fnvlist_alloc(); + nvlist_t *snaps_normalized = fnvlist_alloc(); + /* + * lzc_destroy_snaps() is documented to take an nvlist whose + * values "don't matter". We need to convert that nvlist to one + * that we know can be converted to LUA. + */ + for (nvpair_t *pair = nvlist_next_nvpair(snaps, NULL); + pair != NULL; pair = nvlist_next_nvpair(snaps, pair)) { + fnvlist_add_boolean_value(snaps_normalized, + nvpair_name(pair), B_TRUE); + } + fnvlist_add_nvlist(arg, "snaps", snaps_normalized); + fnvlist_add_boolean_value(arg, "defer", defer); - error = dsl_sync_task(nvpair_name(pair), - dsl_destroy_snapshot_check, dsl_destroy_snapshot_sync, - &dsda, 0, ZFS_SPACE_CHECK_NONE); - fnvlist_free(dsda.dsda_successful_snaps); + nvlist_t *wrapper = fnvlist_alloc(); + fnvlist_add_nvlist(wrapper, ZCP_ARG_ARGLIST, arg); + fnvlist_free(arg); - return (error); + const char *program = + "arg = ...\n" + "snaps = arg['snaps']\n" + "defer = arg['defer']\n" + "errors = { }\n" + "has_errors = false\n" + "for snap, v in pairs(snaps) do\n" + " errno = zfs.check.destroy{snap, defer=defer}\n" + " zfs.debug('snap: ' .. snap .. ' errno: ' .. errno)\n" + " if errno == ENOENT then\n" + " snaps[snap] = nil\n" + " elseif errno ~= 0 then\n" + " errors[snap] = errno\n" + " has_errors = true\n" + " end\n" + "end\n" + "if has_errors then\n" + " return errors\n" + "end\n" + "for snap, v in pairs(snaps) do\n" + " errno = zfs.sync.destroy{snap, defer=defer}\n" + " assert(errno == 0)\n" + "end\n" + "return { }\n"; + + nvlist_t *result = fnvlist_alloc(); + int error = zcp_eval(nvpair_name(nvlist_next_nvpair(snaps, NULL)), + program, + 0, + zfs_lua_max_memlimit, + fnvlist_lookup_nvpair(wrapper, ZCP_ARG_ARGLIST), result); + if (error != 0) { + char *errorstr = NULL; + (void) nvlist_lookup_string(result, ZCP_RET_ERROR, &errorstr); + if (errorstr != NULL) { + zfs_dbgmsg(errorstr); + } + return (error); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 13 10:45:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3544E19CB3; Wed, 13 Sep 2017 10:45:51 +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 88A2D821A7; Wed, 13 Sep 2017 10:45:51 +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 v8DAjosq063866; Wed, 13 Sep 2017 10:45:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAjnv0063855; Wed, 13 Sep 2017 10:45:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131045.v8DAjnv0063855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323530 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/lua vendor-sys/illumo... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/lua vendor-sys/illumos/dist/uts/common/fs/zfs/... X-SVN-Commit-Revision: 323530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:45:52 -0000 Author: avg Date: Wed Sep 13 10:45:49 2017 New Revision: 323530 URL: https://svnweb.freebsd.org/changeset/base/323530 Log: 7431 ZFS Channel Programs illumos/illumos-gate@dfc115332c94a2f62058ac7f2bce7631fbd20b3d https://github.com/illumos/illumos-gate/commit/dfc115332c94a2f62058ac7f2bce7631fbd20b3d https://www.illumos.org/issues/7431 ZFS channel programs (ZCP) adds support for performing compound ZFS administrative actions via Lua scripts in a sandboxed environment (with time and memory limits). This initial commit includes both base support for running ZCP scripts, and a small initial library of API calls which support getting properties and listing, destroying, and promoting datasets. Testing: in addition to the included unit tests, channel programs have been in use at Delphix for several months for batch destroying filesystems. The dsl_destroy_snaps_nvl() call has also been replaced with For reference, the new zfs-program manpage is included below. ZFS-PROGRAM(1M) 1M ZFS-PROGRAM(1M) NAME zfs program – executes ZFS channel programs SYNOPSIS zfs program [-t timeout] [-m memory-limit] pool script DESCRIPTION The ZFS channel program interface allows ZFS administrative operations to be run programmatically as a Lua script. The entire script is executed atomically, with no other administrative operations taking effect concurrently. A library of ZFS calls is made available to channel program scripts. Channel programs may only be run with root privileges. A modified version of the Lua 5.2 interpreter is used to run channel program scripts. The Lua 5.2 manual can be found at: http://www.lua.org/manual/5.2/ ... Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Dan Kimmel Approved by: Garrett D'Amore Author: Chris Williamson Added: vendor/illumos/dist/man/man1m/zfs-program.1m Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h vendor/illumos/dist/man/man1m/zfs.1m Changes in other areas also in this revision: Added: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/README.zfs vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lapi.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lapi.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lauxlib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lauxlib.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lbaselib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lbitlib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcode.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcode.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcompat.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lcorolib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lctype.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lctype.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldebug.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldebug.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldo.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldo.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ldump.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lfunc.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lfunc.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llimits.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lmem.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lmem.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lobject.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lobject.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lopcodes.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lopcodes.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lparser.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lparser.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstate.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstate.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstring.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstring.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltablib.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltm.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltm.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lua.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/luaconf.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lualib.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lundump.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lundump.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lvm.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lvm.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lzio.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lzio.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp_global.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp_iter.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp_prop.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_iter.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c (contents, props changed) Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_destroy.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_vfsops.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Sep 13 10:45:49 2017 (r323530) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -106,6 +107,7 @@ static int zfs_do_holds(int argc, char **argv); static int zfs_do_release(int argc, char **argv); static int zfs_do_diff(int argc, char **argv); static int zfs_do_bookmark(int argc, char **argv); +static int zfs_do_channel_program(int argc, char **argv); /* * Enable a reasonable set of defaults for libumem debugging on DEBUG builds. @@ -153,6 +155,7 @@ typedef enum { HELP_RELEASE, HELP_DIFF, HELP_BOOKMARK, + HELP_CHANNEL_PROGRAM, } zfs_help_t; typedef struct zfs_command { @@ -180,6 +183,7 @@ static zfs_command_t command_table[] = { { "promote", zfs_do_promote, HELP_PROMOTE }, { "rename", zfs_do_rename, HELP_RENAME }, { "bookmark", zfs_do_bookmark, HELP_BOOKMARK }, + { "program", zfs_do_channel_program, HELP_CHANNEL_PROGRAM }, { NULL }, { "list", zfs_do_list, HELP_LIST }, { NULL }, @@ -324,6 +328,10 @@ get_usage(zfs_help_t idx) "[snapshot|filesystem]\n")); case HELP_BOOKMARK: return (gettext("\tbookmark \n")); + case HELP_CHANNEL_PROGRAM: + return (gettext("\tprogram [-t ] " + "[-m ] " + "[lua args...]\n")); } abort(); @@ -352,6 +360,18 @@ safe_malloc(size_t size) return (data); } +void * +safe_realloc(void *data, size_t size) +{ + void *newp; + if ((newp = realloc(data, size)) == NULL) { + free(data); + nomem(); + } + + return (newp); +} + static char * safe_strdup(char *str) { @@ -6945,6 +6965,190 @@ zfs_do_bookmark(int argc, char **argv) dgettext(TEXT_DOMAIN, err_msg)); } + return (ret != 0); + +usage: + usage(B_FALSE); + return (-1); +} + +static int +zfs_do_channel_program(int argc, char **argv) +{ + int ret, fd; + char c; + char *progbuf, *filename, *poolname; + size_t progsize, progread; + nvlist_t *outnvl; + uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT; + uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT; + zpool_handle_t *zhp; + + /* check options */ + while (-1 != + (c = getopt(argc, argv, "t:(instr-limit)m:(memory-limit)"))) { + switch (c) { + case 't': + case 'm': { + uint64_t arg; + char *endp; + + errno = 0; + arg = strtoull(optarg, &endp, 0); + if (errno != 0 || *endp != '\0') { + (void) fprintf(stderr, gettext( + "invalid argument " + "'%s': expected integer\n"), optarg); + goto usage; + } + + if (c == 't') { + if (arg > ZCP_MAX_INSTRLIMIT || arg == 0) { + (void) fprintf(stderr, gettext( + "Invalid instruction limit: " + "%s\n"), optarg); + return (1); + } else { + instrlimit = arg; + } + } else { + ASSERT3U(c, ==, 'm'); + if (arg > ZCP_MAX_MEMLIMIT || arg == 0) { + (void) fprintf(stderr, gettext( + "Invalid memory limit: " + "%s\n"), optarg); + return (1); + } else { + memlimit = arg; + } + } + break; + } + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + goto usage; + } + } + + argc -= optind; + argv += optind; + + if (argc < 2) { + (void) fprintf(stderr, + gettext("invalid number of arguments\n")); + goto usage; + } + + poolname = argv[0]; + filename = argv[1]; + if (strcmp(filename, "-") == 0) { + fd = 0; + filename = "standard input"; + } else if ((fd = open(filename, O_RDONLY)) < 0) { + (void) fprintf(stderr, gettext("cannot open '%s': %s\n"), + filename, strerror(errno)); + return (1); + } + + if ((zhp = zpool_open(g_zfs, poolname)) == NULL) { + (void) fprintf(stderr, gettext("cannot open pool '%s'"), + poolname); + return (1); + } + zpool_close(zhp); + + /* + * Read in the channel program, expanding the program buffer as + * necessary. + */ + progread = 0; + progsize = 1024; + progbuf = safe_malloc(progsize); + do { + ret = read(fd, progbuf + progread, progsize - progread); + progread += ret; + if (progread == progsize && ret > 0) { + progsize *= 2; + progbuf = safe_realloc(progbuf, progsize); + } + } while (ret > 0); + + if (fd != 0) + (void) close(fd); + if (ret < 0) { + free(progbuf); + (void) fprintf(stderr, + gettext("cannot read '%s': %s\n"), + filename, strerror(errno)); + return (1); + } + progbuf[progread] = '\0'; + + /* + * Any remaining arguments are passed as arguments to the lua script as + * a string array: + * { + * "argv" -> [ "arg 1", ... "arg n" ], + * } + */ + nvlist_t *argnvl = fnvlist_alloc(); + fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV, argv + 2, argc - 2); + + ret = lzc_channel_program(poolname, progbuf, instrlimit, memlimit, + argnvl, &outnvl); + + if (ret != 0) { + /* + * On error, report the error message handed back by lua if one + * exists. Otherwise, generate an appropriate error message, + * falling back on strerror() for an unexpected return code. + */ + char *errstring = NULL; + if (nvlist_exists(outnvl, ZCP_RET_ERROR)) { + (void) nvlist_lookup_string(outnvl, + ZCP_RET_ERROR, &errstring); + if (errstring == NULL) + errstring = strerror(ret); + } else { + switch (ret) { + case EINVAL: + errstring = + "Invalid instruction or memory limit."; + break; + case ENOMEM: + errstring = "Return value too large."; + break; + case ENOSPC: + errstring = "Memory limit exhausted."; + break; + case ETIME: + errstring = "Timed out."; + break; + case EPERM: + errstring = "Permission denied. Channel " + "programs must be run as root."; + break; + default: + errstring = strerror(ret); + } + } + (void) fprintf(stderr, + gettext("Channel program execution failed:\n%s\n"), + errstring); + } else { + (void) printf("Channel program fully executed "); + if (nvlist_empty(outnvl)) { + (void) printf("with no return value.\n"); + } else { + (void) printf("with return value:\n"); + dump_nvlist(outnvl, 4); + } + } + + free(progbuf); + fnvlist_free(outnvl); + fnvlist_free(argnvl); return (ret != 0); usage: Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Sep 13 10:45:49 2017 (r323530) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. * Copyright 2016 Igor Kozhukhov . @@ -5159,6 +5159,11 @@ get_history_one(zpool_handle_t *zhp, void *data) (void) printf(" output:\n"); dump_nvlist(fnvlist_lookup_nvlist(rec, ZPOOL_HIST_OUTPUT_NVL), 8); + } + if (nvlist_exists(rec, ZPOOL_HIST_ERRNO)) { + (void) printf(" errno: %lld\n", + fnvlist_lookup_int64(rec, + ZPOOL_HIST_ERRNO)); } } else { if (!cb->internal) Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Sep 13 10:45:49 2017 (r323530) @@ -2323,6 +2323,74 @@ zfs_get_clones_nvl(zfs_handle_t *zhp) } /* + * Accepts a property and value and checks that the value + * matches the one found by the channel program. If they are + * not equal, print both of them. + */ +void +zcp_check(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t intval, + const char *strval) +{ + if (!zhp->zfs_hdl->libzfs_prop_debug) + return; + int error; + char *poolname = zhp->zpool_hdl->zpool_name; + const char *program = + "args = ...\n" + "ds = args['dataset']\n" + "prop = args['property']\n" + "value, setpoint = zfs.get_prop(ds, prop)\n" + "return {value=value, setpoint=setpoint}\n"; + nvlist_t *outnvl; + nvlist_t *retnvl; + nvlist_t *argnvl = fnvlist_alloc(); + + fnvlist_add_string(argnvl, "dataset", zhp->zfs_name); + fnvlist_add_string(argnvl, "property", zfs_prop_to_name(prop)); + + error = lzc_channel_program(poolname, program, + 10 * 1000 * 1000, 10 * 1024 * 1024, argnvl, &outnvl); + + if (error == 0) { + retnvl = fnvlist_lookup_nvlist(outnvl, "return"); + if (zfs_prop_get_type(prop) == PROP_TYPE_NUMBER) { + int64_t ans; + error = nvlist_lookup_int64(retnvl, "value", &ans); + if (error != 0) { + (void) fprintf(stderr, "zcp check error: %u\n", + error); + return; + } + if (ans != intval) { + (void) fprintf(stderr, + "%s: zfs found %lld, but zcp found %lld\n", + zfs_prop_to_name(prop), + (longlong_t)intval, (longlong_t)ans); + } + } else { + char *str_ans; + error = nvlist_lookup_string(retnvl, "value", &str_ans); + if (error != 0) { + (void) fprintf(stderr, "zcp check error: %u\n", + error); + return; + } + if (strcmp(strval, str_ans) != 0) { + (void) fprintf(stderr, + "%s: zfs found %s, but zcp found %s\n", + zfs_prop_to_name(prop), + strval, str_ans); + } + } + } else { + (void) fprintf(stderr, + "zcp check failed, channel program error: %u\n", error); + } + nvlist_free(argnvl); + nvlist_free(outnvl); +} + +/* * Retrieve a property from the given object. If 'literal' is specified, then * numbers are left as exact values. Otherwise, numbers are converted to a * human-readable form. @@ -2368,6 +2436,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char &t) == 0) (void) snprintf(propbuf, proplen, "%llu", val); } + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_MOUNTPOINT: @@ -2436,7 +2505,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char /* 'legacy' or 'none' */ (void) strlcpy(propbuf, str, proplen); } - + zcp_check(zhp, prop, NULL, propbuf); break; case ZFS_PROP_ORIGIN: @@ -2444,6 +2513,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char if (str == NULL) return (-1); (void) strlcpy(propbuf, str, proplen); + zcp_check(zhp, prop, NULL, str); break; case ZFS_PROP_CLONES: @@ -2458,7 +2528,6 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char if (get_numeric_property(zhp, prop, src, &source, &val) != 0) return (-1); - /* * If quota or reservation is 0, we translate this into 'none' * (unless literal is set), and indicate that it's the default @@ -2477,6 +2546,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char else zfs_nicenum(val, propbuf, proplen); } + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_FILESYSTEM_LIMIT: @@ -2501,6 +2571,8 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char } else { zfs_nicenum(val, propbuf, proplen); } + + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_REFRATIO: @@ -2510,6 +2582,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char (void) snprintf(propbuf, proplen, "%llu.%02llux", (u_longlong_t)(val / 100), (u_longlong_t)(val % 100)); + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_TYPE: @@ -2530,6 +2603,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char abort(); } (void) snprintf(propbuf, proplen, "%s", str); + zcp_check(zhp, prop, NULL, propbuf); break; case ZFS_PROP_MOUNTED: @@ -2555,6 +2629,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char * consumers. */ (void) strlcpy(propbuf, zhp->zfs_name, proplen); + zcp_check(zhp, prop, NULL, propbuf); break; case ZFS_PROP_MLSLABEL: @@ -2604,26 +2679,33 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char if (get_numeric_property(zhp, prop, src, &source, &val) != 0) return (-1); (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val); + zcp_check(zhp, prop, val, NULL); break; default: switch (zfs_prop_get_type(prop)) { case PROP_TYPE_NUMBER: if (get_numeric_property(zhp, prop, src, - &source, &val) != 0) + &source, &val) != 0) { return (-1); - if (literal) + } + + if (literal) { (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val); - else + } else { zfs_nicenum(val, propbuf, proplen); + } + zcp_check(zhp, prop, val, NULL); break; case PROP_TYPE_STRING: str = getprop_string(zhp, prop, &source); if (str == NULL) return (-1); + (void) strlcpy(propbuf, str, proplen); + zcp_check(zhp, prop, NULL, str); break; case PROP_TYPE_INDEX: @@ -2632,7 +2714,9 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char return (-1); if (zfs_prop_index_to_string(prop, val, &strval) != 0) return (-1); + (void) strlcpy(propbuf, strval, proplen); + zcp_check(zhp, prop, NULL, strval); break; default: Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h Wed Sep 13 10:45:49 2017 (r323530) @@ -79,6 +79,7 @@ struct libzfs_handle { libzfs_fru_t **libzfs_fru_hash; libzfs_fru_t *libzfs_fru_list; char libzfs_chassis_id[256]; + boolean_t libzfs_prop_debug; }; struct zfs_handle { Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_util.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Wed Sep 13 10:45:49 2017 (r323530) @@ -651,6 +651,10 @@ libzfs_init(void) zpool_feature_init(); libzfs_mnttab_init(hdl); + if (getenv("ZFS_PROP_DEBUG") != NULL) { + hdl->libzfs_prop_debug = B_TRUE; + } + return (hdl); } Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Wed Sep 13 10:45:49 2017 (r323530) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. @@ -152,7 +152,15 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, } while (ioctl(g_fd, ioc, &zc) != 0) { - if (errno == ENOMEM && resultp != NULL) { + /* + * If ioctl exited with ENOMEM, we retry the ioctl after + * increasing the size of the destination nvlist. + * + * Channel programs that exit with ENOMEM probably ran over the + * lua memory sandbox; they should not be retried. + */ + if (errno == ENOMEM && resultp != NULL && + ioc != ZFS_IOC_CHANNEL_PROGRAM) { free((void *)(uintptr_t)zc.zc_nvlist_dst); zc.zc_nvlist_dst_size *= 2; zc.zc_nvlist_dst = (uint64_t)(uintptr_t) @@ -864,6 +872,57 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **err pool[strcspn(pool, "/#")] = '\0'; error = lzc_ioctl(ZFS_IOC_DESTROY_BOOKMARKS, pool, bmarks, errlist); + + return (error); +} + +/* + * Executes a channel program. + * + * If this function returns 0 the channel program was successfully loaded and + * ran without failing. Note that individual commands the channel program ran + * may have failed and the channel program is responsible for reporting such + * errors through outnvl if they are important. + * + * This method may also return: + * + * EINVAL The program contains syntax errors, or an invalid memory or time + * limit was given. No part of the channel program was executed. + * If caused by syntax errors, 'outnvl' contains information about the + * errors. + * + * ECHRNG The program was executed, but encountered a runtime error, such as + * calling a function with incorrect arguments, invoking the error() + * function directly, failing an assert() command, etc. Some portion + * of the channel program may have executed and committed changes. + * Information about the failure can be found in 'outnvl'. + * + * ENOMEM The program fully executed, but the output buffer was not large + * enough to store the returned value. No output is returned through + * 'outnvl'. + * + * ENOSPC The program was terminated because it exceeded its memory usage + * limit. Some portion of the channel program may have executed and + * committed changes to disk. No output is returned through 'outnvl'. + * + * ETIME The program was terminated because it exceeded its Lua instruction + * limit. Some portion of the channel program may have executed and + * committed changes to disk. No output is returned through 'outnvl'. + */ +int +lzc_channel_program(const char *pool, const char *program, uint64_t instrlimit, + uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + int error; + nvlist_t *args; + + args = fnvlist_alloc(); + fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); + fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); + fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); + fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); + error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); + fnvlist_free(args); return (error); } Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Wed Sep 13 10:45:49 2017 (r323530) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. */ @@ -85,6 +85,9 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); + +int lzc_channel_program(const char *, const char *, uint64_t, uint64_t, + nvlist_t *, nvlist_t **); #ifdef __cplusplus } Modified: vendor/illumos/dist/lib/libzpool/common/kernel.c ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/kernel.c Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzpool/common/kernel.c Wed Sep 13 10:45:49 2017 (r323530) @@ -702,6 +702,7 @@ vpanic(const char *fmt, va_list adx) char buf[512]; (void) vsnprintf(buf, 512, fmt, adx); assfail(buf, NULL, 0); + abort(); /* necessary to make vpanic meet noreturn requirements */ } void Modified: vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Wed Sep 13 10:41:47 2017 (r323529) +++ vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Wed Sep 13 10:45:49 2017 (r323530) @@ -62,6 +62,7 @@ extern "C" { #include #include #include +#include #include #include #include @@ -107,8 +108,8 @@ extern void dprintf_setup(int *argc, char **argv); extern void cmn_err(int, const char *, ...); extern void vcmn_err(int, const char *, __va_list); -extern void panic(const char *, ...); -extern void vpanic(const char *, __va_list); +extern void panic(const char *, ...) __NORETURN; +extern void vpanic(const char *, __va_list) __NORETURN; #define fm_panic panic @@ -317,6 +318,7 @@ extern void kstat_runq_back_to_waitq(kstat_io_t *); #define KM_SLEEP UMEM_NOFAIL #define KM_PUSHPAGE KM_SLEEP #define KM_NOSLEEP UMEM_DEFAULT +#define KM_NORMALPRI 0 /* not needed with UMEM_DEFAULT */ #define KMC_NODEBUG UMC_NODEBUG #define KMC_NOTOUCH 0 /* not needed for userland caches */ #define kmem_alloc(_s, _f) umem_alloc(_s, _f) Added: vendor/illumos/dist/man/man1m/zfs-program.1m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/man/man1m/zfs-program.1m Wed Sep 13 10:45:49 2017 (r323530) @@ -0,0 +1,499 @@ +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2016 by Delphix. All Rights Reserved. +.\" +.Dd January 21, 2016 +.Dt ZFS-PROGRAM 1M +.Os +.Sh NAME +.Nm zfs program +.Nd executes ZFS channel programs +.Sh SYNOPSIS +.Cm zfs program +.Op Fl t Ar instruction-limit +.Op Fl m Ar memory-limit +.Ar pool +.Ar script +.\".Op Ar optional arguments to channel program +.Sh DESCRIPTION +The ZFS channel program interface allows ZFS administrative operations to be +run programmatically as a Lua script. +The entire script is executed atomically, with no other administrative +operations taking effect concurrently. +A library of ZFS calls is made available to channel program scripts. +Channel programs may only be run with root privileges. +.Pp +A modified version of the Lua 5.2 interpreter is used to run channel program +scripts. +The Lua 5.2 manual can be found at: +.Bd -centered -offset indent +.Lk http://www.lua.org/manual/5.2/ +.Ed +.Pp +The channel program given by +.Ar script +will be run on +.Ar pool , +and any attempts to access or modify other pools will cause an error. +.Sh OPTIONS +.Bl -tag -width "-t" +.It Fl t Ar instruction-limit +Execution time limit, in number of Lua instructions to execute. +If a channel program executes more than the specified number of instructions, +it will be stopped and an error will be returned. +The default limit is 10 million instructions, and it can be set to a maximum of +100 million instructions. +.It Fl m Ar memory-limit +Memory limit, in bytes. +If a channel program attempts to allocate more memory than the given limit, it +will be stopped and an error returned. +The default memory limit is 10 MB, and can be set to a maximum of 100 MB. +.El +.Pp +All remaining argument strings will be passed directly to the Lua script as +described in the +.Sx LUA INTERFACE +section below. +.Sh LUA INTERFACE +A channel program can be invoked either from the command line, or via a library +call to +.Fn lzc_channel_program . +.Ss Arguments +Arguments passed to the channel program are converted to a Lua table. +If invoked from the command line, extra arguments to the Lua script will be +accessible as an array stored in the argument table with the key 'argv': +.Bd -literal -offset indent +args = ... +argv = args["argv"] +-- argv == {1="arg1", 2="arg2", ...} +.Ed +.Pp +If invoked from the libZFS interface, an arbitrary argument list can be +passed to the channel program, which is accessible via the same +"..." syntax in Lua: +.Bd -literal -offset indent +args = ... +-- args == {"foo"="bar", "baz"={...}, ...} +.Ed +.Pp +Note that because Lua arrays are 1-indexed, arrays passed to Lua from the +libZFS interface will have their indices incremented by 1. +That is, the element +in +.Va arr[0] +in a C array passed to a channel program will be stored in +.Va arr[1] +when accessed from Lua. +.Ss Return Values +Lua return statements take the form: +.Bd -literal -offset indent +return ret0, ret1, ret2, ... +.Ed +.Pp +Return statements returning multiple values are permitted internally in a +channel program script, but attempting to return more than one value from the +top level of the channel program is not permitted and will throw an error. +However, tables containing multiple values can still be returned. +If invoked from the command line, a return statement: +.Bd -literal -offset indent +a = {foo="bar", baz=2} +return a +.Ed +.Pp +Will be output formatted as: +.Bd -literal -offset indent +Channel program fully executed with return value: + return: + baz: 2 + foo: 'bar' +.Ed +.Ss Fatal Errors +If the channel program encounters a fatal error while running, a non-zero exit +status will be returned. +If more information about the error is available, a singleton list will be +returned detailing the error: +.Bd -literal -offset indent +error: "error string, including Lua stack trace" +.Ed +.Pp +If a fatal error is returned, the channel program may have not executed at all, +may have partially executed, or may have fully executed but failed to pass a +return value back to userland. +.Pp +If the channel program exhausts an instruction or memory limit, a fatal error +will be generated and the program will be stopped, leaving the program partially +executed. +No attempt is made to reverse or undo any operations already performed. +Note that because both the instruction count and amount of memory used by a +channel program are deterministic when run against the same inputs and +filesystem state, as long as a channel program has run successfully once, you +can guarantee that it will finish successfully against a similar size system. +.Pp +If a channel program attempts to return too large a value, the program will +fully execute but exit with a nonzero status code and no return value. +.Pp +.Em Note: +ZFS API functions do not generate Fatal Errors when correctly invoked, they +return an error code and the channel program continues executing. +See the +.Sx ZFS API +section below for function-specific details on error return codes. +.Ss Lua to C Value Conversion +When invoking a channel program via the libZFS interface, it is necessary to +translate arguments and return values from Lua values to their C equivalents, +and vice-versa. +.Pp +There is a correspondence between nvlist values in C and Lua tables. +A Lua table which is returned from the channel program will be recursively +converted to an nvlist, with table values converted to their natural +equivalents: +.Bd -literal -offset indent +string -> string +number -> int64 +boolean -> boolean_value +nil -> boolean (no value) +table -> nvlist +.Ed +.Pp +Likewise, table keys are replaced by string equivalents as follows: +.Bd -literal -offset indent +string -> no change +number -> signed decimal string ("%lld") +boolean -> "true" | "false" +.Ed +.Pp +Any collision of table key strings (for example, the string "true" and a +true boolean value) will cause a fatal error. +.Pp +Lua numbers are represented internally as signed 64-bit integers. +.Sh LUA STANDARD LIBRARY +The following Lua built-in base library functions are available: +.Bd -literal -offset indent +assert rawlen +collectgarbage rawget +error rawset +getmetatable select +ipairs setmetatable +next tonumber +pairs tostring +rawequal type +.Ed +.Pp +All functions in the +.Em coroutine , +.Em string , +and +.Em table +built-in submodules are also available. +A complete list and documentation of these modules is available in the Lua +manual. +.Pp +The following functions base library functions have been disabled and are +not available for use in channel programs: +.Bd -literal -offset indent +dofile +loadfile +load +pcall +print +xpcall +.Ed +.Sh ZFS API +.Ss Function Arguments +Each API function takes a fixed set of required positional arguments and +optional keyword arguments. +For example, the destroy function takes a single positional string argument +(the name of the dataset to destroy) and an optional "defer" keyword boolean +argument. +When using parentheses to specify the arguments to a Lua function, only +positional arguments can be used: +.Bd -literal -offset indent +zfs.sync.destroy("rpool@snap") +.Ed +.Pp +To use keyword arguments, functions must be called with a single argument that +is a Lua table containing entries mapping integers to positional arguments and +strings to keyword arguments: +.Bd -literal -offset indent +zfs.sync.destroy({1="rpool@snap", defer=true}) +.Ed +.Pp +The Lua language allows curly braces to be used in place of parenthesis as +syntactic sugar for this calling convention: +.Bd -literal -offset indent +zfs.sync.snapshot{"rpool@snap", defer=true} +.Ed +.Ss Function Return Values +If an API function succeeds, it returns 0. +If it fails, it returns an error code and the channel program continues +executing. +API functions do not generate Fatal Errors except in the case of an +unrecoverable internal file system error. +.Pp +In addition to returning an error code, some functions also return extra +details describing what caused the error. +This extra description is given as a second return value, and will always be a +Lua table, or Nil if no error details were returned. +Different keys will exist in the error details table depending on the function +and error case. +Any such function may be called expecting a single return value: +.Bd -literal -offset indent +errno = zfs.sync.promote(dataset) +.Ed +.Pp +Or, the error details can be retrieved: +.Bd -literal -offset indent +errno, details = zfs.sync.promote(dataset) +if (errno == EEXIST) then + assert(details ~= Nil) + list_of_conflicting_snapshots = details +end +.Ed +.Pp +The following global aliases for API function error return codes are defined +for use in channel programs: +.Bd -literal -offset indent +EPERM ECHILD ENODEV ENOSPC +ENOENT EAGAIN ENOTDIR ESPIPE +ESRCH ENOMEM EISDIR EROFS +EINTR EACCES EINVAL EMLINK +EIO EFAULT ENFILE EPIPE +ENXIO ENOTBLK EMFILE EDOM +E2BIG EBUSY ENOTTY ERANGE +ENOEXEC EEXIST ETXTBSY EDQUOT +EBADF EXDEV EFBIG +.Ed +.Ss API Functions +For detailed descriptions of the exact behavior of any zfs administrative +operations, see the main +.Xr zfs 1 +manual page. +.Bl -tag -width "xx" +.It Em zfs.debug(msg) +Record a debug message in the zfs_dbgmsg log. +A log of these messages can be printed via mdb's "::zfs_dbgmsg" command, or +can be monitored live by running: +.Bd -literal -offset indent + dtrace -n 'zfs-dbgmsg{trace(stringof(arg0))}' +.Ed +.Pp +msg (string) +.Bd -ragged -compact -offset "xxxx" +Debug message to be printed. +.Ed +.It Em zfs.get_prop(dataset, property) +Returns two values. +First, a string, number or table containing the property value for the given +dataset. +Second, a string containing the source of the property (i.e. the name of the +dataset in which it was set or nil if it is readonly). +Throws a Lua error if the dataset is invalid or the property doesn't exist. +Note that Lua only supports int64 number types whereas ZFS number properties +are uint64. +This means very large values (like guid) may wrap around and appear negative. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Filesystem or snapshot path to retrieve properties from. +.Ed +.Pp +property (string) +.Bd -ragged -compact -offset "xxxx" +Name of property to retrieve. +All filesystem, snapshot and volume properties are supported except +for 'mounted' and 'iscsioptions.' +Also supports the 'written@snap' and 'written#bookmark' properties and +the '@id' properties, though the id must be in numeric +form. +.Ed +.El +.Bl -tag -width "xx" +.It Sy zfs.sync submodule +The sync submodule contains functions that modify the on-disk state. +They are executed in "syncing context". +.Pp +The available sync submodule functions are as follows: +.Bl -tag -width "xx" +.It Em zfs.sync.destroy(dataset, [defer=true|false]) +Destroy the given dataset. +Returns 0 on successful destroy, or a nonzero error code if the dataset could +not be destroyed (for example, if the dataset has any active children or +clones). +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Filesystem or snapshot to be destroyed. +.Ed +.Pp +[optional] defer (boolean) +.Bd -ragged -compact -offset "xxxx" +Valid only for destroying snapshots. +If set to true, and the snapshot has holds or clones, allows the snapshot to be +marked for deferred deletion rather than failing. +.Ed +.It Em zfs.sync.promote(dataset) +Promote the given clone to a filesystem. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 13 10:54:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BC47E1A26B; Wed, 13 Sep 2017 10:54:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB878827A9; Wed, 13 Sep 2017 10:54:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DAsvxT067962; Wed, 13 Sep 2017 10:54:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAsv08067960; Wed, 13 Sep 2017 10:54:57 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131054.v8DAsv08067960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323531 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 323531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:54:58 -0000 Author: avg Date: Wed Sep 13 10:54:56 2017 New Revision: 323531 URL: https://svnweb.freebsd.org/changeset/base/323531 Log: 8521 nvlist memory leak in get_clones_stat() and spa_load_best() illumos/illumos-gate@7d3000f774e20097a1ee45cbd06d0e38065ddd5a https://github.com/illumos/illumos-gate/commit/7d3000f774e20097a1ee45cbd06d0e38065ddd5a https://www.illumos.org/issues/8521 Yuri reported this to the mailing list: doing a `reboot -d` on current illumos-gate HEAD gives the following ":: findleaks -dv" output: findleaks: maximum buffers => 301061 findleaks: actual buffers => 297587 findleaks: findleaks: potential pointers => 29289774 findleaks: dismissals => 26242305 (89.5%) findleaks: misses => 331153 ( 1.1%) findleaks: dups => 2419681 ( 8.2%) findleaks: follows => 296635 ( 1.0%) findleaks: findleaks: peak memory usage => 7353 kB findleaks: elapsed CPU time => 1.5 seconds findleaks: elapsed wall time => 2.0 seconds findleaks: CACHE LEAKED BUFCTL CALLER ffffff03d222b008 120 ffffff03ef7ceb78 nv_alloc_sys+0x1f ffffff03d222a448 123 ffffff03f4150cc8 nv_alloc_sys+0x1f ffffff03d222b448 5 ffffff03f28bd598 nv_alloc_sys+0x1f ffffff03d222b888 87 ffffff03f28c10f0 nv_alloc_sys+0x1f ffffff03d222c008 21 ffffff03f4139310 nv_alloc_sys+0x1f ffffff03d222b888 43 ffffff040ef3f3e8 nv_alloc_sys+0x1f ffffff03d222c008 120 ffffff03f4591e58 nv_alloc_sys+0x1f ffffff03d222b008 121 ffffff03f352c068 nv_alloc_sys+0x1f ffffff03d222a448 112 ffffff03f414e5f8 nv_alloc_sys+0x1f ffffff03d222b008 119 ffffff03ee92fdc0 nv_alloc_sys+0x1f ffffff03d222b888 46 ffffff03f28c1378 nv_alloc_sys+0x1f ffffff03d222b448 4 ffffff03f28c7708 nv_alloc_sys+0x1f ffffff03d222c008 20 ffffff03f2a6e7e8 nv_alloc_sys+0x1f Reviewed by: Steve Gonczi Reviewed by: George Wilson Reviewed by: Yuri Pankov Reviewed by: Matt Ahrens Approved by: Dan McDonald Author: Pavel Zakharov Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Sep 13 10:45:49 2017 (r323530) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Sep 13 10:54:56 2017 (r323531) @@ -1742,10 +1742,10 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) fnvlist_add_nvlist(propval, ZPROP_VALUE, val); fnvlist_add_nvlist(nv, zfs_prop_to_name(ZFS_PROP_CLONES), propval); - } else { - nvlist_free(val); - nvlist_free(propval); } + + nvlist_free(val); + nvlist_free(propval); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Sep 13 10:45:49 2017 (r323530) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Sep 13 10:54:56 2017 (r323531) @@ -3025,6 +3025,8 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int if (config && (rewind_error || state != SPA_LOAD_RECOVER)) spa_config_set(spa, config); + else + nvlist_free(config); if (state == SPA_LOAD_RECOVER) { ASSERT3P(loadinfo, ==, NULL); From owner-svn-src-all@freebsd.org Wed Sep 13 10:56:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B75EBE1A315; Wed, 13 Sep 2017 10:56:03 +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 904FF828E6; Wed, 13 Sep 2017 10:56:03 +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 v8DAu2i6068083; Wed, 13 Sep 2017 10:56:02 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAu2uu068080; Wed, 13 Sep 2017 10:56:02 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201709131056.v8DAu2uu068080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Wed, 13 Sep 2017 10:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323532 - in head/sys: amd64/conf arm/conf X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: in head/sys: amd64/conf arm/conf X-SVN-Commit-Revision: 323532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:56:03 -0000 Author: kibab Date: Wed Sep 13 10:56:02 2017 New Revision: 323532 URL: https://svnweb.freebsd.org/changeset/base/323532 Log: Add MMCCAM-enabled kernel config for IMX6, reduce debug noice in MMCCAM kernels CAM_DEBUG_TRACE results in way too much debug output than needed now. When debugging, it's always possible to turn on trace level using camcontrol. Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D12110 Added: head/sys/amd64/conf/GENERIC-MMCCAM - copied, changed from r323530, head/sys/amd64/conf/MMCCAM head/sys/arm/conf/IMX6-MMCCAM (contents, props changed) Deleted: head/sys/amd64/conf/MMCCAM Modified: head/sys/arm/conf/BEAGLEBONE-MMCCAM Copied and modified: head/sys/amd64/conf/GENERIC-MMCCAM (from r323530, head/sys/amd64/conf/MMCCAM) ============================================================================== --- head/sys/amd64/conf/MMCCAM Wed Sep 13 10:45:49 2017 (r323530, copy source) +++ head/sys/amd64/conf/GENERIC-MMCCAM Wed Sep 13 10:56:02 2017 (r323532) @@ -4,7 +4,7 @@ include MINIMAL -ident MMCCAM +ident GENERIC-MMCCAM # Access GPT-formatted and labeled root volume options GEOM_PART_GPT @@ -28,9 +28,9 @@ device virtio_balloon # VirtIO Memory Balloon device device pass device scbus device da -device mmccam -options MMCCAM +options MMCCAM + # Add CAMDEBUG stuff -options CAMDEBUG -options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_DEBUG_TRACE) +options CAMDEBUG +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) Modified: head/sys/arm/conf/BEAGLEBONE-MMCCAM ============================================================================== --- head/sys/arm/conf/BEAGLEBONE-MMCCAM Wed Sep 13 10:54:56 2017 (r323531) +++ head/sys/arm/conf/BEAGLEBONE-MMCCAM Wed Sep 13 10:56:02 2017 (r323532) @@ -6,16 +6,18 @@ # # $FreeBSD$ +#NO_UNIVERSE + include BEAGLEBONE +options MMCCAM + # Add CAMDEBUG stuff options CAMDEBUG -options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_DEBUG_TRACE) +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) # pass(4) device device pass -device mmccam -options MMCCAM nodevice mmc nodevice mmcsd Added: head/sys/arm/conf/IMX6-MMCCAM ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/IMX6-MMCCAM Wed Sep 13 10:56:02 2017 (r323532) @@ -0,0 +1,23 @@ +# +# IMX6-MMCCAM +# +# Custom kernel for IMX6 plus MMCCAM as opposed to the prior MMC stack. It is +# present to keep it building in tree since it wouldn't work in LINT. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include IMX6 + +options MMCCAM + +# Add CAMDEBUG stuff +options CAMDEBUG +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) + +# pass(4) device +device pass + +nodevice mmc +nodevice mmcsd From owner-svn-src-all@freebsd.org Wed Sep 13 10:56:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6A9AE1A358; Wed, 13 Sep 2017 10:56:20 +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 A3E33829EC; Wed, 13 Sep 2017 10:56:20 +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 v8DAuJdK068136; Wed, 13 Sep 2017 10:56:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAuJKs068135; Wed, 13 Sep 2017 10:56:19 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131056.v8DAuJKs068135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323533 - vendor-sys/illumos/dist/uts/common/fs/zfs/lua X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs/lua X-SVN-Commit-Revision: 323533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:56:21 -0000 Author: avg Date: Wed Sep 13 10:56:19 2017 New Revision: 323533 URL: https://svnweb.freebsd.org/changeset/base/323533 Log: 8552 ZFS LUA code uses floating point math illumos/illumos-gate@916c8d881190bd2c3ca20d9fca919aecff504435 https://github.com/illumos/illumos-gate/commit/916c8d881190bd2c3ca20d9fca919aecff504435 https://www.illumos.org/issues/8552 In the LUA interpreter used by "zfs program", the lua format() function accidentally includes support for '%f' and friends, which can cause compilation problems when building on platforms that don't support floating-point math in the kernel (e.g. sparc). Support for '%f' friends (%f %e %E %g %G) should be removed, since there's no way to supply a floating-point value anyway (all numbers in ZFS LUA are int64_t's). Reviewed by: Yuri Pankov Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Matthew Ahrens Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Wed Sep 13 10:56:02 2017 (r323532) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Wed Sep 13 10:56:19 2017 (r323533) @@ -958,6 +958,7 @@ static int str_format (lua_State *L) { nb = str_sprintf(buff, form, ni); break; } +#if defined(LUA_USE_FLOAT_FORMATS) case 'e': case 'E': case 'f': #if defined(LUA_USE_AFORMAT) case 'a': case 'A': @@ -967,6 +968,7 @@ static int str_format (lua_State *L) { nb = str_sprintf(buff, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg)); break; } +#endif case 'q': { addquoted(L, &b, arg); break; From owner-svn-src-all@freebsd.org Wed Sep 13 10:57:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E8D3E1A4B0; Wed, 13 Sep 2017 10:57:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B60F82BAF; Wed, 13 Sep 2017 10:57:53 +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 v8DAvqC2068231; Wed, 13 Sep 2017 10:57:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAvq3K068230; Wed, 13 Sep 2017 10:57:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131057.v8DAvq3K068230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323534 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 323534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:57:53 -0000 Author: avg Date: Wed Sep 13 10:57:52 2017 New Revision: 323534 URL: https://svnweb.freebsd.org/changeset/base/323534 Log: 8590 memory leak in dsl_destroy_snapshots_nvl() illumos/illumos-gate@e6ab4525d156c82445c116ecf6b2b874d5e9009d https://github.com/illumos/illumos-gate/commit/e6ab4525d156c82445c116ecf6b2b874d5e9009d https://www.illumos.org/issues/8590 In dsl_destroy_snapshots_nvl(), "snaps_normalized" is not freed after it is added to "arg". Reviewed by: Pavel Zakharov Reviewed by: Steve Gonczi Reviewed by: George Wilson Approved by: Dan McDonald Author: Matthew Ahrens Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Wed Sep 13 10:56:19 2017 (r323533) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Wed Sep 13 10:57:52 2017 (r323534) @@ -501,6 +501,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t d nvpair_name(pair), B_TRUE); } fnvlist_add_nvlist(arg, "snaps", snaps_normalized); + fnvlist_free(snaps_normalized); fnvlist_add_boolean_value(arg, "defer", defer); nvlist_t *wrapper = fnvlist_alloc(); From owner-svn-src-all@freebsd.org Wed Sep 13 10:59:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27D13E1A5C3; Wed, 13 Sep 2017 10:59:39 +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 B866882CFA; Wed, 13 Sep 2017 10:59:38 +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 v8DAxbgj068354; Wed, 13 Sep 2017 10:59:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAxbJ1068345; Wed, 13 Sep 2017 10:59:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131059.v8DAxbJ1068345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323535 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/ztest X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/ztest X-SVN-Commit-Revision: 323535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:59:39 -0000 Author: avg Date: Wed Sep 13 10:59:36 2017 New Revision: 323535 URL: https://svnweb.freebsd.org/changeset/base/323535 Log: 8585 improve batching done in zil_commit() 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 Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c vendor-sys/illumos/dist/uts/common/sys/debug.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/ztest/ztest.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Sep 13 10:59:36 2017 (r323535) @@ -1645,6 +1645,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: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Wed Sep 13 10:59:36 2017 (r323535) @@ -911,7 +911,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: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h Wed Sep 13 10:59:36 2017 (r323535) @@ -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); @@ -426,7 +429,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: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h Wed Sep 13 10:59:36 2017 (r323535) @@ -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: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Wed Sep 13 10:59:36 2017 (r323535) @@ -556,6 +556,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: vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c Wed Sep 13 10:59:36 2017 (r323535) @@ -158,7 +158,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); @@ -199,7 +199,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; @@ -261,7 +261,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. @@ -273,7 +273,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; @@ -608,7 +608,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) @@ -633,7 +633,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: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Sep 13 10:59:36 2017 (r323535) @@ -83,6 +83,7 @@ #include #include #include +#include /* * Programming rules. @@ -1032,7 +1033,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)); } @@ -1045,7 +1046,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; @@ -1057,8 +1058,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 @@ -1076,7 +1078,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: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Wed Sep 13 10:57:52 2017 (r323534) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Wed Sep 13 10:59:36 2017 (r323535) @@ -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; @@ -87,6 +108,7 @@ boolean_t zfs_nocacheflush = B_FALSE; uint64_t zil_slog_bulk = 768 * 1024; static kmem_cache_t *zil_lwb_cache; +static kmem_cache_t *zil_zcw_cache; static void zil_async_to_sync(zilog_t *zilog, uint64_t foid); @@ -436,6 +458,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) { @@ -445,10 +481,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); @@ -461,9 +500,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(). @@ -474,12 +558,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); } } @@ -547,7 +635,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); @@ -564,7 +652,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); @@ -585,13 +673,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) @@ -612,7 +700,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); @@ -629,8 +717,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); @@ -768,24 +856,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); @@ -794,14 +922,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) { @@ -810,57 +931,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; + 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; - zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); + lwb->lwb_root_zio = NULL; + lwb->lwb_state = LWB_STATE_DONE; - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { - vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); - if (vd != NULL) - zio_flush(zio, vd); - kmem_free(zv, sizeof (*zv)); + 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. */ - (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); @@ -869,58 +1050,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); } /* @@ -942,7 +1180,7 @@ uint64_t zil_block_buckets[] = { * Calls are serialized. */ static lwb_t * -zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb) +zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) { lwb_t *nlwb = NULL; zil_chain_t *zilc; @@ -954,6 +1192,11 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb) int i, error; boolean_t slog; + ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT3P(lwb->lwb_root_zio, !=, NULL); + ASSERT3P(lwb->lwb_write_zio, !=, NULL); + ASSERT3S(lwb->lwb_state, ==, LWB_STATE_OPENED); + if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { zilc = (zil_chain_t *)lwb->lwb_buf; bp = &zilc->zc_next_blk; @@ -973,6 +1216,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb) * We dirty the dataset to ensure that zil_sync() will be called * to clean up in the event of allocation failure or I/O failure. */ + tx = dmu_tx_create(zilog->zl_os); /* @@ -1025,6 +1269,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb) zilog->zl_prev_rotor = (zilog->zl_prev_rotor + 1) & (ZIL_PREV_BLKS - 1); BP_ZERO(bp); + /* pass the old blkptr in order to spread log blocks across devs */ error = zio_alloc_zil(spa, txg, bp, &lwb->lwb_blk, zil_blksz, &slog); if (error == 0) { @@ -1033,19 +1278,16 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb) bp->blk_cksum.zc_word[ZIL_ZC_SEQ]++; /* - * Allocate a new log write buffer (lwb). + * Allocate a new log write block (lwb). */ nlwb = zil_alloc_lwb(zilog, bp, slog, txg); - - /* Record the block for later vdev flushing */ - zil_add_block(zilog, &lwb->lwb_blk); } if (BP_GET_CHECKSUM(&lwb->lwb_blk) == ZIO_CHECKSUM_ZILOG2) { /* For Slim ZIL only write what is used. */ wsz = P2ROUNDUP_TYPED(lwb->lwb_nused, ZIL_MIN_BLKSZ, uint64_t); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 13 10:59:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 141A2E1A5C2; Wed, 13 Sep 2017 10:59:39 +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 E1EE682CFB; Wed, 13 Sep 2017 10:59:38 +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 v8DAxcw0068360; Wed, 13 Sep 2017 10:59:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DAxcZZ068359; Wed, 13 Sep 2017 10:59:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131059.v8DAxcZZ068359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 10:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323535 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/ztest X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/ztest X-SVN-Commit-Revision: 323535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 10:59:39 -0000 Author: avg Date: Wed Sep 13 10:59:36 2017 New Revision: 323535 URL: https://svnweb.freebsd.org/changeset/base/323535 Log: 8585 improve batching done in zil_commit() 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 Modified: vendor/illumos/dist/cmd/ztest/ztest.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c vendor-sys/illumos/dist/uts/common/sys/debug.h Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Wed Sep 13 10:57:52 2017 (r323534) +++ vendor/illumos/dist/cmd/ztest/ztest.c Wed Sep 13 10:59:36 2017 (r323535) @@ -1829,13 +1829,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; @@ -1849,6 +1850,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) { @@ -1869,7 +1874,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 */ From owner-svn-src-all@freebsd.org Wed Sep 13 11:07:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6272AE1ABFA; Wed, 13 Sep 2017 11:07:13 +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 2EE0B83491; Wed, 13 Sep 2017 11:07:13 +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 v8DB7CtU072228; Wed, 13 Sep 2017 11:07:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DB7COV072227; Wed, 13 Sep 2017 11:07:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131107.v8DB7COV072227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 11:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323536 - stable/11/sys/x86/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/x86/pci X-SVN-Commit-Revision: 323536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 11:07:13 -0000 Author: kib Date: Wed Sep 13 11:07:12 2017 New Revision: 323536 URL: https://svnweb.freebsd.org/changeset/base/323536 Log: MFC r323217: Fix typos. Stop claiming that two children are created. MFC r323310: Consistently use tabs for indent. Modified: stable/11/sys/x86/pci/qpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/pci/qpi.c ============================================================================== --- stable/11/sys/x86/pci/qpi.c Wed Sep 13 10:59:36 2017 (r323535) +++ stable/11/sys/x86/pci/qpi.c Wed Sep 13 11:07:12 2017 (r323536) @@ -26,9 +26,9 @@ */ /* - * This driver provides a psuedo-bus to enumerate the PCI buses - * present on a sytem using a QPI chipset. It creates a qpi0 bus that - * is a child of nexus0 and then creates two Host-PCI bridges as a + * This driver provides a pseudo-bus to enumerate the PCI buses + * present on a system using a QPI chipset. It creates a qpi0 bus that + * is a child of nexus0 and then creates Host-PCI bridges as a * child of that. */ @@ -64,15 +64,15 @@ static void qpi_identify(driver_t *driver, device_t parent) { - /* Check CPUID to ensure this is an i7 CPU of some sort. */ - if (!(cpu_vendor_id == CPU_VENDOR_INTEL && + /* Check CPUID to ensure this is an i7 CPU of some sort. */ + if (!(cpu_vendor_id == CPU_VENDOR_INTEL && CPUID_TO_FAMILY(cpu_id) == 0x6 && (CPUID_TO_MODEL(cpu_id) == 0x1a || CPUID_TO_MODEL(cpu_id) == 0x2c))) - return; + return; - /* PCI config register access is required. */ - if (pci_cfgregopen() == 0) - return; + /* PCI config register access is required. */ + if (pci_cfgregopen() == 0) + return; /* Add a qpi bus device. */ if (BUS_ADD_CHILD(parent, 20, "qpi", -1) == NULL) @@ -219,7 +219,7 @@ qpi_pcib_attach(device_t dev) { device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); + return (bus_generic_attach(dev)); } static int From owner-svn-src-all@freebsd.org Wed Sep 13 11:19:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9DEAE1B47B; Wed, 13 Sep 2017 11:19:05 +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 6C96A839D9; Wed, 13 Sep 2017 11:19:05 +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 v8DBJ45L076508; Wed, 13 Sep 2017 11:19:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DBJ4HW076504; Wed, 13 Sep 2017 11:19:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131119.v8DBJ4HW076504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 11:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323537 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 323537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 11:19:05 -0000 Author: kib Date: Wed Sep 13 11:19:04 2017 New Revision: 323537 URL: https://svnweb.freebsd.org/changeset/base/323537 Log: MFC r322913: Replace global swhash in swap pager with per-object trie to track swap blocks assigned to the object pages. MFC r322970 (by alc): Do not call vm_pager_page_unswapped() on the fast fault path. MFC r322971 (by alc): Update a couple vm_object lock assertions in the swap pager. MFC r323224: In swp_pager_meta_build(), handle a race with other thread allocating swapblk for our index while we dropped the object lock. MFC r323226: Do not leak empty swblk. Modified: stable/11/sys/vm/swap_pager.c stable/11/sys/vm/vm_fault.c stable/11/sys/vm/vm_object.c stable/11/sys/vm/vm_object.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Wed Sep 13 11:07:12 2017 (r323536) +++ stable/11/sys/vm/swap_pager.c Wed Sep 13 11:19:04 2017 (r323537) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -126,22 +127,17 @@ __FBSDID("$FreeBSD$"); #define SWB_NPAGES MAX_PAGEOUT_CLUSTER #endif +#define SWAP_META_PAGES PCTRIE_COUNT + /* - * The swblock structure maps an object and a small, fixed-size range - * of page indices to disk addresses within a swap area. - * The collection of these mappings is implemented as a hash table. - * Unused disk addresses within a swap area are allocated and managed - * using a blist. + * A swblk structure maps each page index within a + * SWAP_META_PAGES-aligned and sized range to the address of an + * on-disk swap block (or SWAPBLK_NONE). The collection of these + * mappings for an entire vm object is implemented as a pc-trie. */ -#define SWAP_META_PAGES 32 -#define SWAP_META_MASK (SWAP_META_PAGES - 1) - -struct swblock { - struct swblock *swb_hnext; - vm_object_t swb_object; - vm_pindex_t swb_index; - int swb_count; - daddr_t swb_pages[SWAP_META_PAGES]; +struct swblk { + vm_pindex_t p; + daddr_t d[SWAP_META_PAGES]; }; static MALLOC_DEFINE(M_VMPGDATA, "vm_pgdata", "swap pager private data"); @@ -327,10 +323,6 @@ SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT CTLFLAG_MPSAFE, NULL, 0, sysctl_swap_async_max, "I", "Maximum running async swap ops"); -static struct swblock **swhash; -static int swhash_mask; -static struct mtx swhash_mtx; - static struct sx sw_alloc_sx; /* @@ -344,7 +336,8 @@ static struct sx sw_alloc_sx; (&swap_pager_object_list[((int)(intptr_t)handle >> 4) & (NOBJLISTS-1)]) static struct pagerlst swap_pager_object_list[NOBJLISTS]; -static uma_zone_t swap_zone; +static uma_zone_t swblk_zone; +static uma_zone_t swpctrie_zone; /* * pagerops for OBJT_SWAP - "swap pager". Some ops are also global procedure @@ -402,12 +395,28 @@ static daddr_t swp_pager_getswapspace(int npages); /* * Metadata functions */ -static struct swblock **swp_pager_hash(vm_object_t object, vm_pindex_t index); static void swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); +static void * +swblk_trie_alloc(struct pctrie *ptree) +{ + + return (uma_zalloc(swpctrie_zone, M_NOWAIT | (curproc == pageproc ? + M_USE_RESERVE : 0))); +} + +static void +swblk_trie_free(struct pctrie *ptree, void *node) +{ + + uma_zfree(swpctrie_zone, node); +} + +PCTRIE_DEFINE(SWAP, swblk, p, swblk_trie_alloc, swblk_trie_free); + /* * SWP_SIZECHECK() - update swap_pager_full indication * @@ -436,33 +445,6 @@ swp_sizecheck(void) } /* - * SWP_PAGER_HASH() - hash swap meta data - * - * This is an helper function which hashes the swapblk given - * the object and page index. It returns a pointer to a pointer - * to the object, or a pointer to a NULL pointer if it could not - * find a swapblk. - */ -static struct swblock ** -swp_pager_hash(vm_object_t object, vm_pindex_t index) -{ - struct swblock **pswap; - struct swblock *swap; - - index &= ~(vm_pindex_t)SWAP_META_MASK; - pswap = &swhash[(index ^ (int)(intptr_t)object) & swhash_mask]; - while ((swap = *pswap) != NULL) { - if (swap->swb_object == object && - swap->swb_index == index - ) { - break; - } - pswap = &swap->swb_hnext; - } - return (pswap); -} - -/* * SWAP_PAGER_INIT() - initialize the swap pager! * * Expected to be started from system init. NOTE: This code is run @@ -527,21 +509,25 @@ swap_pager_swap_init(void) mtx_unlock(&pbuf_mtx); /* - * Initialize our zone. Right now I'm just guessing on the number - * we need based on the number of pages in the system. Each swblock - * can hold 32 pages, so this is probably overkill. This reservation - * is typically limited to around 32MB by default. + * Initialize our zone, guessing on the number we need based + * on the number of pages in the system. */ n = vm_cnt.v_page_count / 2; - if (maxswzone && n > maxswzone / sizeof(struct swblock)) - n = maxswzone / sizeof(struct swblock); + if (maxswzone && n > maxswzone / sizeof(struct swblk)) + n = maxswzone / sizeof(struct swblk); + swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, + pctrie_zone_init, NULL, UMA_ALIGN_PTR, + UMA_ZONE_NOFREE | UMA_ZONE_VM); + if (swpctrie_zone == NULL) + panic("failed to create swap pctrie zone."); + swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL, + NULL, NULL, _Alignof(struct swblk) - 1, + UMA_ZONE_NOFREE | UMA_ZONE_VM); + if (swblk_zone == NULL) + panic("failed to create swap blk zone."); n2 = n; - swap_zone = uma_zcreate("SWAPMETA", sizeof(struct swblock), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE_VM); - if (swap_zone == NULL) - panic("failed to create swap_zone."); do { - if (uma_zone_reserve_kva(swap_zone, n)) + if (uma_zone_reserve_kva(swblk_zone, n)) break; /* * if the allocation failed, try a zone two thirds the @@ -550,24 +536,13 @@ swap_pager_swap_init(void) n -= ((n + 2) / 3); } while (n > 0); if (n2 != n) - printf("Swap zone entries reduced from %lu to %lu.\n", n2, n); + printf("Swap blk zone entries reduced from %lu to %lu.\n", + n2, n); swap_maxpages = n * SWAP_META_PAGES; - swzone = n * sizeof(struct swblock); - n2 = n; - - /* - * Initialize our meta-data hash table. The swapper does not need to - * be quite as efficient as the VM system, so we do not use an - * oversized hash table. - * - * n: size of hash table, must be power of 2 - * swhash_mask: hash table index mask - */ - for (n = 1; n < n2 / 8; n *= 2) - ; - swhash = malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK | M_ZERO); - swhash_mask = n - 1; - mtx_init(&swhash_mtx, "swap_pager swhash", NULL, MTX_DEF); + swzone = n * sizeof(struct swblk); + if (!uma_zone_reserve_kva(swpctrie_zone, n)) + printf("Cannot reserve swap pctrie zone, " + "reduce kern.maxswzone.\n"); } static vm_object_t @@ -581,14 +556,20 @@ swap_pager_alloc_init(void *handle, struct ucred *cred return (NULL); crhold(cred); } + + /* + * The un_pager.swp.swp_blks trie is initialized by + * vm_object_allocate() to ensure the correct order of + * visibility to other threads. + */ object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + PAGE_MASK + size)); + object->handle = handle; if (cred != NULL) { object->cred = cred; object->charge = size; } - object->un_pager.swp.swp_bcount = 0; return (object); } @@ -1643,50 +1624,56 @@ swp_pager_force_pagein(vm_object_t object, vm_pindex_t static void swap_pager_swapoff(struct swdevt *sp) { - struct swblock *swap; - vm_object_t locked_obj, object; - vm_pindex_t pindex; - int i, j, retries; + struct swblk *sb; + vm_object_t object; + vm_pindex_t pi; + int i, retries; sx_assert(&swdev_syscall_lock, SA_XLOCKED); retries = 0; - locked_obj = NULL; full_rescan: - mtx_lock(&swhash_mtx); - for (i = 0; i <= swhash_mask; i++) { /* '<=' is correct here */ -restart: - for (swap = swhash[i]; swap != NULL; swap = swap->swb_hnext) { - object = swap->swb_object; - pindex = swap->swb_index; - for (j = 0; j < SWAP_META_PAGES; ++j) { - if (!swp_pager_isondev(swap->swb_pages[j], sp)) + mtx_lock(&vm_object_list_mtx); + TAILQ_FOREACH(object, &vm_object_list, object_list) { + if (object->type != OBJT_SWAP) + continue; + mtx_unlock(&vm_object_list_mtx); + /* Depends on type-stability. */ + VM_OBJECT_WLOCK(object); + + /* + * Dead objects are eventually terminated on their own. + */ + if ((object->flags & OBJ_DEAD) != 0) + goto next_obj; + + /* + * Sync with fences placed after pctrie + * initialization. We must not access pctrie below + * unless we checked that our object is swap and not + * dead. + */ + atomic_thread_fence_acq(); + if (object->type != OBJT_SWAP) + goto next_obj; + + for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pi)) != NULL; ) { + pi = sb->p + SWAP_META_PAGES; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] == SWAPBLK_NONE) continue; - if (locked_obj != object) { - if (locked_obj != NULL) - VM_OBJECT_WUNLOCK(locked_obj); - locked_obj = object; - if (!VM_OBJECT_TRYWLOCK(object)) { - mtx_unlock(&swhash_mtx); - /* Depends on type-stability. */ - VM_OBJECT_WLOCK(object); - mtx_lock(&swhash_mtx); - goto restart; - } - } - MPASS(locked_obj == object); - mtx_unlock(&swhash_mtx); - swp_pager_force_pagein(object, pindex + j); - mtx_lock(&swhash_mtx); - goto restart; + if (swp_pager_isondev(sb->d[i], sp)) + swp_pager_force_pagein(object, + sb->p + i); } } +next_obj: + VM_OBJECT_WUNLOCK(object); + mtx_lock(&vm_object_list_mtx); } - mtx_unlock(&swhash_mtx); - if (locked_obj != NULL) { - VM_OBJECT_WUNLOCK(locked_obj); - locked_obj = NULL; - } + mtx_unlock(&vm_object_list_mtx); + if (sp->sw_used) { /* * Objects may be locked or paging to the device being @@ -1729,85 +1716,120 @@ restart: static void swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) { - static volatile int exhausted; - struct swblock *swap; - struct swblock **pswap; - int idx; + static volatile int swblk_zone_exhausted, swpctrie_zone_exhausted; + struct swblk *sb, *sb1; + vm_pindex_t modpi, rdpi; + int error, i; VM_OBJECT_ASSERT_WLOCKED(object); + /* * Convert default object to swap object if necessary */ if (object->type != OBJT_SWAP) { + pctrie_init(&object->un_pager.swp.swp_blks); + + /* + * Ensure that swap_pager_swapoff()'s iteration over + * object_list does not see a garbage pctrie. + */ + atomic_thread_fence_rel(); + object->type = OBJT_SWAP; - object->un_pager.swp.swp_bcount = 0; KASSERT(object->handle == NULL, ("default pager with handle")); } - /* - * Locate hash entry. If not found create, but if we aren't adding - * anything just return. If we run out of space in the map we wait - * and, since the hash table may have changed, retry. - */ -retry: - mtx_lock(&swhash_mtx); - pswap = swp_pager_hash(object, pindex); - - if ((swap = *pswap) == NULL) { - int i; - + rdpi = rounddown(pindex, SWAP_META_PAGES); + sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, rdpi); + if (sb == NULL) { if (swapblk == SWAPBLK_NONE) - goto done; - - swap = *pswap = uma_zalloc(swap_zone, M_NOWAIT | - (curproc == pageproc ? M_USE_RESERVE : 0)); - if (swap == NULL) { - mtx_unlock(&swhash_mtx); + return; + for (;;) { + sb = uma_zalloc(swblk_zone, M_NOWAIT | (curproc == + pageproc ? M_USE_RESERVE : 0)); + if (sb != NULL) { + sb->p = rdpi; + for (i = 0; i < SWAP_META_PAGES; i++) + sb->d[i] = SWAPBLK_NONE; + if (atomic_cmpset_int(&swblk_zone_exhausted, + 1, 0)) + printf("swblk zone ok\n"); + break; + } VM_OBJECT_WUNLOCK(object); - if (uma_zone_exhausted(swap_zone)) { - if (atomic_cmpset_int(&exhausted, 0, 1)) - printf("swap zone exhausted, " + if (uma_zone_exhausted(swblk_zone)) { + if (atomic_cmpset_int(&swblk_zone_exhausted, + 0, 1)) + printf("swap blk zone exhausted, " "increase kern.maxswzone\n"); vm_pageout_oom(VM_OOM_SWAPZ); - pause("swzonex", 10); + pause("swzonxb", 10); } else VM_WAIT; VM_OBJECT_WLOCK(object); - goto retry; + sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, + rdpi); + if (sb != NULL) + /* + * Somebody swapped out a nearby page, + * allocating swblk at the rdpi index, + * while we dropped the object lock. + */ + goto allocated; } - - if (atomic_cmpset_int(&exhausted, 1, 0)) - printf("swap zone ok\n"); - - swap->swb_hnext = NULL; - swap->swb_object = object; - swap->swb_index = pindex & ~(vm_pindex_t)SWAP_META_MASK; - swap->swb_count = 0; - - ++object->un_pager.swp.swp_bcount; - - for (i = 0; i < SWAP_META_PAGES; ++i) - swap->swb_pages[i] = SWAPBLK_NONE; + for (;;) { + error = SWAP_PCTRIE_INSERT( + &object->un_pager.swp.swp_blks, sb); + if (error == 0) { + if (atomic_cmpset_int(&swpctrie_zone_exhausted, + 1, 0)) + printf("swpctrie zone ok\n"); + break; + } + VM_OBJECT_WUNLOCK(object); + if (uma_zone_exhausted(swpctrie_zone)) { + if (atomic_cmpset_int(&swpctrie_zone_exhausted, + 0, 1)) + printf("swap pctrie zone exhausted, " + "increase kern.maxswzone\n"); + vm_pageout_oom(VM_OOM_SWAPZ); + pause("swzonxp", 10); + } else + VM_WAIT; + VM_OBJECT_WLOCK(object); + sb1 = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, + rdpi); + if (sb1 != NULL) { + uma_zfree(swblk_zone, sb); + sb = sb1; + goto allocated; + } + } } +allocated: + MPASS(sb->p == rdpi); - /* - * Delete prior contents of metadata - */ - idx = pindex & SWAP_META_MASK; + modpi = pindex % SWAP_META_PAGES; + /* Delete prior contents of metadata. */ + if (sb->d[modpi] != SWAPBLK_NONE) + swp_pager_freeswapspace(sb->d[modpi], 1); + /* Enter block into metadata. */ + sb->d[modpi] = swapblk; - if (swap->swb_pages[idx] != SWAPBLK_NONE) { - swp_pager_freeswapspace(swap->swb_pages[idx], 1); - --swap->swb_count; - } - /* - * Enter block into metadata + * Free the swblk if we end up with the empty page run. */ - swap->swb_pages[idx] = swapblk; - if (swapblk != SWAPBLK_NONE) - ++swap->swb_count; -done: - mtx_unlock(&swhash_mtx); + if (swapblk == SWAPBLK_NONE) { + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + break; + } + if (i == SWAP_META_PAGES) { + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, + rdpi); + uma_zfree(swblk_zone, sb); + } + } } /* @@ -1821,42 +1843,40 @@ done: * with resident pages. */ static void -swp_pager_meta_free(vm_object_t object, vm_pindex_t index, vm_pindex_t count) +swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count) { - struct swblock **pswap, *swap; - vm_pindex_t c; - daddr_t v; - int n, sidx; + struct swblk *sb; + vm_pindex_t last; + int i; + bool empty; - VM_OBJECT_ASSERT_LOCKED(object); + VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP || count == 0) return; - mtx_lock(&swhash_mtx); - for (c = 0; c < count;) { - pswap = swp_pager_hash(object, index); - sidx = index & SWAP_META_MASK; - n = SWAP_META_PAGES - sidx; - index += n; - if ((swap = *pswap) == NULL) { - c += n; - continue; - } - for (; c < count && sidx < SWAP_META_PAGES; ++c, ++sidx) { - if ((v = swap->swb_pages[sidx]) == SWAPBLK_NONE) + last = pindex + count - 1; + for (;;) { + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + if (sb == NULL || sb->p > last) + break; + empty = true; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] == SWAPBLK_NONE) continue; - swp_pager_freeswapspace(v, 1); - swap->swb_pages[sidx] = SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - c += SWAP_META_PAGES - sidx; - break; - } + if (pindex <= sb->p + i && sb->p + i <= last) { + swp_pager_freeswapspace(sb->d[i], 1); + sb->d[i] = SWAPBLK_NONE; + } else + empty = false; } + pindex = sb->p + SWAP_META_PAGES; + if (empty) { + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, + sb->p); + uma_zfree(swblk_zone, sb); + } } - mtx_unlock(&swhash_mtx); } /* @@ -1868,36 +1888,23 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t in static void swp_pager_meta_free_all(vm_object_t object) { - struct swblock **pswap, *swap; - vm_pindex_t index; - daddr_t v; + struct swblk *sb; + vm_pindex_t pindex; int i; VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP) return; - index = 0; - while (object->un_pager.swp.swp_bcount != 0) { - mtx_lock(&swhash_mtx); - pswap = swp_pager_hash(object, index); - if ((swap = *pswap) != NULL) { - for (i = 0; i < SWAP_META_PAGES; ++i) { - v = swap->swb_pages[i]; - if (v != SWAPBLK_NONE) { - --swap->swb_count; - swp_pager_freeswapspace(v, 1); - } - } - if (swap->swb_count != 0) - panic( - "swap_pager_meta_free_all: swb_count != 0"); - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; + for (pindex = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pindex)) != NULL;) { + pindex = sb->p + SWAP_META_PAGES; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + swp_pager_freeswapspace(sb->d[i], 1); } - mtx_unlock(&swhash_mtx); - index += SWAP_META_PAGES; + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, sb->p); + uma_zfree(swblk_zone, sb); } } @@ -1911,9 +1918,6 @@ swp_pager_meta_free_all(vm_object_t object) * was invalid. This routine will automatically free any invalid * meta-data swapblks. * - * It is not possible to store invalid swapblks in the swap meta data - * (other then a literal 'SWAPBLK_NONE'), so we don't bother checking. - * * When acting on a busy resident page and paging is in progress, we * have to wait until paging is complete but otherwise can act on the * busy page. @@ -1924,43 +1928,45 @@ swp_pager_meta_free_all(vm_object_t object) static daddr_t swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pindex, int flags) { - struct swblock **pswap; - struct swblock *swap; + struct swblk *sb; daddr_t r1; - int idx; + int i; - VM_OBJECT_ASSERT_LOCKED(object); + if ((flags & (SWM_FREE | SWM_POP)) != 0) + VM_OBJECT_ASSERT_WLOCKED(object); + else + VM_OBJECT_ASSERT_LOCKED(object); + /* - * The meta data only exists of the object is OBJT_SWAP + * The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ if (object->type != OBJT_SWAP) return (SWAPBLK_NONE); - r1 = SWAPBLK_NONE; - mtx_lock(&swhash_mtx); - pswap = swp_pager_hash(object, pindex); - - if ((swap = *pswap) != NULL) { - idx = pindex & SWAP_META_MASK; - r1 = swap->swb_pages[idx]; - - if (r1 != SWAPBLK_NONE) { - if (flags & SWM_FREE) { - swp_pager_freeswapspace(r1, 1); - r1 = SWAPBLK_NONE; - } - if (flags & (SWM_FREE|SWM_POP)) { - swap->swb_pages[idx] = SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - } - } + sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + if (sb == NULL) + return (SWAPBLK_NONE); + r1 = sb->d[pindex % SWAP_META_PAGES]; + if (r1 == SWAPBLK_NONE) + return (SWAPBLK_NONE); + if ((flags & (SWM_FREE | SWM_POP)) != 0) { + sb->d[pindex % SWAP_META_PAGES] = SWAPBLK_NONE; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + break; } + if (i == SWAP_META_PAGES) { + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + uma_zfree(swblk_zone, sb); + } } - mtx_unlock(&swhash_mtx); + if ((flags & SWM_FREE) != 0) { + swp_pager_freeswapspace(r1, 1); + r1 = SWAPBLK_NONE; + } return (r1); } @@ -1974,32 +1980,38 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pin vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) { - struct swblock **pswap, *swap; - vm_pindex_t i, j, lim; - int idx; + struct swblk *sb; + int i; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP || object->un_pager.swp.swp_bcount == 0) + if (object->type != OBJT_SWAP) return (object->size); - mtx_lock(&swhash_mtx); - for (j = pindex; j < object->size; j = lim) { - pswap = swp_pager_hash(object, j); - lim = rounddown2(j + SWAP_META_PAGES, SWAP_META_PAGES); - if (lim > object->size) - lim = object->size; - if ((swap = *pswap) != NULL) { - for (idx = j & SWAP_META_MASK, i = j; i < lim; - i++, idx++) { - if (swap->swb_pages[idx] != SWAPBLK_NONE) - goto found; - } + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + if (sb == NULL) + return (object->size); + if (sb->p < pindex) { + for (i = pindex % SWAP_META_PAGES; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + return (sb->p + i); } + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + roundup(pindex, SWAP_META_PAGES)); + if (sb == NULL) + return (object->size); } - i = object->size; -found: - mtx_unlock(&swhash_mtx); - return (i); + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + return (sb->p + i); + } + + /* + * We get here if a swblk is present in the trie but it + * doesn't map any blocks. + */ + MPASS(0); + return (object->size); } /* @@ -2035,7 +2047,7 @@ sys_swapon(struct thread *td, struct swapon_args *uap) * Swap metadata may not fit in the KVM if we have physical * memory of >1GB. */ - if (swap_zone == NULL) { + if (swblk_zone == NULL) { error = ENOMEM; goto done; } @@ -2080,7 +2092,7 @@ swapon_check_swzone(void) npages = swap_total / PAGE_SIZE; /* absolute maximum we can handle assuming 100% efficiency */ - maxpages = uma_zone_get_max(swap_zone) * SWAP_META_PAGES; + maxpages = uma_zone_get_max(swblk_zone) * SWAP_META_PAGES; /* recommend using no more than half that amount */ if (npages > maxpages / 2) { @@ -2378,15 +2390,9 @@ SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD | CTL "Swap statistics by device"); /* - * vmspace_swap_count() - count the approximate swap usage in pages for a - * vmspace. - * - * The map must be locked. - * - * Swap usage is determined by taking the proportional swap used by - * VM objects backing the VM map. To make up for fractional losses, - * if the VM object has any swap use at all the associated map entries - * count for at least 1 swap page. + * Count the approximate swap usage in pages for a vmspace. The + * shadowed or not yet copied on write swap blocks are not accounted. + * The map must be locked. */ long vmspace_swap_count(struct vmspace *vmspace) @@ -2394,23 +2400,38 @@ vmspace_swap_count(struct vmspace *vmspace) vm_map_t map; vm_map_entry_t cur; vm_object_t object; - long count, n; + struct swblk *sb; + vm_pindex_t e, pi; + long count; + int i; map = &vmspace->vm_map; count = 0; for (cur = map->header.next; cur != &map->header; cur = cur->next) { - if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) == 0 && - (object = cur->object.vm_object) != NULL) { - VM_OBJECT_WLOCK(object); - if (object->type == OBJT_SWAP && - object->un_pager.swp.swp_bcount != 0) { - n = (cur->end - cur->start) / PAGE_SIZE; - count += object->un_pager.swp.swp_bcount * - SWAP_META_PAGES * n / object->size + 1; + if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) + continue; + object = cur->object.vm_object; + if (object == NULL || object->type != OBJT_SWAP) + continue; + VM_OBJECT_RLOCK(object); + if (object->type != OBJT_SWAP) + goto unlock; + pi = OFF_TO_IDX(cur->offset); + e = pi + OFF_TO_IDX(cur->end - cur->start); + for (;; pi = sb->p + SWAP_META_PAGES) { + sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pi); + if (sb == NULL || sb->p >= e) + break; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->p + i < e && + sb->d[i] != SWAPBLK_NONE) + count++; } - VM_OBJECT_WUNLOCK(object); } +unlock: + VM_OBJECT_RUNLOCK(object); } return (count); } Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Wed Sep 13 11:07:12 2017 (r323536) +++ stable/11/sys/vm/vm_fault.c Wed Sep 13 11:19:04 2017 (r323537) @@ -236,14 +236,15 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p * written NOW so dirty it explicitly to save on * pmap_is_modified() calls later. * - * Also tell the backing pager, if any, that it should remove - * any swap backing since the page is now dirty. + * Also, since the page is now dirty, we can possibly tell + * the pager to release any swap backing the page. Calling + * the pager requires a write lock on the object. */ if (need_dirty) vm_page_dirty(m); if (!set_wd) vm_page_unlock(m); - if (need_dirty) + else if (need_dirty) vm_pager_page_unswapped(m); } Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Wed Sep 13 11:07:12 2017 (r323536) +++ stable/11/sys/vm/vm_object.c Wed Sep 13 11:19:04 2017 (r323537) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include /* for curproc, pageproc */ @@ -208,6 +209,7 @@ vm_object_zinit(void *mem, int size, int flags) object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; + object->flags = OBJ_DEAD; mtx_lock(&vm_object_list_mtx); TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); @@ -223,6 +225,16 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, LIST_INIT(&object->shadow_head); object->type = type; + if (type == OBJT_SWAP) + pctrie_init(&object->un_pager.swp.swp_blks); + + /* + * Ensure that swap_pager_swapoff() iteration over object_list + * sees up to date type and pctrie head if it observed + * non-dead object. + */ + atomic_thread_fence_rel(); + switch (type) { case OBJT_DEAD: panic("_vm_object_allocate: can't create OBJT_DEAD"); Modified: stable/11/sys/vm/vm_object.h ============================================================================== --- stable/11/sys/vm/vm_object.h Wed Sep 13 11:07:12 2017 (r323536) +++ stable/11/sys/vm/vm_object.h Wed Sep 13 11:19:04 2017 (r323537) @@ -70,6 +70,7 @@ #include #include #include +#include #include #include @@ -151,13 +152,12 @@ struct vm_object { * the handle changed and hash-chain * invalid. * - * swp_bcount - number of swap 'swblock' metablocks, each - * contains up to 16 swapblk assignments. - * see vm/swap_pager.h + * swp_blks - pc-trie of the allocated swap blocks. + * */ struct { void *swp_tmpfs; - int swp_bcount; + struct pctrie swp_blks; } swp; } un_pager; struct ucred *cred; From owner-svn-src-all@freebsd.org Wed Sep 13 11:29:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CDAEE1BD88; Wed, 13 Sep 2017 11:29:50 +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 EADC78C; Wed, 13 Sep 2017 11:29:49 +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 v8DBTnvR080447; Wed, 13 Sep 2017 11:29:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DBTmD8080440; Wed, 13 Sep 2017 11:29:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131129.v8DBTmD8080440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 11:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323538 - stable/11/lib/libc/amd64/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/amd64/sys X-SVN-Commit-Revision: 323538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 11:29:50 -0000 Author: kib Date: Wed Sep 13 11:29:48 2017 New Revision: 323538 URL: https://svnweb.freebsd.org/changeset/base/323538 Log: MFC 322763: Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE instructions, if supported both by CPU and kernel. Added: stable/11/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c - copied, changed from r322763, head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c stable/11/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h - copied unchanged from r322763, head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h Modified: stable/11/lib/libc/amd64/sys/Makefile.inc stable/11/lib/libc/amd64/sys/amd64_get_fsbase.c stable/11/lib/libc/amd64/sys/amd64_get_gsbase.c stable/11/lib/libc/amd64/sys/amd64_set_fsbase.c stable/11/lib/libc/amd64/sys/amd64_set_gsbase.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- stable/11/lib/libc/amd64/sys/Makefile.inc Wed Sep 13 11:19:04 2017 (r323537) +++ stable/11/lib/libc/amd64/sys/Makefile.inc Wed Sep 13 11:29:48 2017 (r323538) @@ -1,7 +1,11 @@ # from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp # $FreeBSD$ -SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ +SRCS+= \ + amd64_detect_rdfsgsbase.c \ + amd64_get_fsbase.c \ + amd64_get_gsbase.c \ + amd64_set_fsbase.c \ amd64_set_gsbase.c MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \ Copied and modified: stable/11/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c (from r322763, head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c) ============================================================================== --- head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c Mon Aug 21 17:39:12 2017 (r322763, copy source) +++ stable/11/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c Wed Sep 13 11:29:48 2017 (r323538) @@ -48,7 +48,9 @@ amd64_detect_rdfsgsbase(void) if (__predict_true(state != RDFSGS_UNKNOWN)) return (state); - if (__getosreldate() >= P_OSREL_WRFSBASE) { + if (__getosreldate() >= P_OSREL_WRFSBASE || + (P_OSREL_MAJOR(__getosreldate()) == 11 && __getosreldate() >= + P_OSREL_WRFSBASE_11)) { do_cpuid(0x0, p); if (p[0] >= 0x7) { cpuid_count(0x7, 0x0, p); Copied: stable/11/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h (from r322763, head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h Wed Sep 13 11:29:48 2017 (r323538, copy of r322763, head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2017 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _AMD64_DETECT_RDFSGSBASE_H_ +#define _AMD64_DETECT_RDFSGSBASE_H_ + +enum { + RDFSGS_UNKNOWN, + RDFSGS_SUPPORTED, + RDFSGS_UNSUPPORTED, +}; + +int amd64_detect_rdfsgsbase(void); + +#endif Modified: stable/11/lib/libc/amd64/sys/amd64_get_fsbase.c ============================================================================== --- stable/11/lib/libc/amd64/sys/amd64_get_fsbase.c Wed Sep 13 11:19:04 2017 (r323537) +++ stable/11/lib/libc/amd64/sys/amd64_get_fsbase.c Wed Sep 13 11:29:48 2017 (r323538) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * 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: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_get_fsbase(void **addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + *addr = (void *)rdfsbase(); + return (0); + } return (sysarch(AMD64_GET_FSBASE, addr)); } Modified: stable/11/lib/libc/amd64/sys/amd64_get_gsbase.c ============================================================================== --- stable/11/lib/libc/amd64/sys/amd64_get_gsbase.c Wed Sep 13 11:19:04 2017 (r323537) +++ stable/11/lib/libc/amd64/sys/amd64_get_gsbase.c Wed Sep 13 11:29:48 2017 (r323538) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * 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: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_get_gsbase(void **addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + *addr = (void *)rdgsbase(); + return (0); + } return (sysarch(AMD64_GET_GSBASE, addr)); } Modified: stable/11/lib/libc/amd64/sys/amd64_set_fsbase.c ============================================================================== --- stable/11/lib/libc/amd64/sys/amd64_set_fsbase.c Wed Sep 13 11:19:04 2017 (r323537) +++ stable/11/lib/libc/amd64/sys/amd64_set_fsbase.c Wed Sep 13 11:29:48 2017 (r323538) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * 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: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_set_fsbase(void *addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + wrfsbase((uintptr_t)addr); + return (0); + } return (sysarch(AMD64_SET_FSBASE, &addr)); } Modified: stable/11/lib/libc/amd64/sys/amd64_set_gsbase.c ============================================================================== --- stable/11/lib/libc/amd64/sys/amd64_set_gsbase.c Wed Sep 13 11:19:04 2017 (r323537) +++ stable/11/lib/libc/amd64/sys/amd64_set_gsbase.c Wed Sep 13 11:29:48 2017 (r323538) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * 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: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_set_gsbase(void *addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + wrgsbase((uintptr_t)addr); + return (0); + } return (sysarch(AMD64_SET_GSBASE, &addr)); } From owner-svn-src-all@freebsd.org Wed Sep 13 12:16:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79C7FE1E2F1; Wed, 13 Sep 2017 12:16:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 442801F87; Wed, 13 Sep 2017 12:16:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DCGRfV001252; Wed, 13 Sep 2017 12:16:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DCGRgW001251; Wed, 13 Sep 2017 12:16:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709131216.v8DCGRgW001251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 13 Sep 2017 12:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323539 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 323539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 12:16:28 -0000 Author: emaste Date: Wed Sep 13 12:16:27 2017 New Revision: 323539 URL: https://svnweb.freebsd.org/changeset/base/323539 Log: qlnx: exclude if WITHOUT_SOURCELESS_UCODE set PR: 222277 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Wed Sep 13 11:29:48 2017 (r323538) +++ head/sys/modules/Makefile Wed Sep 13 12:16:27 2017 (r323539) @@ -718,8 +718,8 @@ _qlxge= qlxge _qlxgb= qlxgb .if ${MK_SOURCELESS_UCODE} != "no" _qlxgbe= qlxgbe -.endif _qlnx= qlnx +.endif _sfxge= sfxge _sgx= sgx _sgx_linux= sgx_linux From owner-svn-src-all@freebsd.org Wed Sep 13 13:03:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3E3DE1FF5B; Wed, 13 Sep 2017 13:03:30 +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 9E2303937; Wed, 13 Sep 2017 13:03:30 +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 v8DD3Tnn021584; Wed, 13 Sep 2017 13:03:29 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DD3TY3021583; Wed, 13 Sep 2017 13:03:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709131303.v8DD3TY3021583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Sep 2017 13:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323540 - head/sys/dev/jedec_ts X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/jedec_ts X-SVN-Commit-Revision: 323540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 13:03:30 -0000 Author: avg Date: Wed Sep 13 13:03:29 2017 New Revision: 323540 URL: https://svnweb.freebsd.org/changeset/base/323540 Log: jedec_ts: add many more devices from various vendors The new IDs are taken from the hardware to which I have access and from open datasheets. Also, the hardware probing is moved to the device probe method. Reviewed by: rpokala MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11730 Modified: head/sys/dev/jedec_ts/jedec_ts.c Modified: head/sys/dev/jedec_ts/jedec_ts.c ============================================================================== --- head/sys/dev/jedec_ts/jedec_ts.c Wed Sep 13 12:16:27 2017 (r323539) +++ head/sys/dev/jedec_ts/jedec_ts.c Wed Sep 13 13:03:29 2017 (r323540) @@ -42,6 +42,116 @@ __FBSDID("$FreeBSD$"); /* + * General device identification notes. + * + * The JEDEC TSE2004av specification defines the device ID that all compliant + * devices should use, but very few do in practice. Maybe that's because + * TSE2002av was rather vague about that. + * Rare examples are IDT TSE2004GB2B0 and Atmel AT30TSE004A, not sure if + * they are TSE2004av compliant by design or by accident. + * Also, the specification mandates that PCI SIG manufacturer IDs are to be + * used, but in practice the JEDEC manufacturer IDs are often used. + */ + +const struct ts_dev { + uint16_t vendor_id; + uint8_t device_id; + const char *description; +} known_devices[] = { + /* + * Analog Devices ADT7408. + * http://www.analog.com/media/en/technical-documentation/data-sheets/ADT7408.pdf + */ + { 0x11d4, 0x08, "Analog Devices DIMM temperature sensor" }, + + /* + * Atmel AT30TSE002B, AT30TSE004A. + * http://www.atmel.com/images/doc8711.pdf + * http://www.atmel.com/images/atmel-8868-dts-at30tse004a-datasheet.pdf + * Note how one chip uses the JEDEC Manufacturer ID while the other + * uses the PCI SIG one. + */ + { 0x001f, 0x82, "Atmel DIMM temperature sensor" }, + { 0x1114, 0x22, "Atmel DIMM temperature sensor" }, + + /* + * Integrated Device Technology (IDT) TS3000B3A, TSE2002B3C, + * TSE2004GB2B0 chips and their variants. + * http://www.idt.com/sites/default/files/documents/IDT_TSE2002B3C_DST_20100512_120303152056.pdf + * http://www.idt.com/sites/default/files/documents/IDT_TS3000B3A_DST_20101129_120303152013.pdf + * https://www.idt.com/document/dst/tse2004gb2b0-datasheet + */ + { 0x00b3, 0x29, "IDT DIMM temperature sensor" }, + { 0x00b3, 0x22, "IDT DIMM temperature sensor" }, + + /* + * Maxim Integrated MAX6604. + * Different document revisions specify different Device IDs. + * Document 19-3837; Rev 0; 10/05 has 0x3e00 while + * 19-3837; Rev 3; 10/11 has 0x5400. + * http://datasheets.maximintegrated.com/en/ds/MAX6604.pdf + */ + { 0x004d, 0x3e, "Maxim Integrated DIMM temperature sensor" }, + { 0x004d, 0x54, "Maxim Integrated DIMM temperature sensor" }, + + /* + * Microchip Technology MCP9805, MCP9843, MCP98242, MCP98243 + * and their variants. + * http://ww1.microchip.com/downloads/en/DeviceDoc/21977b.pdf + * Microchip Technology EMC1501. + * http://ww1.microchip.com/downloads/en/DeviceDoc/00001605A.pdf + */ + { 0x0054, 0x00, "Microchip DIMM temperature sensor" }, + { 0x0054, 0x20, "Microchip DIMM temperature sensor" }, + { 0x0054, 0x21, "Microchip DIMM temperature sensor" }, + { 0x1055, 0x08, "Microchip DIMM temperature sensor" }, + + /* + * NXP Semiconductors SE97 and SE98. + * http://www.nxp.com/docs/en/data-sheet/SE97B.pdf + */ + { 0x1131, 0xa1, "NXP DIMM temperature sensor" }, + { 0x1131, 0xa2, "NXP DIMM temperature sensor" }, + + /* + * ON Semiconductor CAT34TS02 revisions B and C, CAT6095 and compatible. + * https://www.onsemi.com/pub/Collateral/CAT34TS02-D.PDF + * http://www.onsemi.com/pub/Collateral/CAT6095-D.PDF + */ + { 0x1b09, 0x08, "ON Semiconductor DIMM temperature sensor" }, + { 0x1b09, 0x0a, "ON Semiconductor DIMM temperature sensor" }, + + /* + * ST[Microelectronics] STTS424E02, STTS2002 and others. + * http://www.st.com/resource/en/datasheet/cd00157558.pdf + * http://www.st.com/resource/en/datasheet/stts2002.pdf + */ + { 0x104a, 0x00, "ST DIMM temperature sensor" }, + { 0x104a, 0x03, "ST DIMM temperature sensor" }, +}; + +static const char * +ts_match_device(uint16_t vid, uint16_t did) +{ + const struct ts_dev *d; + int i; + + for (i = 0; i < nitems(known_devices); i++) { + d = &known_devices[i]; + if (vid == d->vendor_id && (did >> 8) == d->device_id) + return (d->description); + } + + /* + * If no match for a specific device, then check + * for a generic TSE2004av compliant device. + */ + if ((did >> 8) == 0x22) + return ("TSE2004av compliant DIMM temperature sensor"); + return (NULL); +} + +/* * SMBus specification defines little-endian byte order, * but it seems that the JEDEC devices expect it to * be big-endian. @@ -89,15 +199,7 @@ ts_temp_sysctl(SYSCTL_HANDLER_ARGS) static int ts_probe(device_t dev) { - device_set_desc(dev, "DIMM memory sensor"); - return (BUS_PROBE_DEFAULT); -} - -static int -ts_attach(device_t dev) -{ - struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *tree; + const char *match; int err; uint16_t vendorid; uint16_t devid; @@ -119,26 +221,9 @@ ts_attach(device_t dev) device_printf(dev, "failed to read Device ID\n"); return (ENXIO); } - if ((devid & 0xff00) == 0x2200) { - /* - * Defined by JEDEC Standard No. 21-C, Release 26, - * Page 4.1.6 – 24 - */ - } else if (vendorid == 0x104a) { - /* - * STMicroelectronics datasheets say that - * device ID and revision can vary. - * E.g. STT424E02, Doc ID 13448 Rev 8, - * section 4.6, page 26. - */ - } else if (vendorid == 0xb3 && (devid & 0xff00) == 0x2900) { - /* - * IDT TS3000B3A and TSE2002B3C chips and their variants. - * Revision IDs (the lower byte) can vary. - * http://www.idt.com/sites/default/files/documents/IDT_TSE2002B3C_DST_20100512_120303152056.pdf - * http://www.idt.com/sites/default/files/documents/IDT_TS3000B3A_DST_20101129_120303152013.pdf - */ - } else { + + match = ts_match_device(vendorid, devid); + if (match == NULL) { if (bootverbose) { device_printf(dev, "Unknown Manufacturer and Device IDs" ", 0x%x and 0x%x\n", vendorid, devid); @@ -146,9 +231,18 @@ ts_attach(device_t dev) return (ENXIO); } + device_set_desc(dev, match); + return (BUS_PROBE_DEFAULT); +} + +static int +ts_attach(device_t dev) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *tree; + ctx = device_get_sysctl_ctx(dev); tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); - SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "temp", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, ts_temp_sysctl, "IK4", "Current temperature"); From owner-svn-src-all@freebsd.org Wed Sep 13 13:35:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64881E2161E for ; Wed, 13 Sep 2017 13:35:48 +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 1D5FA64298 for ; Wed, 13 Sep 2017 13:35:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22b.google.com with SMTP id v36so2037092ioi.1 for ; Wed, 13 Sep 2017 06:35:48 -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=J2o5aTouM40P6HeIWrIZw/BbNHvkwtqzMmNCPbTNe2s=; b=XEgXJLlgiNYzNMnciNCT1vbKB1iymc9ZxwVN+J9ZnDmOwuI7uUFXWqd6U4NlJOu8bg lUfNIGUqf5NGr1rgoaSke3nuXDB1tmraVaiYLNyEyS9P5WmSg76uANG5YG9xHrFFdLCg ynCB0NPTfcC1wF7rhrpGMqggqixVjR9zAito6diSp/QBrESrrxxNxTGk2YeDWDMjOuEk 7eDQZg1COgu7zoOOTyqbjLklCmJuRN41ckMrC6XTzUbo4CUkfjIy4CfOGW26P1j3iP3U neqpj0av7VxqnCvXF6i3Z00gY3+iqXs4n4TrM4LX75qJHnUhQV8HeM3fqig1bF1u6BCY 4Iaw== 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=J2o5aTouM40P6HeIWrIZw/BbNHvkwtqzMmNCPbTNe2s=; b=LHT0ko40k36eGB3ZMCjkpLPaCjKsR+oVsmUK8iKBI6htereXWlB6Azbw4N+MyR1UX6 /7WBjq5bnkNCqtPH6RLbCvxksb3MK27I6bptPbvYtSub75kjaqIH2UVBSU4G7RRkUv5n AsS4t7ZhZtDldF5yFItzsIjfpXhk1F0OA0nM7SqU8f1r25oo5sit27nQi3iIT1A4AXJm bZkIkMX3lJhsvA2gUsYlqs9rRHp50rITb0VpKl7Bbzqrg1nCSu0vPUuRQD4t0ywOo/uL Pqzs/Y8sofZSGj045+KvCwsvcvdljxsC9GYdaP8HVt7IGVksNDJb/kVShfcJOxfd6XXA ypPA== X-Gm-Message-State: AHPjjUguOMIS+bAn8RPU+s3VIqlm70jWN2d69F1AKxBi/kAb2huwrhlF KccQRnYe8JX/MK+iFTg+iWK36ZQ0B2pTKjRhwKIwhA== X-Google-Smtp-Source: AOwi7QAPciKe5nHAPAHWXdSO3Mjr689ZuS+Sff7XPYCx5jfZBQfUpqUACtZW3IRP4SuuUE41kNjzqpIk14uomncAUPs= X-Received: by 10.107.41.138 with SMTP id p132mr28246254iop.282.1505309747324; Wed, 13 Sep 2017 06:35:47 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Wed, 13 Sep 2017 06:35:46 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <201709130711.v8D7BlTS003204@slippy.cwsent.com> References: <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com> <201709130711.v8D7BlTS003204@slippy.cwsent.com> From: Warner Losh Date: Wed, 13 Sep 2017 07:35:46 -0600 X-Google-Sender-Auth: w-uaXUmnjRPW_DfP7kGPZWz9UZ0 Message-ID: Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys To: Cy Schubert Cc: Ngie Cooper , Stephen Hurd , 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 13:35:48 -0000 On Wed, Sep 13, 2017 at 1:11 AM, Cy Schubert wrote: > In message <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com>, Ngie Cooper > writes > : > > > > > On Sep 12, 2017, at 18:18, Stephen Hurd wrote: > > > > > > Author: shurd > > > Date: Wed Sep 13 01:18:42 2017 > > > New Revision: 323516 > > > URL: https://svnweb.freebsd.org/changeset/base/323516 > > > > > > Log: > > > Roll up iflib commits from github. This pulls in most of the work > done > > > by Matt Macy as well as other changes which he has accepted via pull > > > request to his github repo at https://github.com/mattmacy/networking/ > > > > > > This should bring -CURRENT and the github repo into close enough sync > to > > > allow small feature branches rather than a large chain of > interdependant > > > patches being developed out of tree. The reset of the synchronization > > > should be able to be completed on github by splitting the remaining > > > changes that are not yet ready into short feature branches for later > > > review as smaller commits. > > > > > > Here is a summary of changes included in this patch: > > > > > > 1) More checks when INVARIANTS are enabled for eariler problem > > > detection > > > 2) Group Task Queue cleanups > > > - Fix use of duplicate shortdesc for gtaskqueue malloc type. > > > Some interfaces such as memguard(9) use the short description to > > > identify malloc types, so duplicates should be avoided. > > > 3) Allow gtaskqueues to use ithreads in addition to taskqueues > > > - In some cases, this can improve performance > > > 4) Better logging when taskqgroup_attach*() fails to set interrupt > > > affinity. > > > 5) Do not start gtaskqueues until they're needed > > > 6) Have mp_ring enqueue function enter the ABDICATED rather than BUSY > > > state. This moves the TX to the gtaskq and allows processing to > > > continue faster as well as make TX batching more likely. > > > 7) Add an ift_txd_errata function to struct if_txrx. This allows > > > drivers to inspect/modify mbufs before transmission. > > > 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need > > > checksums zeroed for checksum offload to work. This avoids > modifying > > > packet data in the TX path when possible. > > > 9) Use ithreads for iflib I/O instead of taskqueues > > > 10) Clean up ioctl and support async ioctl functions > > > 11) Prefetch two cachlines from each mbuf instead of one up to 128B. > We > > > often need to parse packet header info beyond 64B. > > > 12) Fix potential memory corruption due to fence post error in > > > bit_nclear() usage. > > > 13) Improved hang detection and handling > > > 14) If the packet is smaller than MTU, disable the TSO flags. > > > This avoids extra packet parsing when not needed. > > > 15) Move TCP header parsing inside the IS_TSO?() test. > > > This avoids extra packet parsing when not needed. > > > 16) Pass chains of mbufs that are not consumed by lro to if_input() > > > rather call if_input() for each mbuf. > > > 17) Re-arrange packet header loads to get as much work as possible > done > > > before a cache stall. > > > 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_ > POST()/ > > > IFDI_DETACH(); > > > 19) Attempt to distribute RX/TX tasks across cores more sensibly, > > > especially when RX and TX share an interrupt. RX will attempt to > > > take the first threads on a core, and TX will attempt to take > > > successive threads. > > > 20) Allow iflib_softirq_alloc_generic() to request affinity to the > same > > > cpus an interrupt has affinity with. This allows TX queues to > > > ensure they are serviced by the socket the device is on. > > > 21) Add new iflib sysctls to net.iflib: > > > - timer_int - interval at which to run per-queue timers in ticks > > > - force_busdma > > > 22) Add new per-device iflib sysctls to dev.X.Y.iflib > > > - rx_budget allows tuning the batch size on the RX path > > > - watchdog_events Count of watchdog events seen since load > > > 23) Fix error where netmap_rxq_init() could get called before > > > IFDI_INIT() > > > 24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY > > > when waiting for firmware > > > - After interrupts are enabled, convert all waits to sleeps > > > - Eliminates e1000 software/firmware synchronization busy waits > after > > > startup > > > 25) e1000: Remove special case for budget=1 in em_txrx.c > > > - Premature optimization which may actually be incorrect with > > > multi-segment packets > > > 26) e1000: Split out TX interrupt rather than share an interrupt for > > > RX and TX. > > > - Allows better performance by keeping RX and TX paths separate > > > 27) e1000: Separate igb from em code where suitable > > > Much easier to understand separate functions and "if (is_igb)" > than > > > previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | > E1000_ICR_LSC))" > > > > > > #blamebruno > > > > > > Reviewed by: sbruno > > > Approved by: sbruno (mentor) > > > Sponsored by: Limelight Networks > > > Differential Revision: https://reviews.freebsd.org/D12235 > > > > *gasps at the LoC count and number of changed drivers* > > > > Could someone please better break this up in the future..? > > Agreed. Down the road parsing out individual commits in this jumbo commit > will be difficult to parse. IMO this may as well have simply been, import > from https://github.com/mattmacy/networking/, just like Mr. Torvalds does > at kernel.org. I expect to see a commit like this there but not here. Can > we break this down to its functional commits? I use git + svn for other things. It should be possible to use that to push the changes in 'machine gun style' (meaning 27 changes pushed so fast they show up as 27 consecutive r numbers). I do change curation, etc with it so I get good sized commits. That's why you'll often see 10 or 20 commits from me show up in a matter of a couple of minutes. git svn dcommit is to blame, but so is about two dozen git rebases and other git crazy along the way. Something like that would be useful here. I'd be quite happy to walk people through my setup if it helps to reduce this. Warner From owner-svn-src-all@freebsd.org Wed Sep 13 13:37:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF929E2181E for ; Wed, 13 Sep 2017 13:37:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7333B646AA for ; Wed, 13 Sep 2017 13:37:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id d16so2006652ioj.3 for ; Wed, 13 Sep 2017 06:37:28 -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=xwkE1HCqesIfoA3YUf+FVseBKZ/naAEP4egx081xvCI=; b=saKCUB3xATgj9g4Y/t0RFaYKNaVrDkSWaCiB42etEylI8HsQlsoNDDPh1BGNKJolPd fc5QsSlI64se4k/Li90HaLjibtYEVcVnw1Cg3iAODKXW73uJ/e5U7QGvyTWFQo3rIPhN vt59CN6zOLju3y44fbq5buwjis7A9Z67eGL9Oq1MJd2F6MMLimFZ/zOJn/MgRPHHJjxO GsI3qVFtzwRzwJeike/CZ9uQuhxGv0IbW68YJnCUbbxa3ACqofF5r3sl0JCeIczyfJNR E3tpZ6fYQ84xAbxl33QzSY2yn8bfyM748N3GhvptyoYxeDDZRuzms2q1KEEnwddfzgm6 62ZA== 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=xwkE1HCqesIfoA3YUf+FVseBKZ/naAEP4egx081xvCI=; b=NWzAzwYoVivmBQ7rG6PUa3BVyBhA8Un3Yqhh4wyPVor/aELkrlLFAd16JYT0ytHGxg OOSoKzIJiTqmDRHzSP4CBvNyRgKDKeqw1HZe+Au4hcySuxk3AI4tRiJqCavp7x7Z//k5 6/maSefkCrJhPFgWq1TF6mEHoIs7gQIVN8ghodDP9xJCXSti2ojnpucMXxgDnJrPxvPB qDAbOBpYyfs2JOg2RGgywcTOY854l9ozwVWl//Lobw+HtD/MmBmyC46xyJRGgSbvAr/K uisi5s21GCK3/yxpw4K1CR0jvEvpMeyd4xkgCBiOJgTNTmhQ8JZLs3m4DEfZwp+FPFe4 4FQw== X-Gm-Message-State: AHPjjUizOg7lhZ/AVFM/+N+NSBKr8u0Zi5XlLxiKe1YBQbz0Wfo4aK2+ uXiGabRHdtgIv73PL9ORXkBk4n4YM9u16nP2h6AM7w== X-Google-Smtp-Source: ADKCNb67in5RcPyHXTPidGYChqocQzwdPeaSbZ9XFf9ABvlgk0I1GUJeJXksY43ah5GYyVw1F/846ld4RQRcjTq+CDw= X-Received: by 10.107.133.92 with SMTP id h89mr17805378iod.208.1505309847860; Wed, 13 Sep 2017 06:37:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Wed, 13 Sep 2017 06:37:27 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <20170913110423.01f16291@fabiankeil.de> References: <201709122346.v8CNkX6A092486@repo.freebsd.org> <20170913110423.01f16291@fabiankeil.de> From: Warner Losh Date: Wed, 13 Sep 2017 07:37:27 -0600 X-Google-Sender-Auth: BS5C86Br0SaL2jQ319jWR4sTSMc Message-ID: Subject: Re: svn commit: r323511 - head/sys/cam To: Fabian Keil Cc: Warner Losh , "svn-src-all@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 13:37:28 -0000 On Wed, Sep 13, 2017 at 3:04 AM, Fabian Keil wrote: > Warner Losh wrote: > > > Author: imp > > Date: Tue Sep 12 23:46:33 2017 > > New Revision: 323511 > > URL: https://svnweb.freebsd.org/changeset/base/323511 > > > > Log: > > cam iosched: Limit the quanta default to hz if it's below 200 > [...] > > PR: 221953 > > Obtained from: ElectroBSD > > Differential Revision: https://reviews.freebsd.org/D12337 > > Submitted by: Fabian Keil > > Do you intend to MFC this? If not, I'll close the PR. > Go ahead and close the PR. I'll MFC it when I get the latest round of changes to this and nda done. Warner From owner-svn-src-all@freebsd.org Wed Sep 13 13:45:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EDCCE21FC1; Wed, 13 Sep 2017 13:45:44 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F58264ECD; Wed, 13 Sep 2017 13:45:43 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id s7yvdXKsw8LPZs7yxdnq5K; Wed, 13 Sep 2017 07:45:36 -0600 X-Authority-Analysis: v=2.2 cv=e552ceh/ c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=2JCJgTwv5E4A:10 a=BWvPGDcYAAAA:8 a=pGLkceISAAAA:8 a=6I5d2MoRAAAA:8 a=NEAV23lmAAAA:8 a=VwQbUJbxAAAA:8 a=YxBL1-UpAAAA:8 a=HBCkU0zZyFK6ODIDm3oA:9 a=CjuIK1q_8ugA:10 a=pxhY87DP9d2VeQe4joPk:22 a=6kGIvZw6iX1k4Y-7sg4_:22 a=IjZwj45LgO3ly-622nXo:22 a=AjGcO6oz07-iQ99wixmX:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 9056C95; Wed, 13 Sep 2017 06:45:33 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v8DDjXH0033179; Wed, 13 Sep 2017 06:45:33 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201709131345.v8DDjXH0033179@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: Warner Losh cc: Cy Schubert , Ngie Cooper , Stephen Hurd , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys In-Reply-To: Message from Warner Losh of "Wed, 13 Sep 2017 07:35:46 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 13 Sep 2017 06:45:33 -0700 X-CMAE-Envelope: MS4wfHrw7V7GDNc5dw8eqepzpvNTFsl07OW7cKjNi4o2Gwz+9XZwxdDrfZh0HBF5/RQDJ0Pe08RgwCe3zfso1VUX/CpJfb+NWz6Gi8cjnXcBjztJNoDZyuHk JwEOMakXu9BjQnygZmFPuSQndpgpG3Y+DIDSMsTkk0MBwx3GKtuLB07LVjLWRk9nFD3Qtv1ZPC9ijg/n48hZnuUgLeaALY1mB84ViK7Hb2+hTRLKKLcXesgL YBs9SqgMUqx4Zc/Kq9EpeFA0gUobmFIuFNdDBKu1ql21ekJ+G7ZQSMR2xD1LW9tykOxi3a2CDIUYgtwvJqXvOhxz4cyAvCaJlj5eNcJ9oUs= X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 13:45:44 -0000 In message , Warner Losh writes: > --001a1141f15ac444250559123c56 > Content-Type: text/plain; charset="UTF-8" > > On Wed, Sep 13, 2017 at 1:11 AM, Cy Schubert > wrote: > > > In message <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com>, Ngie Cooper > > writes > > : > > > > > > > On Sep 12, 2017, at 18:18, Stephen Hurd wrote: > > > > > > > > Author: shurd > > > > Date: Wed Sep 13 01:18:42 2017 > > > > New Revision: 323516 > > > > URL: https://svnweb.freebsd.org/changeset/base/323516 > > > > > > > > Log: > > > > Roll up iflib commits from github. This pulls in most of the work > > done > > > > by Matt Macy as well as other changes which he has accepted via pull > > > > request to his github repo at https://github.com/mattmacy/networking/ > > > > > > > > This should bring -CURRENT and the github repo into close enough sync > > to > > > > allow small feature branches rather than a large chain of > > interdependant > > > > patches being developed out of tree. The reset of the synchronization > > > > should be able to be completed on github by splitting the remaining > > > > changes that are not yet ready into short feature branches for later > > > > review as smaller commits. > > > > > > > > Here is a summary of changes included in this patch: > > > > > > > > 1) More checks when INVARIANTS are enabled for eariler problem > > > > detection > > > > 2) Group Task Queue cleanups > > > > - Fix use of duplicate shortdesc for gtaskqueue malloc type. > > > > Some interfaces such as memguard(9) use the short description to > > > > identify malloc types, so duplicates should be avoided. > > > > 3) Allow gtaskqueues to use ithreads in addition to taskqueues > > > > - In some cases, this can improve performance > > > > 4) Better logging when taskqgroup_attach*() fails to set interrupt > > > > affinity. > > > > 5) Do not start gtaskqueues until they're needed > > > > 6) Have mp_ring enqueue function enter the ABDICATED rather than BUSY > > > > state. This moves the TX to the gtaskq and allows processing to > > > > continue faster as well as make TX batching more likely. > > > > 7) Add an ift_txd_errata function to struct if_txrx. This allows > > > > drivers to inspect/modify mbufs before transmission. > > > > 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need > > > > checksums zeroed for checksum offload to work. This avoids > > modifying > > > > packet data in the TX path when possible. > > > > 9) Use ithreads for iflib I/O instead of taskqueues > > > > 10) Clean up ioctl and support async ioctl functions > > > > 11) Prefetch two cachlines from each mbuf instead of one up to 128B. > > We > > > > often need to parse packet header info beyond 64B. > > > > 12) Fix potential memory corruption due to fence post error in > > > > bit_nclear() usage. > > > > 13) Improved hang detection and handling > > > > 14) If the packet is smaller than MTU, disable the TSO flags. > > > > This avoids extra packet parsing when not needed. > > > > 15) Move TCP header parsing inside the IS_TSO?() test. > > > > This avoids extra packet parsing when not needed. > > > > 16) Pass chains of mbufs that are not consumed by lro to if_input() > > > > rather call if_input() for each mbuf. > > > > 17) Re-arrange packet header loads to get as much work as possible > > done > > > > before a cache stall. > > > > 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_ > > POST()/ > > > > IFDI_DETACH(); > > > > 19) Attempt to distribute RX/TX tasks across cores more sensibly, > > > > especially when RX and TX share an interrupt. RX will attempt to > > > > take the first threads on a core, and TX will attempt to take > > > > successive threads. > > > > 20) Allow iflib_softirq_alloc_generic() to request affinity to the > > same > > > > cpus an interrupt has affinity with. This allows TX queues to > > > > ensure they are serviced by the socket the device is on. > > > > 21) Add new iflib sysctls to net.iflib: > > > > - timer_int - interval at which to run per-queue timers in ticks > > > > - force_busdma > > > > 22) Add new per-device iflib sysctls to dev.X.Y.iflib > > > > - rx_budget allows tuning the batch size on the RX path > > > > - watchdog_events Count of watchdog events seen since load > > > > 23) Fix error where netmap_rxq_init() could get called before > > > > IFDI_INIT() > > > > 24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY > > > > when waiting for firmware > > > > - After interrupts are enabled, convert all waits to sleeps > > > > - Eliminates e1000 software/firmware synchronization busy waits > > after > > > > startup > > > > 25) e1000: Remove special case for budget=1 in em_txrx.c > > > > - Premature optimization which may actually be incorrect with > > > > multi-segment packets > > > > 26) e1000: Split out TX interrupt rather than share an interrupt for > > > > RX and TX. > > > > - Allows better performance by keeping RX and TX paths separate > > > > 27) e1000: Separate igb from em code where suitable > > > > Much easier to understand separate functions and "if (is_igb)" > > than > > > > previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | > > E1000_ICR_LSC))" > > > > > > > > #blamebruno > > > > > > > > Reviewed by: sbruno > > > > Approved by: sbruno (mentor) > > > > Sponsored by: Limelight Networks > > > > Differential Revision: https://reviews.freebsd.org/D12235 > > > > > > *gasps at the LoC count and number of changed drivers* > > > > > > Could someone please better break this up in the future..? > > > > Agreed. Down the road parsing out individual commits in this jumbo commit > > will be difficult to parse. IMO this may as well have simply been, import > > from https://github.com/mattmacy/networking/, just like Mr. Torvalds does > > at kernel.org. I expect to see a commit like this there but not here. Can > > we break this down to its functional commits? > > > I use git + svn for other things. It should be possible to use that to push > the changes in 'machine gun style' (meaning 27 changes pushed so fast they > show up as 27 consecutive r numbers). I do change curation, etc with it so > I get good sized commits. That's why you'll often see 10 or 20 commits from > me show up in a matter of a couple of minutes. git svn dcommit is to blame, > but so is about two dozen git rebases and other git crazy along the way. > Something like that would be useful here. I'd be quite happy to walk people > through my setup if it helps to reduce this. I'm interested. -- 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-all@freebsd.org Wed Sep 13 14:27:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2D12E23AE4; Wed, 13 Sep 2017 14:27:14 +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 C1DB766BB9; Wed, 13 Sep 2017 14:27:14 +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 v8DERDrC056516; Wed, 13 Sep 2017 14:27:13 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DERD58056515; Wed, 13 Sep 2017 14:27:13 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709131427.v8DERD58056515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Wed, 13 Sep 2017 14:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323541 - 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: 323541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 14:27:15 -0000 Author: tsoome Date: Wed Sep 13 14:27:13 2017 New Revision: 323541 URL: https://svnweb.freebsd.org/changeset/base/323541 Log: libefi: efipart_realstrategy rsize pointer may be NULL Need to check rsize before dereferencing it. Modified: head/sys/boot/efi/libefi/efipart.c Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Wed Sep 13 13:03:29 2017 (r323540) +++ head/sys/boot/efi/libefi/efipart.c Wed Sep 13 14:27:13 2017 (r323541) @@ -924,7 +924,8 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl readstart = off / blkio->Media->BlockSize; if (diskend <= readstart) { - *rsize = 0; + if (rsize != NULL) + *rsize = 0; return (EIO); } From owner-svn-src-all@freebsd.org Wed Sep 13 14:30:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5BEDE23C7C; Wed, 13 Sep 2017 14:30:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ECE966E51; Wed, 13 Sep 2017 14:30:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DEUUu9056830; Wed, 13 Sep 2017 14:30:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DEUUb5056824; Wed, 13 Sep 2017 14:30:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709131430.v8DEUUb5056824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 13 Sep 2017 14:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323542 - in head/release: arm arm64 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head/release: arm arm64 X-SVN-Commit-Revision: 323542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 14:30:31 -0000 Author: gjb Date: Wed Sep 13 14:30:30 2017 New Revision: 323542 URL: https://svnweb.freebsd.org/changeset/base/323542 Log: Increase arm{,64} SoC image sizes to prevent "filesystem full" build failures. Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BEAGLEBONE.conf head/release/arm/CUBIEBOARD.conf head/release/arm/GUMSTIX.conf head/release/arm/PANDABOARD.conf head/release/arm/RPI-B.conf head/release/arm64/RPI3.conf Modified: head/release/arm/BEAGLEBONE.conf ============================================================================== --- head/release/arm/BEAGLEBONE.conf Wed Sep 13 14:27:13 2017 (r323541) +++ head/release/arm/BEAGLEBONE.conf Wed Sep 13 14:30:30 2017 (r323542) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-beaglebone" KERNEL="BEAGLEBONE" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="2m" FAT_TYPE="12" Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Wed Sep 13 14:27:13 2017 (r323541) +++ head/release/arm/CUBIEBOARD.conf Wed Sep 13 14:30:30 2017 (r323542) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-cubieboard" KERNEL="ALLWINNER_UP" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="32m -b 1m" FAT_TYPE="16" Modified: head/release/arm/GUMSTIX.conf ============================================================================== --- head/release/arm/GUMSTIX.conf Wed Sep 13 14:27:13 2017 (r323541) +++ head/release/arm/GUMSTIX.conf Wed Sep 13 14:30:30 2017 (r323542) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-duovero" KERNEL="GUMSTIX" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="2m" FAT_TYPE="12" Modified: head/release/arm/PANDABOARD.conf ============================================================================== --- head/release/arm/PANDABOARD.conf Wed Sep 13 14:27:13 2017 (r323541) +++ head/release/arm/PANDABOARD.conf Wed Sep 13 14:30:30 2017 (r323542) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-pandaboard" KERNEL="PANDABOARD" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="2m" FAT_TYPE="12" Modified: head/release/arm/RPI-B.conf ============================================================================== --- head/release/arm/RPI-B.conf Wed Sep 13 14:27:13 2017 (r323541) +++ head/release/arm/RPI-B.conf Wed Sep 13 14:30:30 2017 (r323542) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-rpi" KERNEL="RPI-B" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="1536M" PART_SCHEME="MBR" FAT_SIZE="17m" FAT_TYPE="16" Modified: head/release/arm64/RPI3.conf ============================================================================== --- head/release/arm64/RPI3.conf Wed Sep 13 14:27:13 2017 (r323541) +++ head/release/arm64/RPI3.conf Wed Sep 13 14:30:30 2017 (r323542) @@ -10,7 +10,7 @@ EMBEDDED_TARGET_ARCH="aarch64" EMBEDDEDPORTS="sysutils/u-boot-rpi3 security/ca_root_nss" KERNEL="GENERIC" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" -IMAGE_SIZE="2G" +IMAGE_SIZE="2560M" PART_SCHEME="MBR" FAT_SIZE="50m -b 1m" FAT_TYPE="16" From owner-svn-src-all@freebsd.org Wed Sep 13 14:44:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8672E246B7; Wed, 13 Sep 2017 14:44:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (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 865DC67891; Wed, 13 Sep 2017 14:44:07 +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 38DE910A7B9; Wed, 13 Sep 2017 10:44:06 -0400 (EDT) From: John Baldwin To: Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323518 - head/sys/conf Date: Wed, 13 Sep 2017 07:35:45 -0700 Message-ID: <9497208.8lqLTVLir6@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201709130356.v8D3u4ve095428@repo.freebsd.org> References: <201709130356.v8D3u4ve095428@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 13 Sep 2017 10:44:06 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 14:44:08 -0000 On Wednesday, September 13, 2017 03:56:04 AM Sean Bruno wrote: > Author: sbruno > Date: Wed Sep 13 03:56:03 2017 > New Revision: 323518 > URL: https://svnweb.freebsd.org/changeset/base/323518 > > Log: > Jenkins i386 LINT build uses NOTES to generate its LINT kernel config. > > ixl(4) isn't in here either, so I'll remove lio(4) too. ixl missing is a bug, please put it in sys/amd64/conf/NOTES (or better yet, just fix the build on !amd64) -- John Baldwin From owner-svn-src-all@freebsd.org Wed Sep 13 15:09:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDEE0E0069D; Wed, 13 Sep 2017 15:09:45 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABB1268960; Wed, 13 Sep 2017 15:09:45 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-215-166.albq.qwest.net [67.0.215.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 82EF6192892; Wed, 13 Sep 2017 15:09:42 +0000 (UTC) Subject: Re: svn commit: r323518 - head/sys/conf To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709130356.v8D3u4ve095428@repo.freebsd.org> <9497208.8lqLTVLir6@ralph.baldwin.cx> From: Sean Bruno Message-ID: Date: Wed, 13 Sep 2017 09:09:42 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <9497208.8lqLTVLir6@ralph.baldwin.cx> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Ds1fvJegLutcNiTU8WEWQ7OXvhJSpqf5b" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 15:09:45 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ds1fvJegLutcNiTU8WEWQ7OXvhJSpqf5b Content-Type: multipart/mixed; boundary="T63TJMWNOokQmlvXAtSxucm6Cn5TduO8M"; protected-headers="v1" From: Sean Bruno To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r323518 - head/sys/conf References: <201709130356.v8D3u4ve095428@repo.freebsd.org> <9497208.8lqLTVLir6@ralph.baldwin.cx> In-Reply-To: <9497208.8lqLTVLir6@ralph.baldwin.cx> --T63TJMWNOokQmlvXAtSxucm6Cn5TduO8M Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 09/13/17 08:35, John Baldwin wrote: > On Wednesday, September 13, 2017 03:56:04 AM Sean Bruno wrote: >> Author: sbruno >> Date: Wed Sep 13 03:56:03 2017 >> New Revision: 323518 >> URL: https://svnweb.freebsd.org/changeset/base/323518 >> >> Log: >> Jenkins i386 LINT build uses NOTES to generate its LINT kernel confi= g. >> =20 >> ixl(4) isn't in here either, so I'll remove lio(4) too. >=20 > ixl missing is a bug, please put it in sys/amd64/conf/NOTES (or better = yet, > just fix the build on !amd64) >=20 In the case of lio(4), Cavium is explicitly not compiling for 32 bit architectures. I'm inquiring to find out if they want to build on the other 64bit architectures we have. In the case of ixl(4), Intel has said that this is not supported on 32bit architectures. I'm unsure what the best course of action is. sean --T63TJMWNOokQmlvXAtSxucm6Cn5TduO8M-- --Ds1fvJegLutcNiTU8WEWQ7OXvhJSpqf5b Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAlm5SjZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LaOmwf8CS0iCKyRR2XEWZiyz4dS0//cWcHMlvAMEr1UNyuHTwniJmSV102znVi3 jCqkSgfYCXztoqGjQ83ZpxJhz8G+io69ZhBMwO82H4qJFoWi2pHun3dwlHo5jSkO omxbR6kxUOB5JKWs79S8PVfsA+Y6Qc3JXBUIBrfoEvOjecQdZpTAzDsBoFNLERtc 4cSqm+pIuz260ThJjXh2w6tInX1TqCxqg1/i5mXWmhTRDoXVeiDHK10zn8Hptz4J td1Mrn9Mc1L0viag+Hs8a/I2GkkvN2tM1DTezG0QOWqI9cU4wndL+llggsFdbmt/ ETNZk1B9N4sGiB/7qidTamWwXtYKcA== =P5/g -----END PGP SIGNATURE----- --Ds1fvJegLutcNiTU8WEWQ7OXvhJSpqf5b-- From owner-svn-src-all@freebsd.org Wed Sep 13 15:12:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F943E00A7C; Wed, 13 Sep 2017 15:12:52 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BED569438; Wed, 13 Sep 2017 15:12:51 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-215-166.albq.qwest.net [67.0.215.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 076C6192892; Wed, 13 Sep 2017 15:12:49 +0000 (UTC) Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys To: Cy Schubert , Ngie Cooper Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> From: Sean Bruno Message-ID: <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> Date: Wed, 13 Sep 2017 09:12:50 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <201709130711.v8D7BlTS003204@slippy.cwsent.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="K3RXSO7fXoxBXqJUE1dpQ1sEQkuJPg1DQ" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 15:12:52 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --K3RXSO7fXoxBXqJUE1dpQ1sEQkuJPg1DQ Content-Type: multipart/mixed; boundary="lalB5jI6dIhQxjTp1UFWH9Jx4OpW69Pfe"; protected-headers="v1" From: Sean Bruno To: Cy Schubert , Ngie Cooper Cc: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> In-Reply-To: <201709130711.v8D7BlTS003204@slippy.cwsent.com> --lalB5jI6dIhQxjTp1UFWH9Jx4OpW69Pfe Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable >>> #blamebruno >>> >>> Reviewed by: sbruno >>> Approved by: sbruno (mentor) >>> Sponsored by: Limelight Networks >>> Differential Revision: https://reviews.freebsd.org/D12235 >> >> *gasps at the LoC count and number of changed drivers* >> >> Could someone please better break this up in the future..? >=20 > Agreed. Down the road parsing out individual commits in this jumbo comm= it=20 > will be difficult to parse. IMO this may as well have simply been, impo= rt=20 > from https://github.com/mattmacy/networking/, just like Mr. Torvalds do= es=20 > at kernel.org. I expect to see a commit like this there but not here. C= an=20 > we break this down to its functional commits? >=20 >=20 This ridiculous loc was due to the amount of restructuring needed to get us back to being in sync with our development. The future will not have this big of a commit/change and should be more bite/fun sized. The #blamebruno tag in the commit log was to indicate that this was not something Stephen was doing on his own, but was something that I had induced over the last few months during testing. sean --lalB5jI6dIhQxjTp1UFWH9Jx4OpW69Pfe-- --K3RXSO7fXoxBXqJUE1dpQ1sEQkuJPg1DQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAlm5SvJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LZpuwgAy8yZrzJL2sIlt5KN4zKPB3u6sIrdULD0DuYjuG8kV0sZD/jGj0xBsHtM 9KGbkrWVTAfzUQFlXCc+8oi4a4FZBHnD0wubt0t5K++hE+HtkdZIbkF86OUNbrHj i/3x1y1ZgyMsXvlHZA1MMLXTmAIrpxcz0FO37lx4JsM1TLlLGD+ME8pLNHw8ylRL xXfOwle8HMazso8V1Fwtn5zWuV6WOOS5aJFUwXceWMzBbdroA68OJNCzF/Pw2Sxh Un18XphIQ7XHtfipTWpmTlcagws2NA2nZuMh2RZs7DvwNUaJFOze2fcZNJ4qnnLC dnjFpwOknQ/DzBXMexP02PNR7AIbNw== =ACW6 -----END PGP SIGNATURE----- --K3RXSO7fXoxBXqJUE1dpQ1sEQkuJPg1DQ-- From owner-svn-src-all@freebsd.org Wed Sep 13 15:17:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11C21E00C92; Wed, 13 Sep 2017 15:17:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF9C16960A; Wed, 13 Sep 2017 15:17:36 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DFHZCD077693; Wed, 13 Sep 2017 15:17:35 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DFHZI9077692; Wed, 13 Sep 2017 15:17:35 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201709131517.v8DFHZI9077692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 13 Sep 2017 15:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323543 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 323543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 15:17:37 -0000 Author: sbruno Date: Wed Sep 13 15:17:35 2017 New Revision: 323543 URL: https://svnweb.freebsd.org/changeset/base/323543 Log: Don't (try to) build lio(4) if the SOURCELESS_UCODE is set. Submitted by: Fabien Keil Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Wed Sep 13 14:30:30 2017 (r323542) +++ head/sys/modules/Makefile Wed Sep 13 15:17:35 2017 (r323543) @@ -711,7 +711,9 @@ _ixl= ixl _ixlv= ixlv _linux64= linux64 _linux_common= linux_common +.if ${MK_SOURCELESS_UCODE} != "no" _lio= lio +.endif _ntb= ntb _pms= pms _qlxge= qlxge From owner-svn-src-all@freebsd.org Wed Sep 13 15:44:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 098E0E01DF7; Wed, 13 Sep 2017 15:44:56 +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 C7EAD6A620; Wed, 13 Sep 2017 15:44:55 +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 v8DFishU089915; Wed, 13 Sep 2017 15:44:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DFispa089913; Wed, 13 Sep 2017 15:44:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709131544.v8DFispa089913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 13 Sep 2017 15:44:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323544 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 15:44:56 -0000 Author: markj Date: Wed Sep 13 15:44:54 2017 New Revision: 323544 URL: https://svnweb.freebsd.org/changeset/base/323544 Log: Fix a logic error in the item size calculation for internal UMA zones. Kegs for internal zones always keep the slab header in the slab itself. Therefore, when determining the allocation size, we need to take the slab header size into account. Reported and tested by: ae, rakuco Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12342 Modified: head/sys/vm/uma_core.c head/sys/vm/vm_page.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Sep 13 15:17:35 2017 (r323543) +++ head/sys/vm/uma_core.c Wed Sep 13 15:44:54 2017 (r323544) @@ -1306,10 +1306,6 @@ keg_large_init(uma_keg_t keg) keg->uk_ipers = 1; keg->uk_rsize = keg->uk_size; - /* We can't do OFFPAGE if we're internal, bail out here. */ - if (keg->uk_flags & UMA_ZFLAG_INTERNAL) - return; - /* Check whether we have enough space to not do OFFPAGE. */ if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0) { shsize = sizeof(struct uma_slab); @@ -1317,8 +1313,17 @@ keg_large_init(uma_keg_t keg) shsize = (shsize & ~UMA_ALIGN_PTR) + (UMA_ALIGN_PTR + 1); - if ((PAGE_SIZE * keg->uk_ppera) - keg->uk_rsize < shsize) - keg->uk_flags |= UMA_ZONE_OFFPAGE; + if (PAGE_SIZE * keg->uk_ppera - keg->uk_rsize < shsize) { + /* + * We can't do OFFPAGE if we're internal, in which case + * we need an extra page per allocation to contain the + * slab header. + */ + if ((keg->uk_flags & UMA_ZFLAG_INTERNAL) == 0) + keg->uk_flags |= UMA_ZONE_OFFPAGE; + else + keg->uk_ppera++; + } } if ((keg->uk_flags & UMA_ZONE_OFFPAGE) && Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Sep 13 15:17:35 2017 (r323543) +++ head/sys/vm/vm_page.c Wed Sep 13 15:44:54 2017 (r323544) @@ -473,7 +473,8 @@ vm_page_startup(vm_offset_t vaddr) * in proportion to the zone structure size. */ pages_per_zone = howmany(sizeof(struct uma_zone) + - sizeof(struct uma_cache) * (mp_maxid + 1), UMA_SLAB_SIZE); + sizeof(struct uma_cache) * (mp_maxid + 1) + + roundup2(sizeof(struct uma_slab), sizeof(void *)), UMA_SLAB_SIZE); if (pages_per_zone > 1) { /* Reserve more pages so that we don't run out. */ boot_pages = UMA_BOOT_PAGES_ZONES * pages_per_zone; From owner-svn-src-all@freebsd.org Wed Sep 13 15:58:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5542FE02A29; Wed, 13 Sep 2017 15:58:00 +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 0940B6B095; Wed, 13 Sep 2017 15:57:59 +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 v8DFvxGF094069; Wed, 13 Sep 2017 15:57:59 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DFvwXv094063; Wed, 13 Sep 2017 15:57:58 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201709131557.v8DFvwXv094063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 13 Sep 2017 15:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323545 - in vendor/NetBSD/libedit/dist: . TEST readline X-SVN-Group: vendor X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in vendor/NetBSD/libedit/dist: . TEST readline X-SVN-Commit-Revision: 323545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 15:58:00 -0000 Author: pfg Date: Wed Sep 13 15:57:58 2017 New Revision: 323545 URL: https://svnweb.freebsd.org/changeset/base/323545 Log: Import libedit 2017-09-05 Obtained from: NetBSD Added: vendor/NetBSD/libedit/dist/editline.7 (contents, props changed) vendor/NetBSD/libedit/dist/historyn.c (contents, props changed) vendor/NetBSD/libedit/dist/literal.c (contents, props changed) vendor/NetBSD/libedit/dist/literal.h (contents, props changed) vendor/NetBSD/libedit/dist/tokenizern.c (contents, props changed) Modified: vendor/NetBSD/libedit/dist/Makefile vendor/NetBSD/libedit/dist/TEST/Makefile vendor/NetBSD/libedit/dist/chared.c vendor/NetBSD/libedit/dist/chared.h vendor/NetBSD/libedit/dist/chartype.c vendor/NetBSD/libedit/dist/chartype.h vendor/NetBSD/libedit/dist/common.c vendor/NetBSD/libedit/dist/config.h vendor/NetBSD/libedit/dist/editline.3 vendor/NetBSD/libedit/dist/editrc.5 vendor/NetBSD/libedit/dist/el.c vendor/NetBSD/libedit/dist/el.h vendor/NetBSD/libedit/dist/eln.c vendor/NetBSD/libedit/dist/emacs.c vendor/NetBSD/libedit/dist/filecomplete.c vendor/NetBSD/libedit/dist/filecomplete.h vendor/NetBSD/libedit/dist/hist.c vendor/NetBSD/libedit/dist/hist.h vendor/NetBSD/libedit/dist/histedit.h vendor/NetBSD/libedit/dist/history.c vendor/NetBSD/libedit/dist/keymacro.c vendor/NetBSD/libedit/dist/keymacro.h vendor/NetBSD/libedit/dist/makelist vendor/NetBSD/libedit/dist/map.c vendor/NetBSD/libedit/dist/map.h vendor/NetBSD/libedit/dist/parse.c vendor/NetBSD/libedit/dist/parse.h vendor/NetBSD/libedit/dist/prompt.c vendor/NetBSD/libedit/dist/prompt.h vendor/NetBSD/libedit/dist/read.c vendor/NetBSD/libedit/dist/read.h vendor/NetBSD/libedit/dist/readline.c vendor/NetBSD/libedit/dist/readline/readline.h vendor/NetBSD/libedit/dist/refresh.c vendor/NetBSD/libedit/dist/refresh.h vendor/NetBSD/libedit/dist/search.c vendor/NetBSD/libedit/dist/search.h vendor/NetBSD/libedit/dist/sig.c vendor/NetBSD/libedit/dist/sig.h vendor/NetBSD/libedit/dist/sys.h vendor/NetBSD/libedit/dist/terminal.c vendor/NetBSD/libedit/dist/terminal.h vendor/NetBSD/libedit/dist/tokenizer.c vendor/NetBSD/libedit/dist/tty.c vendor/NetBSD/libedit/dist/tty.h vendor/NetBSD/libedit/dist/vi.c Modified: vendor/NetBSD/libedit/dist/Makefile ============================================================================== --- vendor/NetBSD/libedit/dist/Makefile Wed Sep 13 15:44:54 2017 (r323544) +++ vendor/NetBSD/libedit/dist/Makefile Wed Sep 13 15:57:58 2017 (r323545) @@ -1,9 +1,8 @@ -# $NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $ +# $NetBSD: Makefile,v 1.65 2017/06/30 20:26:52 kre Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes -WIDECHAR ?= yes WARNS?= 5 LIB= edit @@ -15,55 +14,80 @@ COPTS+= -Wunused-parameter CWARNFLAGS.gcc+= -Wconversion CWARNFLAGS.clang+= -Wno-cast-qual -OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \ - hist.c keymacro.c map.c chartype.c \ - parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c +SRCS = chared.c chartype.c common.c el.c eln.c emacs.c filecomplete.c \ + hist.c history.c historyn.c keymacro.c literal.c map.c \ + parse.c prompt.c read.c readline.c refresh.c search.c sig.c \ + terminal.c tokenizer.c tokenizern.c tty.c vi.c -MAN= editline.3 editrc.5 +MAN= editline.3 editrc.5 editline.7 -MLINKS= editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \ - editline.3 el_gets.3 editline.3 el_getc.3 editline.3 el_push.3 \ - editline.3 el_parse.3 editline.3 el_set.3 editline.3 el_get.3 \ - editline.3 el_source.3 editline.3 el_resize.3 editline.3 el_line.3 \ - editline.3 el_insertstr.3 editline.3 el_deletestr.3 \ - editline.3 history_init.3 editline.3 history_end.3 \ - editline.3 history.3 \ - editline.3 tok_init.3 editline.3 tok_end.3 editline.3 tok_reset.3 \ - editline.3 tok_line.3 editline.3 tok_str.3 +MLINKS= \ +editline.3 el_deletestr.3 \ +editline.3 el_end.3 \ +editline.3 el_get.3 \ +editline.3 el_getc.3 \ +editline.3 el_gets.3 \ +editline.3 el_init.3 \ +editline.3 el_init_fd.3 \ +editline.3 el_insertstr.3 \ +editline.3 el_line.3 \ +editline.3 el_parse.3 \ +editline.3 el_push.3 \ +editline.3 el_reset.3 \ +editline.3 el_resize.3 \ +editline.3 el_set.3 \ +editline.3 el_source.3 \ +editline.3 history.3 \ +editline.3 history_end.3 \ +editline.3 history_init.3 \ +editline.3 tok_end.3 \ +editline.3 tok_init.3 \ +editline.3 tok_line.3 \ +editline.3 tok_reset.3 \ +editline.3 tok_str.3 -# For speed and debugging -#SRCS= ${OSRCS} readline.c tokenizer.c history.c -# For protection -SRCS= editline.c readline.c tokenizer.c history.c +MLINKS+= \ +editline.3 el_wdeletestr.3 \ +editline.3 el_wget.3 \ +editline.3 el_wgetc.3 \ +editline.3 el_wgets.3 \ +editline.3 el_winsertstr.3 \ +editline.3 el_wline.3 \ +editline.3 el_wparse.3 \ +editline.3 el_wpush.3 \ +editline.3 el_wset.3 \ +editline.3 history_w.3 \ +editline.3 history_wend.3 \ +editline.3 history_winit.3 \ +editline.3 tok_wend.3 \ +editline.3 tok_winit.3 \ +editline.3 tok_wline.3 \ +editline.3 tok_wreset.3 \ +editline.3 tok_wstr.3 -.if ${WIDECHAR} == "yes" -SRCS += tokenizern.c historyn.c -CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c -CPPFLAGS+=-DWIDECHAR -.endif - LIBEDITDIR?=${.CURDIR} INCS= histedit.h INCSDIR=/usr/include -CLEANFILES+=editline.c -CLEANFILES+=common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp -CLEANFILES+=help.c.tmp help.h.tmp vi.h.tmp tc1.o tc1 -CLEANFILES+=tokenizern.c.tmp tokenizern.c tokenizerw.c.tmp tokenizerw.c +CLEANFILES+=common.h.tmp emacs.h.tmp fcns.h.tmp func.h.tmp +CLEANFILES+=help.h.tmp vi.h.tmp tc1.o tc1 .depend + CPPFLAGS+=-I. -I${LIBEDITDIR} CPPFLAGS+=-I. -I${.CURDIR} -#CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH +#CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG -DDEBUG_REFRESH #CPPFLAGS+=-DDEBUG_PASTE -DDEBUG_EDIT AHDR=vi.h emacs.h common.h ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c -DPSRCS+= ${AHDR} fcns.h help.h fcns.c help.c -CLEANFILES+= ${AHDR} fcns.h help.h fcns.c help.c +DPSRCS+= ${AHDR} fcns.h func.h help.h +CLEANFILES+= ${AHDR} fcns.h func.h help.h SUBDIR= readline +.depend: ${AHDR} fcns.h func.h help.h + vi.h: vi.c makelist Makefile ${_MKTARGET_CREATE} ${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/vi.c \ @@ -87,36 +111,16 @@ fcns.h: ${AHDR} makelist Makefile ${HOST_SH} ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \ mv ${.TARGET}.tmp ${.TARGET} -fcns.c: ${AHDR} fcns.h help.h makelist Makefile +func.h: ${AHDR} makelist Makefile ${_MKTARGET_CREATE} ${HOST_SH} ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \ mv ${.TARGET}.tmp ${.TARGET} -help.c: ${ASRC} makelist Makefile - ${_MKTARGET_CREATE} - ${HOST_SH} ${LIBEDITDIR}/makelist -bc ${ASRC} > ${.TARGET}.tmp && \ - mv ${.TARGET}.tmp ${.TARGET} - help.h: ${ASRC} makelist Makefile ${_MKTARGET_CREATE} ${HOST_SH} ${LIBEDITDIR}/makelist -bh ${ASRC} > ${.TARGET}.tmp && \ mv ${.TARGET}.tmp ${.TARGET} -editline.c: ${OSRCS} makelist Makefile - ${_MKTARGET_CREATE} - ${HOST_SH} ${LIBEDITDIR}/makelist -e ${OSRCS:T} > ${.TARGET}.tmp && \ - mv ${.TARGET}.tmp ${.TARGET} - -tokenizern.c: makelist Makefile - ${_MKTARGET_CREATE} - ${HOST_SH} ${LIBEDITDIR}/makelist -n tokenizer.c > ${.TARGET}.tmp && \ - mv ${.TARGET}.tmp ${.TARGET} - -historyn.c: makelist Makefile - ${_MKTARGET_CREATE} - ${HOST_SH} ${LIBEDITDIR}/makelist -n history.c > ${.TARGET}.tmp && \ - mv ${.TARGET}.tmp ${.TARGET} - tc1.o: ${LIBEDITDIR}/TEST/tc1.c tc1: libedit.a tc1.o @@ -129,6 +133,7 @@ tc1: libedit.a tc1.o # XXX .if defined(HAVE_GCC) COPTS.editline.c+= -Wno-cast-qual +COPTS.literal.c+= -Wno-sign-conversion COPTS.tokenizer.c+= -Wno-cast-qual COPTS.tokenizern.c+= -Wno-cast-qual .endif Modified: vendor/NetBSD/libedit/dist/TEST/Makefile ============================================================================== --- vendor/NetBSD/libedit/dist/TEST/Makefile Wed Sep 13 15:44:54 2017 (r323544) +++ vendor/NetBSD/libedit/dist/TEST/Makefile Wed Sep 13 15:57:58 2017 (r323545) @@ -1,16 +1,10 @@ -# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $ +# $NetBSD: Makefile,v 1.7 2016/03/23 22:27:48 christos Exp $ -WIDECHAR ?= yes - NOMAN=1 PROG=wtc1 CPPFLAGS=-I${.CURDIR}/.. LDADD+=-ledit -ltermlib DPADD+=${LIBEDIT} ${LIBTERMLIB} - -.if "${WIDECHAR}" == "yes" -CPPFLAGS+=-DWIDECHAR -.endif .ifdef DEBUG CPPFLAGS+=-DDEBUG Modified: vendor/NetBSD/libedit/dist/chared.c ============================================================================== --- vendor/NetBSD/libedit/dist/chared.c Wed Sep 13 15:44:54 2017 (r323544) +++ vendor/NetBSD/libedit/dist/chared.c Wed Sep 13 15:57:58 2017 (r323545) @@ -1,4 +1,4 @@ -/* $NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 christos Exp $ */ +/* $NetBSD: chared.c,v 1.56 2016/05/22 19:44:26 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 christos Exp $"); +__RCSID("$NetBSD: chared.c,v 1.56 2016/05/22 19:44:26 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -50,16 +50,15 @@ __RCSID("$NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 #include "el.h" #include "common.h" +#include "fcns.h" -private void ch__clearmacro (EditLine *); - /* value to leave unused in line buffer */ #define EL_LEAVE 2 /* cv_undo(): * Handle state for the vi undo command */ -protected void +libedit_private void cv_undo(EditLine *el) { c_undo_t *vu = &el->el_chared.c_undo; @@ -83,8 +82,8 @@ cv_undo(EditLine *el) /* cv_yank(): * Save yank/delete data for paste */ -protected void -cv_yank(EditLine *el, const Char *ptr, int size) +libedit_private void +cv_yank(EditLine *el, const wchar_t *ptr, int size) { c_kill_t *k = &el->el_chared.c_kill; @@ -96,10 +95,10 @@ cv_yank(EditLine *el, const Char *ptr, int size) /* c_insert(): * Insert num characters */ -protected void +libedit_private void c_insert(EditLine *el, int num) { - Char *cp; + wchar_t *cp; if (el->el_line.lastchar + num >= el->el_line.limit) { if (!ch_enlargebufs(el, (size_t)num)) @@ -118,7 +117,7 @@ c_insert(EditLine *el, int num) /* c_delafter(): * Delete num characters after the cursor */ -protected void +libedit_private void c_delafter(EditLine *el, int num) { @@ -131,7 +130,7 @@ c_delafter(EditLine *el, int num) } if (num > 0) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[num]; @@ -144,10 +143,10 @@ c_delafter(EditLine *el, int num) /* c_delafter1(): * Delete the character after the cursor, do not yank */ -protected void +libedit_private void c_delafter1(EditLine *el) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; @@ -159,7 +158,7 @@ c_delafter1(EditLine *el) /* c_delbefore(): * Delete num characters before the cursor */ -protected void +libedit_private void c_delbefore(EditLine *el, int num) { @@ -172,7 +171,7 @@ c_delbefore(EditLine *el, int num) } if (num > 0) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor - num; cp <= el->el_line.lastchar; @@ -187,10 +186,10 @@ c_delbefore(EditLine *el, int num) /* c_delbefore1(): * Delete the character before the cursor, do not yank */ -protected void +libedit_private void c_delbefore1(EditLine *el) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; @@ -202,22 +201,22 @@ c_delbefore1(EditLine *el) /* ce__isword(): * Return if p is part of a word according to emacs */ -protected int +libedit_private int ce__isword(wint_t p) { - return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL; + return iswalnum(p) || wcschr(L"*?_-.[]~=", p) != NULL; } /* cv__isword(): * Return if p is part of a word according to vi */ -protected int +libedit_private int cv__isword(wint_t p) { - if (Isalnum(p) || p == '_') + if (iswalnum(p) || p == L'_') return 1; - if (Isgraph(p)) + if (iswgraph(p)) return 2; return 0; } @@ -226,18 +225,18 @@ cv__isword(wint_t p) /* cv__isWord(): * Return if p is part of a big word according to vi */ -protected int +libedit_private int cv__isWord(wint_t p) { - return !Isspace(p); + return !iswspace(p); } /* c__prev_word(): * Find the previous word */ -protected Char * -c__prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t)) +libedit_private wchar_t * +c__prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t)) { p--; @@ -260,8 +259,8 @@ c__prev_word(Char *p, Char *low, int n, int (*wtest)(w /* c__next_word(): * Find the next word */ -protected Char * -c__next_word(Char *p, Char *high, int n, int (*wtest)(wint_t)) +libedit_private wchar_t * +c__next_word(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) { while (n--) { while ((p < high) && !(*wtest)(*p)) @@ -278,8 +277,9 @@ c__next_word(Char *p, Char *high, int n, int (*wtest)( /* cv_next_word(): * Find the next word vi style */ -protected Char * -cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(wint_t)) +libedit_private wchar_t * +cv_next_word(EditLine *el, wchar_t *p, wchar_t *high, int n, + int (*wtest)(wint_t)) { int test; @@ -292,7 +292,7 @@ cv_next_word(EditLine *el, Char *p, Char *high, int n, * trailing whitespace! This is not what 'w' does.. */ if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT)) - while ((p < high) && Isspace(*p)) + while ((p < high) && iswspace(*p)) p++; } @@ -307,14 +307,14 @@ cv_next_word(EditLine *el, Char *p, Char *high, int n, /* cv_prev_word(): * Find the previous word vi style */ -protected Char * -cv_prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t)) +libedit_private wchar_t * +cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t)) { int test; p--; while (n--) { - while ((p > low) && Isspace(*p)) + while ((p > low) && iswspace(*p)) p--; test = (*wtest)(*p); while ((p >= low) && (*wtest)(*p) == test) @@ -333,7 +333,7 @@ cv_prev_word(Char *p, Char *low, int n, int (*wtest)(w /* cv_delfini(): * Finish vi delete action */ -protected void +libedit_private void cv_delfini(EditLine *el) { int size; @@ -371,15 +371,15 @@ cv_delfini(EditLine *el) /* cv__endword(): * Go to the end of this word according to vi */ -protected Char * -cv__endword(Char *p, Char *high, int n, int (*wtest)(wint_t)) +libedit_private wchar_t * +cv__endword(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) { int test; p++; while (n--) { - while ((p < high) && Isspace(*p)) + while ((p < high) && iswspace(*p)) p++; test = (*wtest)(*p); @@ -393,11 +393,9 @@ cv__endword(Char *p, Char *high, int n, int (*wtest)(w /* ch_init(): * Initialize the character editor */ -protected int +libedit_private int ch_init(EditLine *el) { - c_macro_t *ma = &el->el_chared.c_macro; - el->el_line.buffer = el_malloc(EL_BUFSIZ * sizeof(*el->el_line.buffer)); if (el->el_line.buffer == NULL) @@ -449,19 +447,14 @@ ch_init(EditLine *el) el->el_state.argument = 1; el->el_state.lastcmd = ED_UNASSIGNED; - ma->level = -1; - ma->offset = 0; - ma->macro = el_malloc(EL_MAXMACRO * sizeof(*ma->macro)); - if (ma->macro == NULL) - return -1; return 0; } /* ch_reset(): * Reset the character editor */ -protected void -ch_reset(EditLine *el, int mclear) +libedit_private void +ch_reset(EditLine *el) { el->el_line.cursor = el->el_line.buffer; el->el_line.lastchar = el->el_line.buffer; @@ -483,28 +476,17 @@ ch_reset(EditLine *el, int mclear) el->el_state.lastcmd = ED_UNASSIGNED; el->el_history.eventno = 0; - - if (mclear) - ch__clearmacro(el); } -private void -ch__clearmacro(EditLine *el) -{ - c_macro_t *ma = &el->el_chared.c_macro; - while (ma->level >= 0) - el_free(ma->macro[ma->level--]); -} - /* ch_enlargebufs(): * Enlarge line buffer to be able to hold twice as much characters. * Returns 1 if successful, 0 if not. */ -protected int +libedit_private int ch_enlargebufs(EditLine *el, size_t addlen) { size_t sz, newsz; - Char *newbuffer, *oldbuf, *oldkbuf; + wchar_t *newbuffer, *oldbuf, *oldkbuf; sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE); newsz = sz * 2; @@ -589,7 +571,7 @@ ch_enlargebufs(EditLine *el, size_t addlen) /* ch_end(): * Free the data structures used by the editor */ -protected void +libedit_private void ch_end(EditLine *el) { el_free(el->el_line.buffer); @@ -604,21 +586,19 @@ ch_end(EditLine *el) el->el_chared.c_redo.cmd = ED_UNASSIGNED; el_free(el->el_chared.c_kill.buf); el->el_chared.c_kill.buf = NULL; - ch_reset(el, 1); - el_free(el->el_chared.c_macro.macro); - el->el_chared.c_macro.macro = NULL; + ch_reset(el); } /* el_insertstr(): * Insert string at cursorI */ -public int -FUN(el,insertstr)(EditLine *el, const Char *s) +int +el_winsertstr(EditLine *el, const wchar_t *s) { size_t len; - if (s == NULL || (len = Strlen(s)) == 0) + if (s == NULL || (len = wcslen(s)) == 0) return -1; if (el->el_line.lastchar + len >= el->el_line.limit) { if (!ch_enlargebufs(el, len)) @@ -635,7 +615,7 @@ FUN(el,insertstr)(EditLine *el, const Char *s) /* el_deletestr(): * Delete num characters before the cursor */ -public void +void el_deletestr(EditLine *el, int n) { if (n <= 0) @@ -653,7 +633,7 @@ el_deletestr(EditLine *el, int n) /* el_cursor(): * Move the cursor to the left or the right of the current position */ -public int +int el_cursor(EditLine *el, int n) { if (n == 0) @@ -672,15 +652,14 @@ out: /* c_gets(): * Get a string */ -protected int -c_gets(EditLine *el, Char *buf, const Char *prompt) +libedit_private int +c_gets(EditLine *el, wchar_t *buf, const wchar_t *prompt) { - wchar_t wch; ssize_t len; - Char *cp = el->el_line.buffer, ch; + wchar_t *cp = el->el_line.buffer, ch; if (prompt) { - len = (ssize_t)Strlen(prompt); + len = (ssize_t)wcslen(prompt); (void)memcpy(cp, prompt, (size_t)len * sizeof(*cp)); cp += len; } @@ -692,12 +671,11 @@ c_gets(EditLine *el, Char *buf, const Char *prompt) el->el_line.lastchar = cp + 1; re_refresh(el); - if (el_wgetc(el, &wch) != 1) { + if (el_wgetc(el, &ch) != 1) { ed_end_of_file(el, 0); len = -1; break; } - ch = (Char)wch; switch (ch) { @@ -739,10 +717,10 @@ c_gets(EditLine *el, Char *buf, const Char *prompt) /* c_hpos(): * Return the current horizontal position of the cursor */ -protected int +libedit_private int c_hpos(EditLine *el) { - Char *ptr; + wchar_t *ptr; /* * Find how many characters till the beginning of this line. @@ -758,7 +736,7 @@ c_hpos(EditLine *el) } } -protected int +libedit_private int ch_resizefun(EditLine *el, el_zfunc_t f, void *a) { el->el_chared.c_resizefun = f; @@ -766,7 +744,7 @@ ch_resizefun(EditLine *el, el_zfunc_t f, void *a) return 0; } -protected int +libedit_private int ch_aliasfun(EditLine *el, el_afunc_t f, void *a) { el->el_chared.c_aliasfun = f; Modified: vendor/NetBSD/libedit/dist/chared.h ============================================================================== --- vendor/NetBSD/libedit/dist/chared.h Wed Sep 13 15:44:54 2017 (r323544) +++ vendor/NetBSD/libedit/dist/chared.h Wed Sep 13 15:57:58 2017 (r323545) @@ -1,4 +1,4 @@ -/* $NetBSD: chared.h,v 1.27 2016/02/16 22:53:14 christos Exp $ */ +/* $NetBSD: chared.h,v 1.30 2016/05/22 19:44:26 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -40,8 +40,6 @@ #ifndef _h_el_chared #define _h_el_chared -#define EL_MAXMACRO 10 - /* * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works * like real vi: i.e. the transition from command<->insert modes moves @@ -54,29 +52,22 @@ */ #define VI_MOVE - -typedef struct c_macro_t { - int level; - int offset; - Char **macro; -} c_macro_t; - /* * Undo information for vi - no undo in emacs (yet) */ typedef struct c_undo_t { ssize_t len; /* length of saved line */ int cursor; /* position of saved cursor */ - Char *buf; /* full saved text */ + wchar_t *buf; /* full saved text */ } c_undo_t; /* redo for vi */ typedef struct c_redo_t { - Char *buf; /* redo insert key sequence */ - Char *pos; - Char *lim; + wchar_t *buf; /* redo insert key sequence */ + wchar_t *pos; + wchar_t *lim; el_action_t cmd; /* command to redo */ - Char ch; /* char that invoked it */ + wchar_t ch; /* char that invoked it */ int count; int action; /* from cv_action() */ } c_redo_t; @@ -86,16 +77,16 @@ typedef struct c_redo_t { */ typedef struct c_vcmd_t { int action; - Char *pos; + wchar_t *pos; } c_vcmd_t; /* * Kill buffer for emacs */ typedef struct c_kill_t { - Char *buf; - Char *last; - Char *mark; + wchar_t *buf; + wchar_t *last; + wchar_t *mark; } c_kill_t; typedef void (*el_zfunc_t)(EditLine *, void *); @@ -110,7 +101,6 @@ typedef struct el_chared_t { c_kill_t c_kill; c_redo_t c_redo; c_vcmd_t c_vcmd; - c_macro_t c_macro; el_zfunc_t c_resizefun; el_afunc_t c_aliasfun; void * c_resizearg; @@ -135,30 +125,31 @@ typedef struct el_chared_t { #define MODE_REPLACE_1 2 -protected int cv__isword(wint_t); -protected int cv__isWord(wint_t); -protected void cv_delfini(EditLine *); -protected Char *cv__endword(Char *, Char *, int, int (*)(wint_t)); -protected int ce__isword(wint_t); -protected void cv_undo(EditLine *); -protected void cv_yank(EditLine *, const Char *, int); -protected Char *cv_next_word(EditLine*, Char *, Char *, int, int (*)(wint_t)); -protected Char *cv_prev_word(Char *, Char *, int, int (*)(wint_t)); -protected Char *c__next_word(Char *, Char *, int, int (*)(wint_t)); -protected Char *c__prev_word(Char *, Char *, int, int (*)(wint_t)); -protected void c_insert(EditLine *, int); -protected void c_delbefore(EditLine *, int); -protected void c_delbefore1(EditLine *); -protected void c_delafter(EditLine *, int); -protected void c_delafter1(EditLine *); -protected int c_gets(EditLine *, Char *, const Char *); -protected int c_hpos(EditLine *); +libedit_private int cv__isword(wint_t); +libedit_private int cv__isWord(wint_t); +libedit_private void cv_delfini(EditLine *); +libedit_private wchar_t *cv__endword(wchar_t *, wchar_t *, int, int (*)(wint_t)); +libedit_private int ce__isword(wint_t); +libedit_private void cv_undo(EditLine *); +libedit_private void cv_yank(EditLine *, const wchar_t *, int); +libedit_private wchar_t *cv_next_word(EditLine*, wchar_t *, wchar_t *, int, + int (*)(wint_t)); +libedit_private wchar_t *cv_prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t)); +libedit_private wchar_t *c__next_word(wchar_t *, wchar_t *, int, int (*)(wint_t)); +libedit_private wchar_t *c__prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t)); +libedit_private void c_insert(EditLine *, int); +libedit_private void c_delbefore(EditLine *, int); +libedit_private void c_delbefore1(EditLine *); +libedit_private void c_delafter(EditLine *, int); +libedit_private void c_delafter1(EditLine *); +libedit_private int c_gets(EditLine *, wchar_t *, const wchar_t *); +libedit_private int c_hpos(EditLine *); -protected int ch_init(EditLine *); -protected void ch_reset(EditLine *, int); -protected int ch_resizefun(EditLine *, el_zfunc_t, void *); -protected int ch_aliasfun(EditLine *, el_afunc_t, void *); -protected int ch_enlargebufs(EditLine *, size_t); -protected void ch_end(EditLine *); +libedit_private int ch_init(EditLine *); +libedit_private void ch_reset(EditLine *); +libedit_private int ch_resizefun(EditLine *, el_zfunc_t, void *); +libedit_private int ch_aliasfun(EditLine *, el_afunc_t, void *); +libedit_private int ch_enlargebufs(EditLine *, size_t); +libedit_private void ch_end(EditLine *); #endif /* _h_el_chared */ Modified: vendor/NetBSD/libedit/dist/chartype.c ============================================================================== --- vendor/NetBSD/libedit/dist/chartype.c Wed Sep 13 15:44:54 2017 (r323544) +++ vendor/NetBSD/libedit/dist/chartype.c Wed Sep 13 15:57:58 2017 (r323545) @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $ */ +/* $NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $"); +__RCSID("$NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -42,8 +42,10 @@ __RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:2 #define CT_BUFSIZ ((size_t)1024) -#ifdef WIDECHAR -protected int +static int ct_conv_cbuff_resize(ct_buffer_t *, size_t); +static int ct_conv_wbuff_resize(ct_buffer_t *, size_t); + +static int ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize) { void *p; @@ -64,7 +66,7 @@ ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize) return 0; } -protected int +static int ct_conv_wbuff_resize(ct_buffer_t *conv, size_t wsize) { void *p; @@ -86,8 +88,8 @@ ct_conv_wbuff_resize(ct_buffer_t *conv, size_t wsize) } -public char * -ct_encode_string(const Char *s, ct_buffer_t *conv) +char * +ct_encode_string(const wchar_t *s, ct_buffer_t *conv) { char *dst; ssize_t used; @@ -116,7 +118,7 @@ ct_encode_string(const Char *s, ct_buffer_t *conv) return conv->cbuff; } -public Char * +wchar_t * ct_decode_string(const char *s, ct_buffer_t *conv) { size_t len; @@ -124,7 +126,7 @@ ct_decode_string(const char *s, ct_buffer_t *conv) if (!s) return NULL; - len = ct_mbstowcs(NULL, s, (size_t)0); + len = mbstowcs(NULL, s, (size_t)0); if (len == (size_t)-1) return NULL; @@ -132,18 +134,18 @@ ct_decode_string(const char *s, ct_buffer_t *conv) if (ct_conv_wbuff_resize(conv, len + CT_BUFSIZ) == -1) return NULL; - ct_mbstowcs(conv->wbuff, s, conv->wsize); + mbstowcs(conv->wbuff, s, conv->wsize); return conv->wbuff; } -protected Char ** +libedit_private wchar_t ** ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv) { size_t bufspace; int i; - Char *p; - Char **wargv; + wchar_t *p; + wchar_t **wargv; ssize_t bytes; /* Make sure we have enough space in the conversion buffer to store all @@ -154,7 +156,7 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer if (ct_conv_wbuff_resize(conv, bufspace + CT_BUFSIZ) == -1) return NULL; - wargv = el_malloc((size_t)argc * sizeof(*wargv)); + wargv = el_malloc((size_t)(argc + 1) * sizeof(*wargv)); for (i = 0, p = conv->wbuff; i < argc; ++i) { if (!argv[i]) { /* don't pass null pointers to mbstowcs */ @@ -172,13 +174,14 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer bufspace -= (size_t)bytes; p += bytes; } + wargv[i] = NULL; return wargv; } -protected size_t -ct_enc_width(Char c) +libedit_private size_t +ct_enc_width(wchar_t c) { /* UTF-8 encoding specific values */ if (c < 0x80) @@ -193,96 +196,66 @@ ct_enc_width(Char c) return 0; /* not a valid codepoint */ } -protected ssize_t -ct_encode_char(char *dst, size_t len, Char c) +libedit_private ssize_t +ct_encode_char(char *dst, size_t len, wchar_t c) { ssize_t l = 0; if (len < ct_enc_width(c)) return -1; - l = ct_wctomb(dst, c); + l = wctomb(dst, c); if (l < 0) { - ct_wctomb_reset; + wctomb(NULL, L'\0'); l = 0; } return l; } -size_t -ct_mbrtowc(wchar_t *wc, const char *s, size_t n) +libedit_private const wchar_t * +ct_visual_string(const wchar_t *s, ct_buffer_t *conv) { - mbstate_t mbs; - /* This only works because UTF-8 is stateless */ - memset(&mbs, 0, sizeof(mbs)); - return mbrtowc(wc, s, n, &mbs); -} + wchar_t *dst; + ssize_t used; -#else - -size_t -ct_mbrtowc(wchar_t *wc, const char *s, size_t n) - if (s == NULL) - return 0; - if (n == 0) - return (size_t)-2; - if (wc != NULL) - *wc = *s; - return *s != '\0'; -} -#endif - -protected const Char * -ct_visual_string(const Char *s) -{ - static Char *buff = NULL; - static size_t buffsize = 0; - void *p; - Char *dst; - ssize_t used = 0; - if (!s) return NULL; - if (!buff) { - buffsize = CT_BUFSIZ; - buff = el_malloc(buffsize * sizeof(*buff)); - } - dst = buff; + + if (ct_conv_wbuff_resize(conv, CT_BUFSIZ) == -1) + return NULL; + + used = 0; + dst = conv->wbuff; while (*s) { - used = ct_visual_char(dst, buffsize - (size_t)(dst - buff), *s); - if (used == -1) { /* failed to encode, need more buffer space */ - used = dst - buff; - buffsize += CT_BUFSIZ; - p = el_realloc(buff, buffsize * sizeof(*buff)); - if (p == NULL) - goto out; - buff = p; - dst = buff + used; - /* don't increment s here - we want to retry it! */ + used = ct_visual_char(dst, + conv->wsize - (size_t)(dst - conv->wbuff), *s); + if (used != -1) { + ++s; + dst += used; + continue; } - else - ++s; - dst += used; + + /* failed to encode, need more buffer space */ + used = dst - conv->wbuff; + if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1) + return NULL; + dst = conv->wbuff + used; } - if (dst >= (buff + buffsize)) { /* sigh */ - buffsize += 1; - p = el_realloc(buff, buffsize * sizeof(*buff)); - if (p == NULL) - goto out; - buff = p; - dst = buff + buffsize - 1; + + if (dst >= (conv->wbuff + conv->wsize)) { /* sigh */ + used = dst - conv->wbuff; + if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1) + return NULL; + dst = conv->wbuff + used; } - *dst = 0; - return buff; -out: - el_free(buff); - buffsize = 0; - return NULL; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 13 16:05:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4AEEE030C4; Wed, 13 Sep 2017 16:05:27 +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 8B19D6B687; Wed, 13 Sep 2017 16:05:27 +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 v8DG5QZ9097915; Wed, 13 Sep 2017 16:05:26 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DG5Q0r097910; Wed, 13 Sep 2017 16:05:26 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201709131605.v8DG5Q0r097910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 13 Sep 2017 16:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r323546 - in vendor/NetBSD/libedit/2017-09-05: . TEST readline X-SVN-Group: vendor X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in vendor/NetBSD/libedit/2017-09-05: . TEST readline X-SVN-Commit-Revision: 323546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:05:27 -0000 Author: pfg Date: Wed Sep 13 16:05:26 2017 New Revision: 323546 URL: https://svnweb.freebsd.org/changeset/base/323546 Log: Tag import of libedit 2017-09-05. Added: vendor/NetBSD/libedit/2017-09-05/ - copied from r323542, vendor/NetBSD/libedit/dist/ vendor/NetBSD/libedit/2017-09-05/editline.7 - copied unchanged from r323545, vendor/NetBSD/libedit/dist/editline.7 vendor/NetBSD/libedit/2017-09-05/historyn.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/historyn.c vendor/NetBSD/libedit/2017-09-05/literal.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/literal.c vendor/NetBSD/libedit/2017-09-05/literal.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/literal.h vendor/NetBSD/libedit/2017-09-05/tokenizern.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/tokenizern.c Replaced: vendor/NetBSD/libedit/2017-09-05/Makefile - copied unchanged from r323545, vendor/NetBSD/libedit/dist/Makefile vendor/NetBSD/libedit/2017-09-05/TEST/Makefile - copied unchanged from r323545, vendor/NetBSD/libedit/dist/TEST/Makefile vendor/NetBSD/libedit/2017-09-05/chared.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/chared.c vendor/NetBSD/libedit/2017-09-05/chared.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/chared.h vendor/NetBSD/libedit/2017-09-05/chartype.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/chartype.c vendor/NetBSD/libedit/2017-09-05/chartype.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/chartype.h vendor/NetBSD/libedit/2017-09-05/common.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/common.c vendor/NetBSD/libedit/2017-09-05/config.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/config.h vendor/NetBSD/libedit/2017-09-05/editline.3 - copied unchanged from r323545, vendor/NetBSD/libedit/dist/editline.3 vendor/NetBSD/libedit/2017-09-05/editrc.5 - copied unchanged from r323545, vendor/NetBSD/libedit/dist/editrc.5 vendor/NetBSD/libedit/2017-09-05/el.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/el.c vendor/NetBSD/libedit/2017-09-05/el.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/el.h vendor/NetBSD/libedit/2017-09-05/eln.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/eln.c vendor/NetBSD/libedit/2017-09-05/emacs.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/emacs.c vendor/NetBSD/libedit/2017-09-05/filecomplete.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/filecomplete.c vendor/NetBSD/libedit/2017-09-05/filecomplete.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/filecomplete.h vendor/NetBSD/libedit/2017-09-05/hist.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/hist.c vendor/NetBSD/libedit/2017-09-05/hist.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/hist.h vendor/NetBSD/libedit/2017-09-05/histedit.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/histedit.h vendor/NetBSD/libedit/2017-09-05/history.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/history.c vendor/NetBSD/libedit/2017-09-05/keymacro.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/keymacro.c vendor/NetBSD/libedit/2017-09-05/keymacro.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/keymacro.h vendor/NetBSD/libedit/2017-09-05/makelist - copied unchanged from r323545, vendor/NetBSD/libedit/dist/makelist vendor/NetBSD/libedit/2017-09-05/map.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/map.c vendor/NetBSD/libedit/2017-09-05/map.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/map.h vendor/NetBSD/libedit/2017-09-05/parse.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/parse.c vendor/NetBSD/libedit/2017-09-05/parse.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/parse.h vendor/NetBSD/libedit/2017-09-05/prompt.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/prompt.c vendor/NetBSD/libedit/2017-09-05/prompt.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/prompt.h vendor/NetBSD/libedit/2017-09-05/read.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/read.c vendor/NetBSD/libedit/2017-09-05/read.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/read.h vendor/NetBSD/libedit/2017-09-05/readline.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/readline.c vendor/NetBSD/libedit/2017-09-05/readline/readline.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/readline/readline.h vendor/NetBSD/libedit/2017-09-05/refresh.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/refresh.c vendor/NetBSD/libedit/2017-09-05/refresh.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/refresh.h vendor/NetBSD/libedit/2017-09-05/search.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/search.c vendor/NetBSD/libedit/2017-09-05/search.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/search.h vendor/NetBSD/libedit/2017-09-05/sig.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/sig.c vendor/NetBSD/libedit/2017-09-05/sig.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/sig.h vendor/NetBSD/libedit/2017-09-05/sys.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/sys.h vendor/NetBSD/libedit/2017-09-05/terminal.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/terminal.c vendor/NetBSD/libedit/2017-09-05/terminal.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/terminal.h vendor/NetBSD/libedit/2017-09-05/tokenizer.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/tokenizer.c vendor/NetBSD/libedit/2017-09-05/tty.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/tty.c vendor/NetBSD/libedit/2017-09-05/tty.h - copied unchanged from r323545, vendor/NetBSD/libedit/dist/tty.h vendor/NetBSD/libedit/2017-09-05/vi.c - copied unchanged from r323545, vendor/NetBSD/libedit/dist/vi.c Copied: vendor/NetBSD/libedit/2017-09-05/Makefile (from r323545, vendor/NetBSD/libedit/dist/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/libedit/2017-09-05/Makefile Wed Sep 13 16:05:26 2017 (r323546, copy of r323545, vendor/NetBSD/libedit/dist/Makefile) @@ -0,0 +1,139 @@ +# $NetBSD: Makefile,v 1.65 2017/06/30 20:26:52 kre Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/4/93 + +USE_SHLIBDIR= yes + +WARNS?= 5 +LIB= edit + +LIBDPLIBS+= terminfo ${.CURDIR}/../libterminfo + +.include "bsd.own.mk" + +COPTS+= -Wunused-parameter +CWARNFLAGS.gcc+= -Wconversion +CWARNFLAGS.clang+= -Wno-cast-qual + +SRCS = chared.c chartype.c common.c el.c eln.c emacs.c filecomplete.c \ + hist.c history.c historyn.c keymacro.c literal.c map.c \ + parse.c prompt.c read.c readline.c refresh.c search.c sig.c \ + terminal.c tokenizer.c tokenizern.c tty.c vi.c + +MAN= editline.3 editrc.5 editline.7 + +MLINKS= \ +editline.3 el_deletestr.3 \ +editline.3 el_end.3 \ +editline.3 el_get.3 \ +editline.3 el_getc.3 \ +editline.3 el_gets.3 \ +editline.3 el_init.3 \ +editline.3 el_init_fd.3 \ +editline.3 el_insertstr.3 \ +editline.3 el_line.3 \ +editline.3 el_parse.3 \ +editline.3 el_push.3 \ +editline.3 el_reset.3 \ +editline.3 el_resize.3 \ +editline.3 el_set.3 \ +editline.3 el_source.3 \ +editline.3 history.3 \ +editline.3 history_end.3 \ +editline.3 history_init.3 \ +editline.3 tok_end.3 \ +editline.3 tok_init.3 \ +editline.3 tok_line.3 \ +editline.3 tok_reset.3 \ +editline.3 tok_str.3 + +MLINKS+= \ +editline.3 el_wdeletestr.3 \ +editline.3 el_wget.3 \ +editline.3 el_wgetc.3 \ +editline.3 el_wgets.3 \ +editline.3 el_winsertstr.3 \ +editline.3 el_wline.3 \ +editline.3 el_wparse.3 \ +editline.3 el_wpush.3 \ +editline.3 el_wset.3 \ +editline.3 history_w.3 \ +editline.3 history_wend.3 \ +editline.3 history_winit.3 \ +editline.3 tok_wend.3 \ +editline.3 tok_winit.3 \ +editline.3 tok_wline.3 \ +editline.3 tok_wreset.3 \ +editline.3 tok_wstr.3 + +LIBEDITDIR?=${.CURDIR} + +INCS= histedit.h +INCSDIR=/usr/include + +CLEANFILES+=common.h.tmp emacs.h.tmp fcns.h.tmp func.h.tmp +CLEANFILES+=help.h.tmp vi.h.tmp tc1.o tc1 .depend + +CPPFLAGS+=-I. -I${LIBEDITDIR} +CPPFLAGS+=-I. -I${.CURDIR} +#CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG -DDEBUG_REFRESH +#CPPFLAGS+=-DDEBUG_PASTE -DDEBUG_EDIT + +AHDR=vi.h emacs.h common.h +ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c + +DPSRCS+= ${AHDR} fcns.h func.h help.h +CLEANFILES+= ${AHDR} fcns.h func.h help.h + +SUBDIR= readline + +.depend: ${AHDR} fcns.h func.h help.h + +vi.h: vi.c makelist Makefile + ${_MKTARGET_CREATE} + ${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/vi.c \ + > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET} + +emacs.h: emacs.c makelist Makefile + ${_MKTARGET_CREATE} + ${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/emacs.c \ + > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET} + +common.h: common.c makelist Makefile + ${_MKTARGET_CREATE} + ${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/common.c \ + > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET} + +fcns.h: ${AHDR} makelist Makefile + ${_MKTARGET_CREATE} + ${HOST_SH} ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET} + +func.h: ${AHDR} makelist Makefile + ${_MKTARGET_CREATE} + ${HOST_SH} ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET} + +help.h: ${ASRC} makelist Makefile + ${_MKTARGET_CREATE} + ${HOST_SH} ${LIBEDITDIR}/makelist -bh ${ASRC} > ${.TARGET}.tmp && \ + mv ${.TARGET}.tmp ${.TARGET} + +tc1.o: ${LIBEDITDIR}/TEST/tc1.c + +tc1: libedit.a tc1.o + ${_MKTARGET_LINK} + ${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} -ltermlib + +.include +.include + +# XXX +.if defined(HAVE_GCC) +COPTS.editline.c+= -Wno-cast-qual +COPTS.literal.c+= -Wno-sign-conversion +COPTS.tokenizer.c+= -Wno-cast-qual +COPTS.tokenizern.c+= -Wno-cast-qual +.endif Copied: vendor/NetBSD/libedit/2017-09-05/TEST/Makefile (from r323545, vendor/NetBSD/libedit/dist/TEST/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/libedit/2017-09-05/TEST/Makefile Wed Sep 13 16:05:26 2017 (r323546, copy of r323545, vendor/NetBSD/libedit/dist/TEST/Makefile) @@ -0,0 +1,13 @@ +# $NetBSD: Makefile,v 1.7 2016/03/23 22:27:48 christos Exp $ + +NOMAN=1 +PROG=wtc1 +CPPFLAGS=-I${.CURDIR}/.. +LDADD+=-ledit -ltermlib +DPADD+=${LIBEDIT} ${LIBTERMLIB} + +.ifdef DEBUG +CPPFLAGS+=-DDEBUG +.endif + +.include Copied: vendor/NetBSD/libedit/2017-09-05/chared.c (from r323545, vendor/NetBSD/libedit/dist/chared.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/libedit/2017-09-05/chared.c Wed Sep 13 16:05:26 2017 (r323546, copy of r323545, vendor/NetBSD/libedit/dist/chared.c) @@ -0,0 +1,753 @@ +/* $NetBSD: chared.c,v 1.56 2016/05/22 19:44:26 christos Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Christos Zoulas of Cornell University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "config.h" +#if !defined(lint) && !defined(SCCSID) +#if 0 +static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; +#else +__RCSID("$NetBSD: chared.c,v 1.56 2016/05/22 19:44:26 christos Exp $"); +#endif +#endif /* not lint && not SCCSID */ + +/* + * chared.c: Character editor utilities + */ +#include +#include +#include + +#include "el.h" +#include "common.h" +#include "fcns.h" + +/* value to leave unused in line buffer */ +#define EL_LEAVE 2 + +/* cv_undo(): + * Handle state for the vi undo command + */ +libedit_private void +cv_undo(EditLine *el) +{ + c_undo_t *vu = &el->el_chared.c_undo; + c_redo_t *r = &el->el_chared.c_redo; + size_t size; + + /* Save entire line for undo */ + size = (size_t)(el->el_line.lastchar - el->el_line.buffer); + vu->len = (ssize_t)size; + vu->cursor = (int)(el->el_line.cursor - el->el_line.buffer); + (void)memcpy(vu->buf, el->el_line.buffer, size * sizeof(*vu->buf)); + + /* save command info for redo */ + r->count = el->el_state.doingarg ? el->el_state.argument : 0; + r->action = el->el_chared.c_vcmd.action; + r->pos = r->buf; + r->cmd = el->el_state.thiscmd; + r->ch = el->el_state.thisch; +} + +/* cv_yank(): + * Save yank/delete data for paste + */ +libedit_private void +cv_yank(EditLine *el, const wchar_t *ptr, int size) +{ + c_kill_t *k = &el->el_chared.c_kill; + + (void)memcpy(k->buf, ptr, (size_t)size * sizeof(*k->buf)); + k->last = k->buf + size; +} + + +/* c_insert(): + * Insert num characters + */ +libedit_private void +c_insert(EditLine *el, int num) +{ + wchar_t *cp; + + if (el->el_line.lastchar + num >= el->el_line.limit) { + if (!ch_enlargebufs(el, (size_t)num)) + return; /* can't go past end of buffer */ + } + + if (el->el_line.cursor < el->el_line.lastchar) { + /* if I must move chars */ + for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--) + cp[num] = *cp; + } + el->el_line.lastchar += num; +} + + +/* c_delafter(): + * Delete num characters after the cursor + */ +libedit_private void +c_delafter(EditLine *el, int num) +{ + + if (el->el_line.cursor + num > el->el_line.lastchar) + num = (int)(el->el_line.lastchar - el->el_line.cursor); + + if (el->el_map.current != el->el_map.emacs) { + cv_undo(el); + cv_yank(el, el->el_line.cursor, num); + } + + if (num > 0) { + wchar_t *cp; + + for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) + *cp = cp[num]; + + el->el_line.lastchar -= num; + } +} + + +/* c_delafter1(): + * Delete the character after the cursor, do not yank + */ +libedit_private void +c_delafter1(EditLine *el) +{ + wchar_t *cp; + + for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) + *cp = cp[1]; + + el->el_line.lastchar--; +} + + +/* c_delbefore(): + * Delete num characters before the cursor + */ +libedit_private void +c_delbefore(EditLine *el, int num) +{ + + if (el->el_line.cursor - num < el->el_line.buffer) + num = (int)(el->el_line.cursor - el->el_line.buffer); + + if (el->el_map.current != el->el_map.emacs) { + cv_undo(el); + cv_yank(el, el->el_line.cursor - num, num); + } + + if (num > 0) { + wchar_t *cp; + + for (cp = el->el_line.cursor - num; + cp <= el->el_line.lastchar; + cp++) + *cp = cp[num]; + + el->el_line.lastchar -= num; + } +} + + +/* c_delbefore1(): + * Delete the character before the cursor, do not yank + */ +libedit_private void +c_delbefore1(EditLine *el) +{ + wchar_t *cp; + + for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) + *cp = cp[1]; + + el->el_line.lastchar--; +} + + +/* ce__isword(): + * Return if p is part of a word according to emacs + */ +libedit_private int +ce__isword(wint_t p) +{ + return iswalnum(p) || wcschr(L"*?_-.[]~=", p) != NULL; +} + + +/* cv__isword(): + * Return if p is part of a word according to vi + */ +libedit_private int +cv__isword(wint_t p) +{ + if (iswalnum(p) || p == L'_') + return 1; + if (iswgraph(p)) + return 2; + return 0; +} + + +/* cv__isWord(): + * Return if p is part of a big word according to vi + */ +libedit_private int +cv__isWord(wint_t p) +{ + return !iswspace(p); +} + + +/* c__prev_word(): + * Find the previous word + */ +libedit_private wchar_t * +c__prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t)) +{ + p--; + + while (n--) { + while ((p >= low) && !(*wtest)(*p)) + p--; + while ((p >= low) && (*wtest)(*p)) + p--; + } + + /* cp now points to one character before the word */ + p++; + if (p < low) + p = low; + /* cp now points where we want it */ + return p; +} + + +/* c__next_word(): + * Find the next word + */ +libedit_private wchar_t * +c__next_word(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) +{ + while (n--) { + while ((p < high) && !(*wtest)(*p)) + p++; + while ((p < high) && (*wtest)(*p)) + p++; + } + if (p > high) + p = high; + /* p now points where we want it */ + return p; +} + +/* cv_next_word(): + * Find the next word vi style + */ +libedit_private wchar_t * +cv_next_word(EditLine *el, wchar_t *p, wchar_t *high, int n, + int (*wtest)(wint_t)) +{ + int test; + + while (n--) { + test = (*wtest)(*p); + while ((p < high) && (*wtest)(*p) == test) + p++; + /* + * vi historically deletes with cw only the word preserving the + * trailing whitespace! This is not what 'w' does.. + */ + if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT)) + while ((p < high) && iswspace(*p)) + p++; + } + + /* p now points where we want it */ + if (p > high) + return high; + else + return p; +} + + +/* cv_prev_word(): + * Find the previous word vi style + */ +libedit_private wchar_t * +cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t)) +{ + int test; + + p--; + while (n--) { + while ((p > low) && iswspace(*p)) + p--; + test = (*wtest)(*p); + while ((p >= low) && (*wtest)(*p) == test) + p--; + } + p++; + + /* p now points where we want it */ + if (p < low) + return low; + else + return p; +} + + +/* cv_delfini(): + * Finish vi delete action + */ +libedit_private void +cv_delfini(EditLine *el) +{ + int size; + int action = el->el_chared.c_vcmd.action; + + if (action & INSERT) + el->el_map.current = el->el_map.key; + + if (el->el_chared.c_vcmd.pos == 0) + /* sanity */ + return; + + size = (int)(el->el_line.cursor - el->el_chared.c_vcmd.pos); + if (size == 0) + size = 1; + el->el_line.cursor = el->el_chared.c_vcmd.pos; + if (action & YANK) { + if (size > 0) + cv_yank(el, el->el_line.cursor, size); + else + cv_yank(el, el->el_line.cursor + size, -size); + } else { + if (size > 0) { + c_delafter(el, size); + re_refresh_cursor(el); + } else { + c_delbefore(el, -size); + el->el_line.cursor += size; + } + } + el->el_chared.c_vcmd.action = NOP; +} + + +/* cv__endword(): + * Go to the end of this word according to vi + */ +libedit_private wchar_t * +cv__endword(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) +{ + int test; + + p++; + + while (n--) { + while ((p < high) && iswspace(*p)) + p++; + + test = (*wtest)(*p); + while ((p < high) && (*wtest)(*p) == test) + p++; + } + p--; + return p; +} + +/* ch_init(): + * Initialize the character editor + */ +libedit_private int +ch_init(EditLine *el) +{ + el->el_line.buffer = el_malloc(EL_BUFSIZ * + sizeof(*el->el_line.buffer)); + if (el->el_line.buffer == NULL) + return -1; + + (void) memset(el->el_line.buffer, 0, EL_BUFSIZ * + sizeof(*el->el_line.buffer)); + el->el_line.cursor = el->el_line.buffer; + el->el_line.lastchar = el->el_line.buffer; + el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE]; + + el->el_chared.c_undo.buf = el_malloc(EL_BUFSIZ * + sizeof(*el->el_chared.c_undo.buf)); + if (el->el_chared.c_undo.buf == NULL) + return -1; + (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ * + sizeof(*el->el_chared.c_undo.buf)); + el->el_chared.c_undo.len = -1; + el->el_chared.c_undo.cursor = 0; + el->el_chared.c_redo.buf = el_malloc(EL_BUFSIZ * + sizeof(*el->el_chared.c_redo.buf)); + if (el->el_chared.c_redo.buf == NULL) + return -1; + el->el_chared.c_redo.pos = el->el_chared.c_redo.buf; + el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ; + el->el_chared.c_redo.cmd = ED_UNASSIGNED; + + el->el_chared.c_vcmd.action = NOP; + el->el_chared.c_vcmd.pos = el->el_line.buffer; + + el->el_chared.c_kill.buf = el_malloc(EL_BUFSIZ * + sizeof(*el->el_chared.c_kill.buf)); + if (el->el_chared.c_kill.buf == NULL) + return -1; + (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ * + sizeof(*el->el_chared.c_kill.buf)); + el->el_chared.c_kill.mark = el->el_line.buffer; + el->el_chared.c_kill.last = el->el_chared.c_kill.buf; + el->el_chared.c_resizefun = NULL; + el->el_chared.c_resizearg = NULL; + el->el_chared.c_aliasfun = NULL; + el->el_chared.c_aliasarg = NULL; + + el->el_map.current = el->el_map.key; + + el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ + el->el_state.doingarg = 0; + el->el_state.metanext = 0; + el->el_state.argument = 1; + el->el_state.lastcmd = ED_UNASSIGNED; + + return 0; +} + +/* ch_reset(): + * Reset the character editor + */ +libedit_private void +ch_reset(EditLine *el) +{ + el->el_line.cursor = el->el_line.buffer; + el->el_line.lastchar = el->el_line.buffer; + + el->el_chared.c_undo.len = -1; + el->el_chared.c_undo.cursor = 0; + + el->el_chared.c_vcmd.action = NOP; + el->el_chared.c_vcmd.pos = el->el_line.buffer; + + el->el_chared.c_kill.mark = el->el_line.buffer; + + el->el_map.current = el->el_map.key; + + el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ + el->el_state.doingarg = 0; + el->el_state.metanext = 0; + el->el_state.argument = 1; + el->el_state.lastcmd = ED_UNASSIGNED; + + el->el_history.eventno = 0; +} + +/* ch_enlargebufs(): + * Enlarge line buffer to be able to hold twice as much characters. + * Returns 1 if successful, 0 if not. + */ +libedit_private int +ch_enlargebufs(EditLine *el, size_t addlen) +{ + size_t sz, newsz; + wchar_t *newbuffer, *oldbuf, *oldkbuf; + + sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE); + newsz = sz * 2; + /* + * If newly required length is longer than current buffer, we need + * to make the buffer big enough to hold both old and new stuff. + */ + if (addlen > sz) { + while(newsz - sz < addlen) + newsz *= 2; + } + + /* + * Reallocate line buffer. + */ + newbuffer = el_realloc(el->el_line.buffer, newsz * sizeof(*newbuffer)); + if (!newbuffer) + return 0; + + /* zero the newly added memory, leave old data in */ + (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); + + oldbuf = el->el_line.buffer; + + el->el_line.buffer = newbuffer; + el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf); + el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf); + /* don't set new size until all buffers are enlarged */ + el->el_line.limit = &newbuffer[sz - EL_LEAVE]; + + /* + * Reallocate kill buffer. + */ + newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz * + sizeof(*newbuffer)); + if (!newbuffer) + return 0; + + /* zero the newly added memory, leave old data in */ + (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); + + oldkbuf = el->el_chared.c_kill.buf; + + el->el_chared.c_kill.buf = newbuffer; + el->el_chared.c_kill.last = newbuffer + + (el->el_chared.c_kill.last - oldkbuf); + el->el_chared.c_kill.mark = el->el_line.buffer + + (el->el_chared.c_kill.mark - oldbuf); + + /* + * Reallocate undo buffer. + */ + newbuffer = el_realloc(el->el_chared.c_undo.buf, + newsz * sizeof(*newbuffer)); + if (!newbuffer) + return 0; + + /* zero the newly added memory, leave old data in */ + (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); + el->el_chared.c_undo.buf = newbuffer; + + newbuffer = el_realloc(el->el_chared.c_redo.buf, + newsz * sizeof(*newbuffer)); + if (!newbuffer) + return 0; + el->el_chared.c_redo.pos = newbuffer + + (el->el_chared.c_redo.pos - el->el_chared.c_redo.buf); + el->el_chared.c_redo.lim = newbuffer + + (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf); + el->el_chared.c_redo.buf = newbuffer; + + if (!hist_enlargebuf(el, sz, newsz)) + return 0; + + /* Safe to set enlarged buffer size */ + el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE]; + if (el->el_chared.c_resizefun) + (*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg); + return 1; +} + +/* ch_end(): + * Free the data structures used by the editor + */ +libedit_private void +ch_end(EditLine *el) +{ + el_free(el->el_line.buffer); + el->el_line.buffer = NULL; + el->el_line.limit = NULL; + el_free(el->el_chared.c_undo.buf); + el->el_chared.c_undo.buf = NULL; + el_free(el->el_chared.c_redo.buf); + el->el_chared.c_redo.buf = NULL; + el->el_chared.c_redo.pos = NULL; + el->el_chared.c_redo.lim = NULL; + el->el_chared.c_redo.cmd = ED_UNASSIGNED; + el_free(el->el_chared.c_kill.buf); + el->el_chared.c_kill.buf = NULL; + ch_reset(el); +} + + +/* el_insertstr(): + * Insert string at cursorI + */ +int +el_winsertstr(EditLine *el, const wchar_t *s) +{ + size_t len; + + if (s == NULL || (len = wcslen(s)) == 0) + return -1; + if (el->el_line.lastchar + len >= el->el_line.limit) { + if (!ch_enlargebufs(el, len)) + return -1; + } + + c_insert(el, (int)len); + while (*s) + *el->el_line.cursor++ = *s++; + return 0; +} + + +/* el_deletestr(): + * Delete num characters before the cursor + */ +void +el_deletestr(EditLine *el, int n) +{ + if (n <= 0) + return; + + if (el->el_line.cursor < &el->el_line.buffer[n]) + return; + + c_delbefore(el, n); /* delete before dot */ + el->el_line.cursor -= n; + if (el->el_line.cursor < el->el_line.buffer) + el->el_line.cursor = el->el_line.buffer; +} + +/* el_cursor(): + * Move the cursor to the left or the right of the current position + */ +int +el_cursor(EditLine *el, int n) +{ + if (n == 0) + goto out; + + el->el_line.cursor += n; + + if (el->el_line.cursor < el->el_line.buffer) + el->el_line.cursor = el->el_line.buffer; + if (el->el_line.cursor > el->el_line.lastchar) + el->el_line.cursor = el->el_line.lastchar; +out: + return (int)(el->el_line.cursor - el->el_line.buffer); +} + +/* c_gets(): + * Get a string + */ +libedit_private int +c_gets(EditLine *el, wchar_t *buf, const wchar_t *prompt) +{ + ssize_t len; + wchar_t *cp = el->el_line.buffer, ch; + + if (prompt) { + len = (ssize_t)wcslen(prompt); + (void)memcpy(cp, prompt, (size_t)len * sizeof(*cp)); + cp += len; + } + len = 0; + + for (;;) { + el->el_line.cursor = cp; + *cp = ' '; + el->el_line.lastchar = cp + 1; + re_refresh(el); + + if (el_wgetc(el, &ch) != 1) { + ed_end_of_file(el, 0); + len = -1; + break; + } + + switch (ch) { + + case L'\b': /* Delete and backspace */ + case 0177: + if (len == 0) { + len = -1; + break; + } + len--; + cp--; + continue; + + case 0033: /* ESC */ + case L'\r': /* Newline */ + case L'\n': + buf[len] = ch; + break; + + default: + if (len >= (ssize_t)(EL_BUFSIZ - 16)) + terminal_beep(el); + else { + buf[len++] = ch; + *cp++ = ch; + } + continue; + } + break; + } + + el->el_line.buffer[0] = '\0'; + el->el_line.lastchar = el->el_line.buffer; + el->el_line.cursor = el->el_line.buffer; + return (int)len; +} + + +/* c_hpos(): + * Return the current horizontal position of the cursor + */ +libedit_private int +c_hpos(EditLine *el) +{ + wchar_t *ptr; + + /* + * Find how many characters till the beginning of this line. + */ + if (el->el_line.cursor == el->el_line.buffer) + return 0; + else { + for (ptr = el->el_line.cursor - 1; + ptr >= el->el_line.buffer && *ptr != '\n'; + ptr--) + continue; + return (int)(el->el_line.cursor - ptr - 1); + } +} + +libedit_private int +ch_resizefun(EditLine *el, el_zfunc_t f, void *a) +{ + el->el_chared.c_resizefun = f; + el->el_chared.c_resizearg = a; + return 0; +} + +libedit_private int +ch_aliasfun(EditLine *el, el_afunc_t f, void *a) +{ + el->el_chared.c_aliasfun = f; + el->el_chared.c_aliasarg = a; + return 0; +} Copied: vendor/NetBSD/libedit/2017-09-05/chared.h (from r323545, vendor/NetBSD/libedit/dist/chared.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/libedit/2017-09-05/chared.h Wed Sep 13 16:05:26 2017 (r323546, copy of r323545, vendor/NetBSD/libedit/dist/chared.h) @@ -0,0 +1,155 @@ +/* $NetBSD: chared.h,v 1.30 2016/05/22 19:44:26 christos Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Christos Zoulas of Cornell University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)chared.h 8.1 (Berkeley) 6/4/93 + */ + +/* + * el.chared.h: Character editor interface + */ +#ifndef _h_el_chared +#define _h_el_chared + +/* + * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works + * like real vi: i.e. the transition from command<->insert modes moves + * the cursor. + * + * On the other hand we really don't want to move the cursor, because + * all the editing commands don't include the character under the cursor. + * Probably the best fix is to make all the editing commands aware of + * this fact. + */ +#define VI_MOVE + +/* + * Undo information for vi - no undo in emacs (yet) + */ +typedef struct c_undo_t { + ssize_t len; /* length of saved line */ + int cursor; /* position of saved cursor */ + wchar_t *buf; /* full saved text */ +} c_undo_t; + +/* redo for vi */ +typedef struct c_redo_t { + wchar_t *buf; /* redo insert key sequence */ + wchar_t *pos; + wchar_t *lim; + el_action_t cmd; /* command to redo */ + wchar_t ch; /* char that invoked it */ + int count; + int action; /* from cv_action() */ +} c_redo_t; + +/* + * Current action information for vi + */ +typedef struct c_vcmd_t { + int action; + wchar_t *pos; +} c_vcmd_t; + +/* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 13 16:13:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D17DDE037DE; Wed, 13 Sep 2017 16:13:15 +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 9BAA16BEB6; Wed, 13 Sep 2017 16:13:15 +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 v8DGDEJ4002350; Wed, 13 Sep 2017 16:13:14 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGDEIE002349; Wed, 13 Sep 2017 16:13:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201709131613.v8DGDEIE002349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 13 Sep 2017 16:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323547 - head/lib/libedit X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libedit X-SVN-Commit-Revision: 323547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:13:15 -0000 Author: pfg Date: Wed Sep 13 16:13:14 2017 New Revision: 323547 URL: https://svnweb.freebsd.org/changeset/base/323547 Log: libedit: add missing bracket. We never hit this because we always build with widechar support. Reported by: cognet MFC after: 3 days Modified: head/lib/libedit/chartype.c Modified: head/lib/libedit/chartype.c ============================================================================== --- head/lib/libedit/chartype.c Wed Sep 13 16:05:26 2017 (r323546) +++ head/lib/libedit/chartype.c Wed Sep 13 16:13:14 2017 (r323547) @@ -223,6 +223,7 @@ ct_mbrtowc(wchar_t *wc, const char *s, size_t n) size_t ct_mbrtowc(wchar_t *wc, const char *s, size_t n) +{ if (s == NULL) return 0; if (n == 0) From owner-svn-src-all@freebsd.org Wed Sep 13 16:21:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60374E03E6B; Wed, 13 Sep 2017 16:21:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C5956C466; Wed, 13 Sep 2017 16:21:12 +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 v8DGLBhL003650; Wed, 13 Sep 2017 16:21:11 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGLBfi003647; Wed, 13 Sep 2017 16:21:11 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201709131621.v8DGLBfi003647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 13 Sep 2017 16:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323548 - in stable/11/lib/libc: gen locale X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in stable/11/lib/libc: gen locale X-SVN-Commit-Revision: 323548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:21:12 -0000 Author: pfg Date: Wed Sep 13 16:21:11 2017 New Revision: 323548 URL: https://svnweb.freebsd.org/changeset/base/323548 Log: MFC r322925: libc: minor indent(1) cleanups. Illumos and Schillix are adopting some of the locale code and our style(9) sometimes matches the Solaris cstyle, so the changes are also useful as a way to reduce diffs. No functional change. Modified: stable/11/lib/libc/gen/fnmatch.c stable/11/lib/libc/locale/setlocale.c stable/11/lib/libc/locale/setrunelocale.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/fnmatch.c ============================================================================== --- stable/11/lib/libc/gen/fnmatch.c Wed Sep 13 16:13:14 2017 (r323547) +++ stable/11/lib/libc/gen/fnmatch.c Wed Sep 13 16:21:11 2017 (r323548) @@ -249,7 +249,7 @@ rangematch(const char *pattern, wchar_t test, int flag * consistency with the regular expression syntax. * J.T. Conklin (conklin@ngai.kaleida.com) */ - if ( (negate = (*pattern == '!' || *pattern == '^')) ) + if ((negate = (*pattern == '!' || *pattern == '^'))) ++pattern; if (flags & FNM_CASEFOLD) Modified: stable/11/lib/libc/locale/setlocale.c ============================================================================== --- stable/11/lib/libc/locale/setlocale.c Wed Sep 13 16:13:14 2017 (r323547) +++ stable/11/lib/libc/locale/setlocale.c Wed Sep 13 16:21:11 2017 (r323548) @@ -42,48 +42,48 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include /* for _PATH_LOCALE */ +#include /* for _PATH_LOCALE */ #include #include #include #include "collate.h" -#include "lmonetary.h" /* for __monetary_load_locale() */ -#include "lnumeric.h" /* for __numeric_load_locale() */ -#include "lmessages.h" /* for __messages_load_locale() */ +#include "lmonetary.h" /* for __monetary_load_locale() */ +#include "lnumeric.h" /* for __numeric_load_locale() */ +#include "lmessages.h" /* for __messages_load_locale() */ #include "setlocale.h" #include "ldpart.h" -#include "../stdtime/timelocal.h" /* for __time_load_locale() */ +#include "../stdtime/timelocal.h" /* for __time_load_locale() */ /* * Category names for getenv() */ static const char categories[_LC_LAST][12] = { - "LC_ALL", - "LC_COLLATE", - "LC_CTYPE", - "LC_MONETARY", - "LC_NUMERIC", - "LC_TIME", - "LC_MESSAGES", + "LC_ALL", + "LC_COLLATE", + "LC_CTYPE", + "LC_MONETARY", + "LC_NUMERIC", + "LC_TIME", + "LC_MESSAGES", }; /* * Current locales for each category */ static char current_categories[_LC_LAST][ENCODING_LEN + 1] = { - "C", - "C", - "C", - "C", - "C", - "C", - "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", }; /* * Path to locale storage directory */ -char *_PathLocale; +char *_PathLocale; /* * The locales we are going to try and load @@ -93,21 +93,20 @@ static char saved_categories[_LC_LAST][ENCODING_LEN + static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)]; -static char *currentlocale(void); -static char *loadlocale(int); +static char *currentlocale(void); +static char *loadlocale(int); const char *__get_locale_env(int); char * setlocale(int category, const char *locale) { int i, j, len, saverr; - const char *env, *r; + const char *env, *r; if (category < LC_ALL || category >= _LC_LAST) { errno = EINVAL; return (NULL); } - if (locale == NULL) return (category != LC_ALL ? current_categories[category] : currentlocale()); @@ -162,13 +161,13 @@ setlocale(int category, const char *locale) } do { if (i == _LC_LAST) - break; /* Too many slashes... */ + break; /* Too many slashes... */ if ((len = r - locale) > ENCODING_LEN) { errno = EINVAL; return (NULL); } (void)strlcpy(new_categories[i], locale, - len + 1); + len + 1); i++; while (*r == '/') r++; @@ -178,7 +177,7 @@ setlocale(int category, const char *locale) } while (*locale); while (i < _LC_LAST) { (void)strcpy(new_categories[i], - new_categories[i-1]); + new_categories[i - 1]); i++; } } @@ -193,7 +192,7 @@ setlocale(int category, const char *locale) saverr = errno; for (j = 1; j < i; j++) { (void)strcpy(new_categories[j], - saved_categories[j]); + saved_categories[j]); if (loadlocale(j) == NULL) { (void)strcpy(new_categories[j], "C"); (void)loadlocale(j); @@ -218,7 +217,7 @@ currentlocale(void) for (i = 2; i < _LC_LAST; ++i) { (void)strcat(current_locale_string, "/"); (void)strcat(current_locale_string, - current_categories[i]); + current_categories[i]); } break; } @@ -230,16 +229,15 @@ loadlocale(int category) { char *new = new_categories[category]; char *old = current_categories[category]; - int (*func)(const char *); + int (*func) (const char *); int saved_errno; if ((new[0] == '.' && - (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) || + (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) || strchr(new, '/') != NULL) { errno = EINVAL; return (NULL); } - saved_errno = errno; errno = __detect_path_locale(); if (errno != 0) @@ -285,22 +283,22 @@ loadlocale(int category) const char * __get_locale_env(int category) { - const char *env; + const char *env; - /* 1. check LC_ALL. */ - env = getenv(categories[0]); + /* 1. check LC_ALL. */ + env = getenv(categories[0]); - /* 2. check LC_* */ + /* 2. check LC_* */ if (env == NULL || !*env) - env = getenv(categories[category]); + env = getenv(categories[category]); - /* 3. check LANG */ + /* 3. check LANG */ if (env == NULL || !*env) - env = getenv("LANG"); + env = getenv("LANG"); - /* 4. if none is set, fall to "C" */ + /* 4. if none is set, fall to "C" */ if (env == NULL || !*env) - env = "C"; + env = "C"; return (env); } @@ -326,4 +324,3 @@ __detect_path_locale(void) } return (0); } - Modified: stable/11/lib/libc/locale/setrunelocale.c ============================================================================== --- stable/11/lib/libc/locale/setrunelocale.c Wed Sep 13 16:13:14 2017 (r323547) +++ stable/11/lib/libc/locale/setrunelocale.c Wed Sep 13 16:21:11 2017 (r323548) @@ -38,7 +38,7 @@ #include __FBSDID("$FreeBSD$"); -#define __RUNETYPE_INTERNAL 1 +#define __RUNETYPE_INTERNAL 1 #include #include @@ -72,7 +72,7 @@ destruct_ctype(void *v) { struct xlocale_ctype *l = v; - if (&_DefaultRuneLocale != l->runes) + if (&_DefaultRuneLocale != l->runes) free(l->runes); free(l); } @@ -81,7 +81,7 @@ const _RuneLocale * __getCurrentRuneLocale(void) { - return XLOCALE_CTYPE(__get_locale())->runes; + return (XLOCALE_CTYPE(__get_locale())->runes); } static void @@ -144,7 +144,7 @@ __setrunelocale(struct xlocale_ctype *l, const char *e else if (strcmp(rl->__encoding, "EUC-TW") == 0) ret = _EUC_TW_init(l, rl); else if (strcmp(rl->__encoding, "GB18030") == 0) - ret = _GB18030_init(l, rl); + ret = _GB18030_init(l, rl); else if (strcmp(rl->__encoding, "GB2312") == 0) ret = _GB2312_init(l, rl); else if (strcmp(rl->__encoding, "GBK") == 0) @@ -204,10 +204,9 @@ __ctype_load(const char *locale, locale_t unused __unu struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1); l->header.header.destructor = destruct_ctype; - if (__setrunelocale(l, locale)) - { + if (__setrunelocale(l, locale)) { free(l); - return NULL; + return (NULL); } - return l; + return (l); } From owner-svn-src-all@freebsd.org Wed Sep 13 16:24:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C942E0412E; Wed, 13 Sep 2017 16: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 5A0E86C7C3; Wed, 13 Sep 2017 16:24:00 +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 v8DGNx6A006763; Wed, 13 Sep 2017 16:23:59 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGNxE0006762; Wed, 13 Sep 2017 16:23:59 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709131623.v8DGNxE0006762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 13 Sep 2017 16:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323549 - head/sys/dev/intpm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/intpm X-SVN-Commit-Revision: 323549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:24:00 -0000 Author: cem Date: Wed Sep 13 16:23:59 2017 New Revision: 323549 URL: https://svnweb.freebsd.org/changeset/base/323549 Log: intpm(4): Do not attach if io_res can not be allocated Attempts to use the driver without an io_res result in immediate panic. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Wed Sep 13 16:21:11 2017 (r323548) +++ head/sys/dev/intpm/intpm.c Wed Sep 13 16:23:59 2017 (r323549) @@ -191,6 +191,10 @@ sb8xx_attach(device_t dev) } sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->io_rid, RF_ACTIVE); + if (sc->io_res == NULL) { + device_printf(dev, "Could not allocate I/O space\n"); + return (ENXIO); + } sc->poll = 1; return (0); } From owner-svn-src-all@freebsd.org Wed Sep 13 16:31:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 870B7E04559; Wed, 13 Sep 2017 16:31:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (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 601B46CBB7; Wed, 13 Sep 2017 16:31:01 +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 9767D10A7DB; Wed, 13 Sep 2017 12:30:59 -0400 (EDT) From: John Baldwin To: Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323518 - head/sys/conf Date: Wed, 13 Sep 2017 09:26:38 -0700 Message-ID: <2493527.d9eFbJjTgo@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201709130356.v8D3u4ve095428@repo.freebsd.org> <9497208.8lqLTVLir6@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); Wed, 13 Sep 2017 12:30:59 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:31:02 -0000 On Wednesday, September 13, 2017 09:09:42 AM Sean Bruno wrote: > > On 09/13/17 08:35, John Baldwin wrote: > > On Wednesday, September 13, 2017 03:56:04 AM Sean Bruno wrote: > >> Author: sbruno > >> Date: Wed Sep 13 03:56:03 2017 > >> New Revision: 323518 > >> URL: https://svnweb.freebsd.org/changeset/base/323518 > >> > >> Log: > >> Jenkins i386 LINT build uses NOTES to generate its LINT kernel config. > >> > >> ixl(4) isn't in here either, so I'll remove lio(4) too. > > > > ixl missing is a bug, please put it in sys/amd64/conf/NOTES (or better yet, > > just fix the build on !amd64) > > > > > In the case of lio(4), Cavium is explicitly not compiling for 32 bit > architectures. I'm inquiring to find out if they want to build on the > other 64bit architectures we have. > > In the case of ixl(4), Intel has said that this is not supported on > 32bit architectures. > > I'm unsure what the best course of action is. The bug is more if drivers aren't in NOTES at all. Any thing listed in sys/conf/files.* should be in some NOTES file, either sys/conf/NOTES for things that are MI or sys/${arch}/conf/NOTES for things that are MD. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Sep 13 16:35:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5515DE049DE; Wed, 13 Sep 2017 16:35:19 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BD8C6D132; Wed, 13 Sep 2017 16:35:19 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DGZIY8010758; Wed, 13 Sep 2017 16:35:18 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGZGFB010742; Wed, 13 Sep 2017 16:35:16 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201709131635.v8DGZGFB010742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Wed, 13 Sep 2017 16:35:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323550 - in head: . etc/defaults etc/periodic/weekly libexec/makewhatis.local share/man/man5 sys/mips/rmi targets/pseudo/userland tools/build/mk tools/build/options usr.bin usr.bin/cat... X-SVN-Group: head X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in head: . etc/defaults etc/periodic/weekly libexec/makewhatis.local share/man/man5 sys/mips/rmi targets/pseudo/userland tools/build/mk tools/build/options usr.bin usr.bin/catman usr.bin/su usr.sbin/c... X-SVN-Commit-Revision: 323550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:35:19 -0000 Author: gordon Date: Wed Sep 13 16:35:16 2017 New Revision: 323550 URL: https://svnweb.freebsd.org/changeset/base/323550 Log: Deorbit catman. The tradeoff of disk for performance has long since tipped in favor of just rendering the manpage instead of relying on pre-formatted catpages. Note, this does not impede the ability to use existing catpages, it just removes the utility to generate them. Reviewed by: imp, allanjude Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D12317 Deleted: head/etc/periodic/weekly/330.catman head/usr.bin/catman/ Modified: head/ObsoleteFiles.inc head/etc/defaults/periodic.conf head/etc/periodic/weekly/Makefile head/libexec/makewhatis.local/Makefile head/libexec/makewhatis.local/makewhatis.local.8 head/libexec/makewhatis.local/makewhatis.local.sh head/share/man/man5/periodic.conf.5 head/share/man/man5/rc.conf.5 head/share/man/man5/src.conf.5 head/sys/mips/rmi/rootfs_list.txt head/targets/pseudo/userland/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc head/tools/build/options/WITHOUT_MAN_UTILS head/usr.bin/Makefile head/usr.bin/su/su.1 head/usr.sbin/crunch/examples/really-big.conf Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Sep 13 16:23:59 2017 (r323549) +++ head/ObsoleteFiles.inc Wed Sep 13 16:35:16 2017 (r323550) @@ -38,6 +38,13 @@ # xargs -n1 | sort | uniq -d; # done +# 20170913: remove unneeded catman utility +OLD_FILES+=etc/periodic/weekly/330.catman +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 + # 20170802: ksyms(4) ioctl interface was removed OLD_FILES+=usr/include/sys/ksyms.h Modified: head/etc/defaults/periodic.conf ============================================================================== --- head/etc/defaults/periodic.conf Wed Sep 13 16:23:59 2017 (r323549) +++ head/etc/defaults/periodic.conf Wed Sep 13 16:35:16 2017 (r323550) @@ -181,9 +181,6 @@ weekly_locate_enable="YES" # Update locate weekly # 320.whatis weekly_whatis_enable="YES" # Update whatis weekly -# 330.catman -weekly_catman_enable="NO" # Preformat man pages - # 340.noid weekly_noid_enable="NO" # Find unowned files weekly_noid_dirs="/" # Look here Modified: head/etc/periodic/weekly/Makefile ============================================================================== --- head/etc/periodic/weekly/Makefile Wed Sep 13 16:23:59 2017 (r323549) +++ head/etc/periodic/weekly/Makefile Wed Sep 13 16:35:16 2017 (r323550) @@ -13,7 +13,7 @@ FILES+= 310.locate .endif .if ${MK_MAN_UTILS} != "no" -FILES+= 320.whatis 330.catman +FILES+= 320.whatis .endif .include Modified: head/libexec/makewhatis.local/Makefile ============================================================================== --- head/libexec/makewhatis.local/Makefile Wed Sep 13 16:23:59 2017 (r323549) +++ head/libexec/makewhatis.local/Makefile Wed Sep 13 16:35:16 2017 (r323550) @@ -3,7 +3,5 @@ SCRIPTS= makewhatis.local.sh MAN= makewhatis.local.8 SCRIPTSDIR= ${LIBEXECDIR} -LINKS= ${SCRIPTSDIR}/makewhatis.local ${SCRIPTSDIR}/catman.local -MLINKS= makewhatis.local.8 catman.local.8 .include Modified: head/libexec/makewhatis.local/makewhatis.local.8 ============================================================================== --- head/libexec/makewhatis.local/makewhatis.local.8 Wed Sep 13 16:23:59 2017 (r323549) +++ head/libexec/makewhatis.local/makewhatis.local.8 Wed Sep 13 16:35:16 2017 (r323550) @@ -27,22 +27,19 @@ .Dt MAKEWHATIS.LOCAL 8 .Os .Sh NAME -.Nm makewhatis.local , catman.local -.Nd start makewhatis or catman for local file systems +.Nm makewhatis.local +.Nd start makewhatis for local file systems .Sh SYNOPSIS .Nm /usr/libexec/makewhatis.local .Op options .Ar directories ... -.Nm /usr/libexec/catman.local -.Op options -.Ar directories ... .Sh DESCRIPTION The .Nm utility starts .Xr makewhatis 1 only for file systems physically mounted on the system -where the +where .Nm is being executed. Running makewhatis @@ -53,25 +50,14 @@ your NFS server -- all NFS clients start makewhatis at So use this wrapper for .Xr cron 8 instead of calling makewhatis directly. -The -.Nm catman.local -utility is using for same purposes as -.Nm -but for -.Xr catman 1 . .Sh FILES .Bl -tag -width /etc/periodic/weekly/320.whatis.XXX -compact .It Pa /etc/periodic/weekly/320.whatis run .Nm every week -.It Pa /etc/periodic/weekly/330.catman -run -.Nm catman.local -every week .El .Sh SEE ALSO -.Xr catman 1 , .Xr find 1 , .Xr makewhatis 1 , .Xr cron 8 , Modified: head/libexec/makewhatis.local/makewhatis.local.sh ============================================================================== --- head/libexec/makewhatis.local/makewhatis.local.sh Wed Sep 13 16:23:59 2017 (r323549) +++ head/libexec/makewhatis.local/makewhatis.local.sh Wed Sep 13 16:35:16 2017 (r323550) @@ -31,8 +31,6 @@ # /usr may kill your NFS server -- all clients start makewhatis at the same # time! So use this wrapper instead calling makewhatis directly. # -# PS: this wrapper works also for catman(1) -# # $FreeBSD$ PATH=/bin:/usr/bin:$PATH; export PATH Modified: head/share/man/man5/periodic.conf.5 ============================================================================== --- head/share/man/man5/periodic.conf.5 Wed Sep 13 16:23:59 2017 (r323549) +++ head/share/man/man5/periodic.conf.5 Wed Sep 13 16:35:16 2017 (r323550) @@ -593,15 +593,6 @@ if you want to run This script regenerates the database used by the .Xr apropos 1 command. -.It Va weekly_catman_enable -.Pq Vt bool -Set to -.Dq Li YES -if you want to run -.Pa /usr/libexec/catman.local . -This script processes all out of date manual pages, speeding up the -.Xr man 1 -command at the expense of disk space. .It Va weekly_noid_enable .Pq Vt bool Set to Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Wed Sep 13 16:23:59 2017 (r323549) +++ head/share/man/man5/rc.conf.5 Wed Sep 13 16:35:16 2017 (r323550) @@ -4453,7 +4453,6 @@ configuration file. .It Pa /etc/rc.conf.local .El .Sh SEE ALSO -.Xr catman 1 , .Xr chmod 1 , .Xr gdb 1 , .Xr info 1 , Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Sep 13 16:23:59 2017 (r323549) +++ head/share/man/man5/src.conf.5 Wed Sep 13 16:35:16 2017 (r323550) @@ -1069,7 +1069,6 @@ Only the uncompressed versions will be installed. .It Va WITHOUT_MAN_UTILS Set to not build utilities for manual pages, .Xr apropos 1 , -.Xr catman 1 , .Xr makewhatis 1 , .Xr man 1 , .Xr whatis 1 , Modified: head/sys/mips/rmi/rootfs_list.txt ============================================================================== --- head/sys/mips/rmi/rootfs_list.txt Wed Sep 13 16:23:59 2017 (r323549) +++ head/sys/mips/rmi/rootfs_list.txt Wed Sep 13 16:35:16 2017 (r323550) @@ -158,7 +158,6 @@ ./etc/periodic/weekly/999.local ./etc/periodic/weekly/310.locate ./etc/periodic/weekly/320.whatis -./etc/periodic/weekly/330.catman ./etc/periodic/weekly/400.status-pkg ./etc/ppp ./etc/ppp/ppp.conf Modified: head/targets/pseudo/userland/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/Makefile.depend Wed Sep 13 16:23:59 2017 (r323549) +++ head/targets/pseudo/userland/Makefile.depend Wed Sep 13 16:35:16 2017 (r323550) @@ -182,7 +182,6 @@ DIRDEPS+= \ usr.bin/c99 \ usr.bin/calendar \ usr.bin/cap_mkdb \ - usr.bin/catman \ usr.bin/chat \ usr.bin/checknr \ usr.bin/chkey \ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Sep 13 16:23:59 2017 (r323549) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Sep 13 16:35:16 2017 (r323550) @@ -6097,24 +6097,19 @@ OLD_DIRS+=${MAN_DIRS} .if ${MK_MAN_UTILS} == no OLD_FILES+=etc/periodic/weekly/320.whatis -OLD_FILES+=etc/periodic/weekly/330.catman OLD_FILES+=usr/bin/apropos -OLD_FILES+=usr/bin/catman OLD_FILES+=usr/bin/makewhatis OLD_FILES+=usr/bin/man OLD_FILES+=usr/bin/manpath OLD_FILES+=usr/bin/whatis -OLD_FILES+=usr/libexec/catman.local OLD_FILES+=usr/libexec/makewhatis.local OLD_FILES+=usr/sbin/manctl OLD_FILES+=usr/share/man/man1/apropos.1.gz -OLD_FILES+=usr/share/man/man1/catman.1.gz OLD_FILES+=usr/share/man/man1/makewhatis.1.gz OLD_FILES+=usr/share/man/man1/man.1.gz OLD_FILES+=usr/share/man/man1/manpath.1.gz OLD_FILES+=usr/share/man/man1/whatis.1.gz OLD_FILES+=usr/share/man/man5/man.conf.5.gz -OLD_FILES+=usr/share/man/man8/catman.local.8.gz OLD_FILES+=usr/share/man/man8/makewhatis.local.8.gz OLD_FILES+=usr/share/man/man8/manctl.8.gz OLD_FILES+=usr/share/man/whatis Modified: head/tools/build/options/WITHOUT_MAN_UTILS ============================================================================== --- head/tools/build/options/WITHOUT_MAN_UTILS Wed Sep 13 16:23:59 2017 (r323549) +++ head/tools/build/options/WITHOUT_MAN_UTILS Wed Sep 13 16:35:16 2017 (r323550) @@ -1,7 +1,6 @@ .\" $FreeBSD$ Set to not build utilities for manual pages, .Xr apropos 1 , -.Xr catman 1 , .Xr makewhatis 1 , .Xr man 1 , .Xr whatis 1 , Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Wed Sep 13 16:23:59 2017 (r323549) +++ head/usr.bin/Makefile Wed Sep 13 16:35:16 2017 (r323550) @@ -239,7 +239,6 @@ SUBDIR.${MK_MAIL}+= from SUBDIR.${MK_MAIL}+= mail SUBDIR.${MK_MAIL}+= msgs SUBDIR.${MK_MAKE}+= bmake -SUBDIR.${MK_MAN_UTILS}+= catman SUBDIR.${MK_MAN_UTILS}+= man SUBDIR.${MK_NETCAT}+= nc SUBDIR.${MK_NIS}+= ypcat Modified: head/usr.bin/su/su.1 ============================================================================== --- head/usr.bin/su/su.1 Wed Sep 13 16:23:59 2017 (r323549) +++ head/usr.bin/su/su.1 Wed Sep 13 16:35:16 2017 (r323550) @@ -194,24 +194,24 @@ PAM configuration for .El .Sh EXAMPLES .Bl -tag -width 5n -compact -.It Li "su -m man -c catman" +.It Li "su -m operator -c poweroff" Starts a shell as user -.Li man , +.Li operator , and runs the command -.Li catman . -You will be asked for man's password unless your real UID is 0. +.Li poweroff . +You will be asked for operator's password unless your real UID is 0. Note that the .Fl m option is required since user -.Dq man +.Dq operator does not have a valid shell by default. In this example, .Fl c is passed to the shell of the user -.Dq man , +.Dq operator , and is not interpreted as an argument to .Nm . -.It Li "su -m man -c 'catman /usr/share/man /usr/local/man'" +.It Li "su -m operator -c 'shutdown -p now'" Same as above, but the target command consists of more than a single word and hence is quoted for use with the .Fl c @@ -219,7 +219,7 @@ option being passed to the shell. (Most shells expect the argument to .Fl c to be a single word). -.It Li "su -m -c staff man -c 'catman /usr/share/man /usr/local/man'" +.It Li "su -m -c staff operator -c 'shutdown -p now'" Same as above, but the target command is run with the resource limits of the login class .Dq staff . Modified: head/usr.sbin/crunch/examples/really-big.conf ============================================================================== --- head/usr.sbin/crunch/examples/really-big.conf Wed Sep 13 16:23:59 2017 (r323549) +++ head/usr.sbin/crunch/examples/really-big.conf Wed Sep 13 16:35:16 2017 (r323550) @@ -67,7 +67,7 @@ special tn3270 srcdir /usr/src/usr.bin/tn3270/tn3270 srcdirs /usr/src/usr.sbin -progs ac accton amd arp bad144 catman chown chroot config config.new cron +progs ac accton amd arp bad144 chown chroot config config.new cron progs dev_mkdb diskpart edquota flcopy gettable grfinfo hilinfo htable inetd progs iostat iteconfig kvm_mkdb mtree named portmap pppd progs pstat pwd_mkdb quot quotaon rarpd rbootd repquota rmt rpc.bootparamd From owner-svn-src-all@freebsd.org Wed Sep 13 16:37:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 486E8E04BDF for ; Wed, 13 Sep 2017 16:37:57 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B1406D2E4 for ; Wed, 13 Sep 2017 16:37:56 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: ee9c36bf-98a1-11e7-950d-03a3531dacf2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id ee9c36bf-98a1-11e7-950d-03a3531dacf2; Wed, 13 Sep 2017 16:38:12 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v8DGbtgD017846; Wed, 13 Sep 2017 10:37:55 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1505320675.32063.123.camel@freebsd.org> Subject: Re: svn commit: r323518 - head/sys/conf From: Ian Lepore To: John Baldwin , Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 13 Sep 2017 10:37:55 -0600 In-Reply-To: <2493527.d9eFbJjTgo@ralph.baldwin.cx> References: <201709130356.v8D3u4ve095428@repo.freebsd.org> <9497208.8lqLTVLir6@ralph.baldwin.cx> <2493527.d9eFbJjTgo@ralph.baldwin.cx> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:37:57 -0000 On Wed, 2017-09-13 at 09:26 -0700, John Baldwin wrote: > On Wednesday, September 13, 2017 09:09:42 AM Sean Bruno wrote: > > > > > > On 09/13/17 08:35, John Baldwin wrote: > > > > > > On Wednesday, September 13, 2017 03:56:04 AM Sean Bruno wrote: > > > > > > > > Author: sbruno > > > > Date: Wed Sep 13 03:56:03 2017 > > > > New Revision: 323518 > > > > URL: https://svnweb.freebsd.org/changeset/base/323518 > > > > > > > > Log: > > > >   Jenkins i386 LINT build uses NOTES to generate its LINT kernel config. > > > >    > > > >   ixl(4) isn't in here either, so I'll remove lio(4) too. > > > ixl missing is a bug, please put it in sys/amd64/conf/NOTES (or better yet, > > > just fix the build on !amd64) > > > > > > > In the case of lio(4), Cavium is explicitly not compiling for 32 bit > > architectures.  I'm inquiring to find out if they want to build on the > > other 64bit architectures we have. > > > > In the case of ixl(4), Intel has said that this is not supported on > > 32bit architectures. > > > > I'm unsure what the best course of action is. > The bug is more if drivers aren't in NOTES at all.  Any thing listed in > sys/conf/files.* should be in some NOTES file, either sys/conf/NOTES for > things that are MI or sys/${arch}/conf/NOTES for things that are MD. > Didn't somebody start a task list of things for junior hackers to work on?  Writing a script/tool to verify the assertion in that last sentence seems like a good candidate for such a list. -- Ian From owner-svn-src-all@freebsd.org Wed Sep 13 16:43:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43824E050F5; Wed, 13 Sep 2017 16:43: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 110756D7FD; Wed, 13 Sep 2017 16:43:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DGhW9E014852; Wed, 13 Sep 2017 16:43:32 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGhW4a014851; Wed, 13 Sep 2017 16:43:32 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709131643.v8DGhW4a014851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 13 Sep 2017 16:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323551 - head/sys/dev/intpm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/intpm X-SVN-Commit-Revision: 323551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:43:33 -0000 Author: cem Date: Wed Sep 13 16:43:31 2017 New Revision: 323551 URL: https://svnweb.freebsd.org/changeset/base/323551 Log: intpm(4): While here, remove redundant 'res' check Reported by: avg Sponsored by: Dell EMC Isilon Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Wed Sep 13 16:35:16 2017 (r323550) +++ head/sys/dev/intpm/intpm.c Wed Sep 13 16:43:31 2017 (r323551) @@ -185,10 +185,6 @@ sb8xx_attach(device_t dev) device_printf(dev, "bus_set_resource for SMBus IO failed\n"); return (ENXIO); } - if (res == NULL) { - device_printf(dev, "bus_alloc_resource for SMBus IO failed\n"); - return (ENXIO); - } sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->io_rid, RF_ACTIVE); if (sc->io_res == NULL) { From owner-svn-src-all@freebsd.org Wed Sep 13 16:47:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BBFAE05367; Wed, 13 Sep 2017 16:47:24 +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 1BC086D9FF; Wed, 13 Sep 2017 16:47:24 +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 v8DGlNLX015037; Wed, 13 Sep 2017 16:47:23 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGlNTY015036; Wed, 13 Sep 2017 16:47:23 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201709131647.v8DGlNTY015036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 13 Sep 2017 16:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323552 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:47:24 -0000 Author: glebius Date: Wed Sep 13 16:47:23 2017 New Revision: 323552 URL: https://svnweb.freebsd.org/changeset/base/323552 Log: Fix two issues with not ready data in sockets (read: sendfile) in UNIX sockets. o Check that socket is still connected in uipc_ready(). If not we are responsible to free mbufs. o In uipc_send() if socket appears to be disconnected, but we are sending data with pending I/Os, don't free mbufs. Reported by: Kevin Bowling Tested by: Kevin Bowling PR: 222259 Reported by: Mark Martinec MFC after: 3 days Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Wed Sep 13 16:43:31 2017 (r323551) +++ head/sys/kern/uipc_usrreq.c Wed Sep 13 16:47:23 2017 (r323552) @@ -1056,7 +1056,11 @@ uipc_send(struct socket *so, int flags, struct mbuf *m release: if (control != NULL) m_freem(control); - if (m != NULL) + /* + * In case of PRUS_NOTREADY, uipc_ready() is responsible + * for freeing memory. + */ + if (m != NULL && (flags & PRUS_NOTREADY) == 0) m_freem(m); return (error); } @@ -1071,7 +1075,12 @@ uipc_ready(struct socket *so, struct mbuf *m, int coun unp = sotounpcb(so); UNP_LINK_RLOCK(); - unp2 = unp->unp_conn; + if ((unp2 = unp->unp_conn) == NULL) { + UNP_LINK_RUNLOCK(); + for (int i = 0; i < count; i++) + m = m_free(m); + return (ECONNRESET); + } UNP_PCB_LOCK(unp2); so2 = unp2->unp_socket; From owner-svn-src-all@freebsd.org Wed Sep 13 16:54:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB04EE0589A; Wed, 13 Sep 2017 16:54:28 +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 B6C026DFC7; Wed, 13 Sep 2017 16:54: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 v8DGsRYu019090; Wed, 13 Sep 2017 16:54:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DGsRPN019085; Wed, 13 Sep 2017 16:54:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709131654.v8DGsRPN019085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 13 Sep 2017 16:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323553 - in head/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/ti dev/glxiic X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/ti dev/glxiic X-SVN-Commit-Revision: 323553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:54:29 -0000 Author: ian Date: Wed Sep 13 16:54:27 2017 New Revision: 323553 URL: https://svnweb.freebsd.org/changeset/base/323553 Log: Defer attaching and probing iicbus and its children until interrupts are available, in i2c controller drivers that require interrupts for transfers. This is the result of auditing all 22 existing drivers that attach iicbus. These drivers were the only ones remaining that require interrupts and were not using config_intrhook to defer attachment. That has led, over the years, to various i2c slave device drivers needing to use config_intrhook themselves rather than performing bus transactions in their probe() and attach() methods, just in case they were attached too early. Modified: head/sys/arm/at91/at91_twi.c head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c head/sys/arm/freescale/imx/imx_i2c.c head/sys/arm/ti/ti_i2c.c head/sys/dev/glxiic/glxiic.c Modified: head/sys/arm/at91/at91_twi.c ============================================================================== --- head/sys/arm/at91/at91_twi.c Wed Sep 13 16:47:23 2017 (r323552) +++ head/sys/arm/at91/at91_twi.c Wed Sep 13 16:54:27 2017 (r323553) @@ -160,8 +160,8 @@ at91_twi_attach(device_t dev) if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) device_printf(dev, "could not allocate iicbus instance\n"); - /* probe and attach the iicbus */ - bus_generic_attach(dev); + /* Probe and attach the iicbus when interrupts are available. */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); out: if (err) at91_twi_deactivate(dev); Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Sep 13 16:47:23 2017 (r323552) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Sep 13 16:54:27 2017 (r323553) @@ -309,7 +309,10 @@ bcm_bsc_attach(device_t dev) return (ENXIO); } - return (bus_generic_attach(dev)); + /* Probe and attach the iicbus when interrupts are available. */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + + return (0); } static int Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Wed Sep 13 16:47:23 2017 (r323552) +++ head/sys/arm/freescale/imx/imx_i2c.c Wed Sep 13 16:54:27 2017 (r323553) @@ -443,7 +443,8 @@ no_recovery: /* We don't do a hardware reset here because iicbus_attach() does it. */ - bus_generic_attach(dev); + /* Probe and attach the iicbus when interrupts are available. */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); return (0); } Modified: head/sys/arm/ti/ti_i2c.c ============================================================================== --- head/sys/arm/ti/ti_i2c.c Wed Sep 13 16:47:23 2017 (r323552) +++ head/sys/arm/ti/ti_i2c.c Wed Sep 13 16:54:27 2017 (r323553) @@ -37,11 +37,6 @@ * incorporate that sometime in the future. The idea being that for transaction * larger than a certain size the DMA engine is used, for anything less the * normal interrupt/fifo driven option is used. - * - * - * WARNING: This driver uses mtx_sleep and interrupts to perform transactions, - * which means you can't do a transaction during startup before the interrupts - * have been enabled. Hint - the freebsd function config_intrhook_establish(). */ #include @@ -909,8 +904,8 @@ ti_i2c_attach(device_t dev) goto out; } - /* Probe and attach the iicbus */ - bus_generic_attach(dev); + /* Probe and attach the iicbus when interrupts are available. */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); out: if (err) { Modified: head/sys/dev/glxiic/glxiic.c ============================================================================== --- head/sys/dev/glxiic/glxiic.c Wed Sep 13 16:47:23 2017 (r323552) +++ head/sys/dev/glxiic/glxiic.c Wed Sep 13 16:54:27 2017 (r323553) @@ -408,11 +408,10 @@ glxiic_attach(device_t dev) glxiic_gpio_enable(sc); glxiic_smb_enable(sc, IIC_FASTEST, 0); - error = bus_generic_attach(dev); - if (error != 0) { - device_printf(dev, "Could not probe and attach children\n"); - error = ENXIO; - } + /* Probe and attach the iicbus when interrupts are available. */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + error = 0; + out: if (error != 0) { callout_drain(&sc->callout); From owner-svn-src-all@freebsd.org Wed Sep 13 16:56:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A2F9E05A81; Wed, 13 Sep 2017 16:56:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 5EB566E192; Wed, 13 Sep 2017 16:56:36 +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 mail107.syd.optusnet.com.au (Postfix) with ESMTPS id BBD9BD4AF9B; Thu, 14 Sep 2017 02:56:26 +1000 (AEST) Date: Thu, 14 Sep 2017 02:56:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323518 - head/sys/conf In-Reply-To: <2493527.d9eFbJjTgo@ralph.baldwin.cx> Message-ID: <20170914023855.R833@besplex.bde.org> References: <201709130356.v8D3u4ve095428@repo.freebsd.org> <9497208.8lqLTVLir6@ralph.baldwin.cx> <2493527.d9eFbJjTgo@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=aACBSZzDBDV-K70gFSMA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 16:56:36 -0000 On Wed, 13 Sep 2017, John Baldwin wrote: > On Wednesday, September 13, 2017 09:09:42 AM Sean Bruno wrote: >> >> On 09/13/17 08:35, John Baldwin wrote: >>> On Wednesday, September 13, 2017 03:56:04 AM Sean Bruno wrote: >>>> Author: sbruno >>>> Date: Wed Sep 13 03:56:03 2017 >>>> New Revision: 323518 >>>> URL: https://svnweb.freebsd.org/changeset/base/323518 >>>> >>>> Log: >>>> Jenkins i386 LINT build uses NOTES to generate its LINT kernel config. >>>> >>>> ixl(4) isn't in here either, so I'll remove lio(4) too. >>> >>> ixl missing is a bug, please put it in sys/amd64/conf/NOTES (or better yet, >>> just fix the build on !amd64) >> >> In the case of lio(4), Cavium is explicitly not compiling for 32 bit >> architectures. I'm inquiring to find out if they want to build on the >> other 64bit architectures we have. >> >> In the case of ixl(4), Intel has said that this is not supported on >> 32bit architectures. >> >> I'm unsure what the best course of action is. Put it in NOTES for arches that support it. Strictly it should be in MD NOTES, but MI notes already has lots of MD buses like pci and drivers like bge that depend on pci. Some MD NOTES have many nodevice lines to kill non-MI things in MI NOTES, but apparently none needs to kill pci or the hundreds of drivers that depend on it yet. > The bug is more if drivers aren't in NOTES at all. Any thing listed in > sys/conf/files.* should be in some NOTES file, either sys/conf/NOTES for > things that are MI or sys/${arch}/conf/NOTES for things that are MD. The most broken drivers aren't even listed in sys/conf/files.*. Bruce From owner-svn-src-all@freebsd.org Wed Sep 13 17:00:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01BEAE05C41; Wed, 13 Sep 2017 17:00:04 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D16906E37B; Wed, 13 Sep 2017 17:00:03 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DH03a0019492; Wed, 13 Sep 2017 17:00:03 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DH02ga019489; Wed, 13 Sep 2017 17:00:02 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201709131700.v8DH02ga019489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 13 Sep 2017 17:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323554 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 323554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 17:00:04 -0000 Author: allanjude Date: Wed Sep 13 17:00:02 2017 New Revision: 323554 URL: https://svnweb.freebsd.org/changeset/base/323554 Log: Increase EFI boot file size frok 128k to 384k generate_fat.sh does the following: - create an 800kb zero-filled file - create an md device backed by this file - format the device fat12 - mount the filesystem - create the EFI ESP directory structure - create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, etc) - Adds a marker to the beginning of the file, and pad it to 384kb - 384kb was chosen as it is less than half of 800kb, thus allowing users to keep a backup of their older boot file in the small partition - Unmount the filesystem - Scan the image and find the offset where the marker was inserted - The process requires root, to make image generation easier, images for each architecture are pregenerated, compressed with xz, and checked into svn. The Makefile that generates boot1.efifat does the following: - Ensure the compiled boot1.efi file is no larger than the generated image - Decompress the template created by generate-fat.sh - dd the contents of boot1.efi into boot1.efifat starting at the offset where the marker is found. This allows any file less than the maximum size to be written into the fat filesystem without having to mount it, so no root privileges are required. Later work by imp and myself makes bsdinstall create a 200mb fat16 instead of using this process, but it is retained to make image generation easier. Submitted by: Eric McCorkle (original version) Reviewed by: emaste, tsoome, Eric McCorkle MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9680 Added: head/sys/boot/efi/boot1/fat-amd64.tmpl.xz (contents, props changed) head/sys/boot/efi/boot1/fat-arm.tmpl.xz (contents, props changed) head/sys/boot/efi/boot1/fat-arm64.tmpl.xz (contents, props changed) head/sys/boot/efi/boot1/fat-i386.tmpl.xz (contents, props changed) Deleted: head/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu head/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu head/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu head/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu Modified: head/sys/boot/efi/boot1/Makefile head/sys/boot/efi/boot1/Makefile.fat head/sys/boot/efi/boot1/generate-fat.sh Modified: head/sys/boot/efi/boot1/Makefile ============================================================================== --- head/sys/boot/efi/boot1/Makefile Wed Sep 13 16:54:27 2017 (r323553) +++ head/sys/boot/efi/boot1/Makefile Wed Sep 13 17:00:02 2017 (r323554) @@ -135,9 +135,7 @@ boot1.efifat: boot1.efi exit 1; \ fi echo ${.OBJDIR} - uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu - mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 - bzip2 -f -d ${.TARGET}.bz2 + xz -d -c ${.CURDIR}/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc CLEANFILES= boot1.efi boot1.efifat Modified: head/sys/boot/efi/boot1/Makefile.fat ============================================================================== --- head/sys/boot/efi/boot1/Makefile.fat Wed Sep 13 16:54:27 2017 (r323553) +++ head/sys/boot/efi/boot1/Makefile.fat Wed Sep 13 17:00:02 2017 (r323554) @@ -1,4 +1,4 @@ # This file autogenerated by generate-fat.sh - DO NOT EDIT # $FreeBSD$ BOOT1_OFFSET=0x2d -BOOT1_MAXSIZE=131072 +BOOT1_MAXSIZE=393216 Added: head/sys/boot/efi/boot1/fat-amd64.tmpl.xz ============================================================================== Binary file. No diff available. Added: head/sys/boot/efi/boot1/fat-arm.tmpl.xz ============================================================================== Binary file. No diff available. Added: head/sys/boot/efi/boot1/fat-arm64.tmpl.xz ============================================================================== Binary file. No diff available. Added: head/sys/boot/efi/boot1/fat-i386.tmpl.xz ============================================================================== Binary file. No diff available. Modified: head/sys/boot/efi/boot1/generate-fat.sh ============================================================================== --- head/sys/boot/efi/boot1/generate-fat.sh Wed Sep 13 16:54:27 2017 (r323553) +++ head/sys/boot/efi/boot1/generate-fat.sh Wed Sep 13 17:00:02 2017 (r323554) @@ -14,7 +14,7 @@ FAT_SIZE=1600 #Size in 512-byte blocks of the produced image BOOT1_OFFSET=2d -BOOT1_SIZE=128k +BOOT1_SIZE=384k if [ $(id -u) != 0 ]; then echo "${0##*/}: must run as root" >&2 @@ -70,13 +70,7 @@ while read ARCH FILENAME; do exit 1 fi - bzip2 $OUTPUT_FILE - echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu - echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu - echo "\$FreeBSD\$" >> $OUTPUT_FILE.bz2.uu - - uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu - rm $OUTPUT_FILE.bz2 + xz -f $OUTPUT_FILE done < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFF7EE060E3; Wed, 13 Sep 2017 17:03:03 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 893C36E90C; Wed, 13 Sep 2017 17:03:02 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 52CA813558; Wed, 13 Sep 2017 17:02:55 +0000 (UTC) Subject: Re: svn commit: r323554 - head/sys/boot/efi/boot1 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709131700.v8DH02ga019489@repo.freebsd.org> From: Allan Jude Message-ID: <905ca592-5f9e-cad2-15d9-89cb39b47b46@freebsd.org> Date: Wed, 13 Sep 2017 13:02:51 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <201709131700.v8DH02ga019489@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="If8wIlS0BDs6wQaPDPDIVCBi0JnU0wcUS" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 17:03:03 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --If8wIlS0BDs6wQaPDPDIVCBi0JnU0wcUS Content-Type: multipart/mixed; boundary="RiBmPanumEdkELgiwMdUe8hUnVKctqwjh"; protected-headers="v1" From: Allan Jude To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <905ca592-5f9e-cad2-15d9-89cb39b47b46@freebsd.org> Subject: Re: svn commit: r323554 - head/sys/boot/efi/boot1 References: <201709131700.v8DH02ga019489@repo.freebsd.org> In-Reply-To: <201709131700.v8DH02ga019489@repo.freebsd.org> --RiBmPanumEdkELgiwMdUe8hUnVKctqwjh Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2017-09-13 13:00, Allan Jude wrote: > Author: allanjude > Date: Wed Sep 13 17:00:02 2017 > New Revision: 323554 > URL: https://svnweb.freebsd.org/changeset/base/323554 >=20 > Log: > Increase EFI boot file size frok 128k to 384k > =20 > generate_fat.sh does the following: > - create an 800kb zero-filled file > - create an md device backed by this file > - format the device fat12 > - mount the filesystem > - create the EFI ESP directory structure > - create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, = etc) > - Adds a marker to the beginning of the file, and pad it to 384kb > - 384kb was chosen as it is less than half of 800kb, thus allowing > users to keep a backup of their older boot file in the small partit= ion > - Unmount the filesystem > - Scan the image and find the offset where the marker was inserted > - The process requires root, to make image generation easier, images = for > each architecture are pregenerated, compressed with xz, and checked= > into svn. > =20 > The Makefile that generates boot1.efifat does the following: > - Ensure the compiled boot1.efi file is no larger than the generated = image > - Decompress the template created by generate-fat.sh > - dd the contents of boot1.efi into boot1.efifat starting at the offs= et > where the marker is found. This allows any file less than the maxim= um > size to be written into the fat filesystem without having to mount = it, > so no root privileges are required. > =20 > Later work by imp and myself makes bsdinstall create a 200mb fat16 in= stead > of using this process, but it is retained to make image generation ea= sier. > =20 > Submitted by: Eric McCorkle (original version) > Reviewed by: emaste, tsoome, Eric McCorkle > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D9680 >=20 > Added: > head/sys/boot/efi/boot1/fat-amd64.tmpl.xz (contents, props changed)= > head/sys/boot/efi/boot1/fat-arm.tmpl.xz (contents, props changed) > head/sys/boot/efi/boot1/fat-arm64.tmpl.xz (contents, props changed)= > head/sys/boot/efi/boot1/fat-i386.tmpl.xz (contents, props changed) > Deleted: > head/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu > head/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu > head/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu > head/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu > Modified: > head/sys/boot/efi/boot1/Makefile > head/sys/boot/efi/boot1/Makefile.fat > head/sys/boot/efi/boot1/generate-fat.sh >=20 I forgot to mention: I did away with uuencoding the binary files, because svn and git can handle binary files just fine, and it was just silly. I switched from bzip to xzip, as we are getting away from using bzip as a part of the toolchain. --=20 Allan Jude --RiBmPanumEdkELgiwMdUe8hUnVKctqwjh-- --If8wIlS0BDs6wQaPDPDIVCBi0JnU0wcUS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJZuWS+AAoJEBmVNT4SmAt+ij4P/RbwDlUFDzHX3cUjXbpMn7Sz UXUSPydbtMNHg6MlwkH1o2JGt5k+QRfeYmmJjws1TcBCClksjRGa2N7CKJqXmwdC uHTZQTBoN4tZ8XlrUF5s5ZgqwXA9DUbWDA4crw2hDoGYouYZJnGUAWMTPpgXncLH tAgbAVXvqLVspWRmnpSATBQHmePE9ICEpiUc41ljCgpboSEecJE9MBV8+IegqK/9 9VFfyKTYKg9RLm8faD2TJnsQ7B+7O+YnVO8O3u5PzipqCvZHW6GKUnm01mzZMScW ejyyF/UlLqxMzEfXjnElgFqP0Lq8Ictuz4W0w0fmcR4JCRrz/tkjr4gs07nA9kqn miNJWRwuGRpTCOJGFA9OZgaLr9yvwqP2ci5K4KMQvjc44FIKUKrDeHiX1e+kmVcX KTn2t+jGHlyMnxjxTxAZUKHsgbHMnH/CvVtIs8teCxgOTah3KihWYDo5gcwau2Gk YaA6u8s4j/JG52boXkQEalMN8m9nuahZttJJMhlqGK7rJ3h2QsBvxQ0S47aUxzF5 UmCaKhNOlxqlnq6WxgnnuPkq64mB1qvp9x8GnI0ctRrta551ENsieWZgQQCi/1Iw Zd6Se+8AXh/KubdvHMg0tGoH42ZmBOMlHjSnmpLq1YefrVlRjRGVfQRxKjvp6h8N IPekimgPbLQGQhe0gSUb =/ABy -----END PGP SIGNATURE----- --If8wIlS0BDs6wQaPDPDIVCBi0JnU0wcUS-- From owner-svn-src-all@freebsd.org Wed Sep 13 17:43:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C33D4E077D4; Wed, 13 Sep 2017 17:43: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 8D4126FD1E; Wed, 13 Sep 2017 17:43: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 v8DHhITb039454; Wed, 13 Sep 2017 17:43:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DHhI4w039453; Wed, 13 Sep 2017 17:43:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709131743.v8DHhI4w039453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 13 Sep 2017 17:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323555 - head/sys/dev/intpm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/intpm X-SVN-Commit-Revision: 323555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 17:43:19 -0000 Author: cem Date: Wed Sep 13 17:43:18 2017 New Revision: 323555 URL: https://svnweb.freebsd.org/changeset/base/323555 Log: intpm(4): Decrease requested i/o port range width On some AMD FCH devices driven by intpm(4) (read: mine), the SMBus I/O port range is split in two and the low range is only 0x10 wide. intpm(4) does not access any registers above 0x0f, so there is no need for the wider range. Discussed with: avg Sponsored by: Dell EMC Isilon Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Wed Sep 13 17:00:02 2017 (r323554) +++ head/sys/dev/intpm/intpm.c Wed Sep 13 17:43:18 2017 (r323555) @@ -128,7 +128,7 @@ amd_pmio_read(struct resource *res, uint8_t reg) static int sb8xx_attach(device_t dev) { - static const int AMDSB_SMBIO_WIDTH = 0x14; + static const int AMDSB_SMBIO_WIDTH = 0x10; struct intsmb_softc *sc; struct resource *res; uint32_t devid; From owner-svn-src-all@freebsd.org Wed Sep 13 17:49:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9589FE07B95; Wed, 13 Sep 2017 17:49:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EE04700D3; Wed, 13 Sep 2017 17:49:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DHnNDQ039925; Wed, 13 Sep 2017 17:49:23 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DHnNg0039924; Wed, 13 Sep 2017 17:49:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <201709131749.v8DHnNg0039924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 13 Sep 2017 17:49:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323556 - in head/sys: dev/cxgb/ulp modules/cxgb modules/cxgb/iw_cxgb modules/cxgb/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys: dev/cxgb/ulp modules/cxgb modules/cxgb/iw_cxgb modules/cxgb/tom X-SVN-Commit-Revision: 323556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 17:49:24 -0000 Author: np Date: Wed Sep 13 17:49:23 2017 New Revision: 323556 URL: https://svnweb.freebsd.org/changeset/base/323556 Log: Retire the T3 iWARP and TOE drivers. This saves catch-up work when OFED or other kernel infrastructure changes. Note that this doesn't affect the base cxgb(4) NIC driver for T3 at all. MFC after: No MFC. Sponsored by: Chelsio Communications Deleted: head/sys/dev/cxgb/ulp/ head/sys/modules/cxgb/iw_cxgb/ head/sys/modules/cxgb/tom/ Modified: head/sys/modules/cxgb/Makefile Modified: head/sys/modules/cxgb/Makefile ============================================================================== --- head/sys/modules/cxgb/Makefile Wed Sep 13 17:43:18 2017 (r323555) +++ head/sys/modules/cxgb/Makefile Wed Sep 13 17:49:23 2017 (r323556) @@ -5,14 +5,5 @@ SYSDIR?=${SRCTOP}/sys SUBDIR= cxgb SUBDIR+= cxgb_t3fw -SUBDIR+= ${_tom} -SUBDIR+= ${_iw_cxgb} - -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" -_tom= tom -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_iw_cxgb= iw_cxgb -.endif -.endif .include From owner-svn-src-all@freebsd.org Wed Sep 13 18:15:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A8B2E08CFC; Wed, 13 Sep 2017 18:15:46 +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 2744270F07; Wed, 13 Sep 2017 18:15:46 +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 BF0E110A7B9; Wed, 13 Sep 2017 14:15:44 -0400 (EDT) From: John Baldwin To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r314942 - head/usr.bin/awk Date: Wed, 13 Sep 2017 11:15:39 -0700 Message-ID: <5311676.nqsSxOZALl@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201703090327.v293RrEY016498@repo.freebsd.org> References: <201703090327.v293RrEY016498@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 13 Sep 2017 14:15:44 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 18:15:46 -0000 On Thursday, March 09, 2017 03:27:53 AM Baptiste Daroussin wrote: > Author: bapt > Date: Thu Mar 9 03:27:53 2017 > New Revision: 314942 > URL: https://svnweb.freebsd.org/changeset/base/314942 > > Log: > Import the awk(1) manpage from OpenBSD > > As discussed during AsiaBSDcon devsummit, import the manpage from OpenBSD which > is has been rewritten in mdoc(7) format making it readable by default with > mandoc, it also has been extended by OpenBSD to cover all awk(1) options > > Obtained from: OpenBSD > MFH: 1 week One problem noted today by imp@ is that this doesn't quite document the awk we ship: % echo 42 | awk '{ print lshift($1, 1) }' awk: calling undefined function lshift input record number 1, file source line number 1 None of the bit operations described in this manpage are implemented in one-true-awk. Hmm, it seems that OpenBSD added those as a local patch relative to one-true-awk in 1.10 of lex.c. So Someone(tm) needs to probably compare OpenBSD's awk to one-true-awk to see what local changes they have and either update the manpage here or pull the local diffs across. (I'd probably we just grab the implementation for the bitwise ops myself.) -- John Baldwin From owner-svn-src-all@freebsd.org Wed Sep 13 18:32:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D0FDE09723; Wed, 13 Sep 2017 18:32:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A60271756; Wed, 13 Sep 2017 18:32:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DIWhFR059909; Wed, 13 Sep 2017 18:32:43 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DIWhjD059908; Wed, 13 Sep 2017 18:32:43 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709131832.v8DIWhjD059908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 13 Sep 2017 18:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323557 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 323557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 18:32:44 -0000 Author: gjb Date: Wed Sep 13 18:32:43 2017 New Revision: 323557 URL: https://svnweb.freebsd.org/changeset/base/323557 Log: Remove an unneeded sentence stop. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/siba.4 Modified: head/share/man/man4/siba.4 ============================================================================== --- head/share/man/man4/siba.4 Wed Sep 13 17:49:23 2017 (r323556) +++ head/share/man/man4/siba.4 Wed Sep 13 18:32:43 2017 (r323557) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 3, 2016 +.Dd September 13, 2017 .Dt SIBA 4 .Os .Sh NAME @@ -75,7 +75,7 @@ The device driver first appeared in .Fx 8.0 . The driver was rewritten for -.Fx 11.0 . +.Fx 11.0 to support the common Broadcom .Xr bhnd 4 bus interface. From owner-svn-src-all@freebsd.org Wed Sep 13 18:40:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3C79E09BFD for ; Wed, 13 Sep 2017 18:40:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm13-vm4.bullet.mail.ne1.yahoo.com (nm13-vm4.bullet.mail.ne1.yahoo.com [98.138.91.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2A471AEF for ; Wed, 13 Sep 2017 18:40:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1505327836; bh=MlvcPt7AZCO04MjHG7VpIKUFmleTDTgzultUZSeYMZU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=Y39GC++FcmlL/CGr/y3dzBi7X1K+HTOSyK8AsC8J23suEFsVllBUxNqoe0WFvVcOcx51e57Z+ZRQ539c8i53K02aKkjnr7HOupC6CCIZkBXpZyHd+8ehabMlSe+CgtPJamv9Ebh9xWqmcka/yEnS9HPlFzPAk9npGjH2c6FMRbMYuppfgI5iXDKZYLGxV0srAcgm7nIh48UZThV5OJIJzQNdYL4Dvsh84UMpoQyncD0clnWu/Lkm9F8Ahnn+yKbeXvjcUlbffl9QvmiwnuKdiXq9H336x6FW47CxL/AKg/0+MPH/JdmOXX92xri35wBqaU/yJZfRLtrEoCiB4oBiEg== Received: from [98.138.101.129] by nm13.bullet.mail.ne1.yahoo.com with NNFMP; 13 Sep 2017 18:37:16 -0000 Received: from [98.138.84.43] by tm17.bullet.mail.ne1.yahoo.com with NNFMP; 13 Sep 2017 18:37:15 -0000 Received: from [127.0.0.1] by smtp111.mail.ne1.yahoo.com with NNFMP; 13 Sep 2017 18:37:15 -0000 X-Yahoo-Newman-Id: 982245.51129.bm@smtp111.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: E2fPxXIVM1lmr8NB_8tl0blaErb4z6S6DMQ2.amAYDahdoC QzKPLzZXv8hpkztdVwHTHZEwjRQXee9pxEDQ2VtbNQMvEcE5FR9nrfApzyiY .4VbGb_vCD3K1B2elyDMCFhI.H7VbZCz7wtFSB1K9ZiPhKBtrEwPJnvnEM5S xGQ8VR2FLK_xYgnuVCt9LYObDMuLCFgw8HVcs6sHkGiyKaOO7Alexi8fHABG mJz7CXJVpZzC83NB.jYOutojaNbPKvDlfhpYfXO4NqdNSCPp5b7J6ev3dmDg QqZaRuoh7UwRCOWJQ8McGs9kmuUYE7z.Dz48TCJw_ZRhEXirH6fri_.xicvf QrAyVH_ARRBrAVkfNXI1qb7ZlUQE070uaaDGa3e51QpdjW_S_wsI587QMeg2 LolGcZlW5jJi6yncLRepXup3aRUYYDymTdAN1YnlAGDLNm0B.J.dMUS1LeHd xWp65_DBw28MylBk0xRfbe048gq9xi7QLFuS2igBwj7N3XYACTp8- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r314942 - head/usr.bin/awk To: John Baldwin , Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201703090327.v293RrEY016498@repo.freebsd.org> <5311676.nqsSxOZALl@ralph.baldwin.cx> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <431fe768-f781-e19f-0e2c-bdffa9be9273@FreeBSD.org> Date: Wed, 13 Sep 2017 13:37:14 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <5311676.nqsSxOZALl@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 18:40:02 -0000 On 13/09/2017 13:15, John Baldwin wrote: > On Thursday, March 09, 2017 03:27:53 AM Baptiste Daroussin wrote: >> Author: bapt >> Date: Thu Mar 9 03:27:53 2017 >> New Revision: 314942 >> URL: https://svnweb.freebsd.org/changeset/base/314942 >> >> Log: >> Import the awk(1) manpage from OpenBSD >> >> As discussed during AsiaBSDcon devsummit, import the manpage from OpenBSD which >> is has been rewritten in mdoc(7) format making it readable by default with >> mandoc, it also has been extended by OpenBSD to cover all awk(1) options >> >> Obtained from: OpenBSD >> MFH: 1 week > One problem noted today by imp@ is that this doesn't quite document the awk we > ship: > > % echo 42 | awk '{ print lshift($1, 1) }' > awk: calling undefined function lshift > input record number 1, file > source line number 1 > > None of the bit operations described in this manpage are implemented in > one-true-awk. Hmm, it seems that OpenBSD added those as a local patch > relative to one-true-awk in 1.10 of lex.c. So Someone(tm) needs to probably > compare OpenBSD's awk to one-true-awk to see what local changes they have > and either update the manpage here or pull the local diffs across. (I'd > probably we just grab the implementation for the bitwise ops myself.) > Hmm ... TBH, many years ago I tried to upstream the OpenBSD (actually gawk) extensions  but upstream (bwk) was not interested. Pedro. From owner-svn-src-all@freebsd.org Wed Sep 13 18:42:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72A19E09E7E; Wed, 13 Sep 2017 18:42:00 +0000 (UTC) (envelope-from bapt@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 53DBE71D42; Wed, 13 Sep 2017 18:42:00 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1235) id 9C32E10A5C; Wed, 13 Sep 2017 18:41:59 +0000 (UTC) Date: Wed, 13 Sep 2017 20:41:59 +0200 From: Baptiste Daroussin To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r314942 - head/usr.bin/awk Message-ID: <20170913184159.fbcihrrdwgttckms@ivaldir.net> References: <201703090327.v293RrEY016498@repo.freebsd.org> <5311676.nqsSxOZALl@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="f422deqlvtzqdkhx" Content-Disposition: inline In-Reply-To: <5311676.nqsSxOZALl@ralph.baldwin.cx> User-Agent: NeoMutt/20170907 (1.9.0) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 18:42:00 -0000 --f422deqlvtzqdkhx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 13, 2017 at 06:15:39PM +0000, John Baldwin wrote: > On Thursday, March 09, 2017 03:27:53 AM Baptiste Daroussin wrote: > > Author: bapt > > Date: Thu Mar 9 03:27:53 2017 > > New Revision: 314942 > > URL: https://svnweb.freebsd.org/changeset/base/314942 > >=20 > > Log: > > Import the awk(1) manpage from OpenBSD > > =20 > > As discussed during AsiaBSDcon devsummit, import the manpage from Ope= nBSD which > > is has been rewritten in mdoc(7) format making it readable by default= with > > mandoc, it also has been extended by OpenBSD to cover all awk(1) opti= ons > > =20 > > Obtained from: OpenBSD > > MFH: 1 week >=20 > One problem noted today by imp@ is that this doesn't quite document the a= wk we > ship: >=20 > % echo 42 | awk '{ print lshift($1, 1) }' > awk: calling undefined function lshift > input record number 1, file=20 > source line number 1 >=20 > None of the bit operations described in this manpage are implemented in > one-true-awk. Hmm, it seems that OpenBSD added those as a local patch > relative to one-true-awk in 1.10 of lex.c. So Someone(tm) needs to proba= bly > compare OpenBSD's awk to one-true-awk to see what local changes they have > and either update the manpage here or pull the local diffs across. (I'd > probably we just grab the implementation for the bitwise ops myself.) >=20 Good catch, I will have a look after eurobsdcon Best regards, Bapt --f422deqlvtzqdkhx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlm5e/QACgkQY4mL3PG3 PlrsvhAAufiG2X3t65pAeQQqSXVUeAZ6RslYVZsXC1SrwxPtUhXtbE8tdUFALOjj FM8lesV0XQ2vXNUgz1eJ97BdKS2MDsONotQSQoytt2wSEMsHswaLL6MtpDOwKB+M zbx+1E5EUlWRzyRb9Gtbe+bP+AlxUbYNec5Hy8zYbQATxJuULHVCi0bfSpVt3PUy lpmB2ONKbSnKdCnHPZ6V1yNYxjhFPGGa5HW9re/128STzHbvYmlh17wfwJlEArl5 a900L8LkqMIiFGi5vSpuMLNhSnhnnVwmzBZ9mI97AKsEP0k0cCckJh+5haY75ocx r/PfU15g4pB1gbS4U6C0fszDPYyB0JCAAcmMcxYOHMMCHZ18vhufAnA5t83pdikb gqJnM1EhOASDOC/Sw07ux71Ema2TF+ZUxI1Qu9g3eNK+P90oWf8ueHjLcQcslyXr GKDRGKoPoBtMhHrOcBpSjFZ5hJCSoHDvF4p3EVVa0EiNgu1nDAAPVfDVo2bWvJ+/ GU/rRXveH7dVhz6nw6eoGg8CRWEKDTLSqacgZO/SUnVPSM0nTjei6gbovM3/NkCN Um59oN9+2aADWGdDSpL05wZjcAdoYPsRYaW4pKyMOnopzrL3u8br61aXQBgVwf+A 6t95H/LMZLMX9IsHhs45F0Fpfa0cPU94gWGAhYINLYWy55lcPf8= =VOdB -----END PGP SIGNATURE----- --f422deqlvtzqdkhx-- From owner-svn-src-all@freebsd.org Wed Sep 13 18:55:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 485E7E0A5C8 for ; Wed, 13 Sep 2017 18:55:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ADFD723CD for ; Wed, 13 Sep 2017 18:55:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id c195so5557497itb.1 for ; Wed, 13 Sep 2017 11:55:28 -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=/ReiVlY77gCzQ59qubT43Z70jYUokQuiE8knm+ZSf8E=; b=FeKYNc2Wkt3b0Fo4szaaT0Nt/Ss4ouYX/Gyq73x88V3Zl5qo9cfBVZ8WuxrHieVtvo FHf+8jHv4MUCQMDW8lyJ0MjLqj20RBtyozxwszdyqXzfrHECcnRB0j5j1mHYeLr1wrY5 0gMPQJdAyshyoAH1loQklhFQQAZt2esj+mhT1L6m4HwZoR6J+KWY03VCYO//15hdkRou XunJNRzH4HkZf2Wy3V7JDfc/vPmAGHYcvT+L94/xtwoadPN12xXC1bVcFLcdyUEvjxFD 07NtrGXOGgPv4ApSQYXWtefKizi7USbce3k1HsNuj2kvtAX04RC7c9+vB2eQs4t89Kp6 /c9w== 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=/ReiVlY77gCzQ59qubT43Z70jYUokQuiE8knm+ZSf8E=; b=KM5T4e85z423xGg3vTG6RWzAsqFpVg0YC+GpLfoAEKQJSiSBvea6+yb+fAASXEtyo1 S2cld67o1GXUAuDu+kCcbbowDd5GYWe8jZzJxCE8apqEakXbslLpCiImfNP/yat9Rd6T 7wvYg4iUGiqmxBx18nDbcJeGdlC5WrV5eK8EXOZPlxiFJ+xQyTe6KGiWLtyzljEkydgq 01a2YhWkLubB1f/8g5FNLbhEHmESy2aaWKaiOcXr+QFws1SsJ8O5EmHlocudsxxI6n6R Hh6WQvS6AHtSRuz1IxPIjo1IGBZ5XyAbHmnnMJoN/59ET0WkDVEIm8GkfxqkNRO1OY6U XafQ== X-Gm-Message-State: AHPjjUhoXFUjN6f1qKD56HEPjngcprwtzL5H6vCmjhD6dJmQUob6RZFZ mQQOKaNw8oZt2FKc//RwWfJSvjiQQer/ur+O4GnXoA== X-Google-Smtp-Source: AOwi7QCmdKhRuit+z6TAhlTYY6mDzOJbqn43YIYk9X/wlHaoUGq/JkH7HWEbKCnlV1OqU0VdnX3nIWFafd6Vya5p07Q= X-Received: by 10.36.254.72 with SMTP id w69mr5653337ith.130.1505328927301; Wed, 13 Sep 2017 11:55:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Wed, 13 Sep 2017 11:55:26 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:60a7:d7e6:aef8:c203] In-Reply-To: <431fe768-f781-e19f-0e2c-bdffa9be9273@FreeBSD.org> References: <201703090327.v293RrEY016498@repo.freebsd.org> <5311676.nqsSxOZALl@ralph.baldwin.cx> <431fe768-f781-e19f-0e2c-bdffa9be9273@FreeBSD.org> From: Warner Losh Date: Wed, 13 Sep 2017 12:55:26 -0600 X-Google-Sender-Auth: N8hvXur-q1dqg__RLdUQkL-ertk Message-ID: Subject: Re: svn commit: r314942 - head/usr.bin/awk To: Pedro Giffuni Cc: John Baldwin , Baptiste Daroussin , 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 18:55:28 -0000 Maybe you can bring them in here? :) Warner On Wed, Sep 13, 2017 at 12:37 PM, Pedro Giffuni wrote: > > > On 13/09/2017 13:15, John Baldwin wrote: > >> On Thursday, March 09, 2017 03:27:53 AM Baptiste Daroussin wrote: >> >>> Author: bapt >>> Date: Thu Mar 9 03:27:53 2017 >>> New Revision: 314942 >>> URL: https://svnweb.freebsd.org/changeset/base/314942 >>> >>> Log: >>> Import the awk(1) manpage from OpenBSD >>> As discussed during AsiaBSDcon devsummit, import the manpage from >>> OpenBSD which >>> is has been rewritten in mdoc(7) format making it readable by default >>> with >>> mandoc, it also has been extended by OpenBSD to cover all awk(1) >>> options >>> Obtained from: OpenBSD >>> MFH: 1 week >>> >> One problem noted today by imp@ is that this doesn't quite document the >> awk we >> ship: >> >> % echo 42 | awk '{ print lshift($1, 1) }' >> awk: calling undefined function lshift >> input record number 1, file >> source line number 1 >> >> None of the bit operations described in this manpage are implemented in >> one-true-awk. Hmm, it seems that OpenBSD added those as a local patch >> relative to one-true-awk in 1.10 of lex.c. So Someone(tm) needs to >> probably >> compare OpenBSD's awk to one-true-awk to see what local changes they have >> and either update the manpage here or pull the local diffs across. (I'd >> probably we just grab the implementation for the bitwise ops myself.) >> >> Hmm ... > > TBH, many years ago I tried to upstream the OpenBSD (actually gawk) > extensions but upstream (bwk) was not interested. > > Pedro. > > From owner-svn-src-all@freebsd.org Wed Sep 13 19:04:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDFA8E0ABAE; Wed, 13 Sep 2017 19:04:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB460728AF; Wed, 13 Sep 2017 19:04:00 +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 v8DJ3x3I072013; Wed, 13 Sep 2017 19:03:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DJ3xlJ072011; Wed, 13 Sep 2017 19:03:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131903.v8DJ3xlJ072011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 19:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323558 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 19:04:01 -0000 Author: kib Date: Wed Sep 13 19:03:59 2017 New Revision: 323558 URL: https://svnweb.freebsd.org/changeset/base/323558 Log: Use existing tag name for the vm_object' memq. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_object.h head/sys/vm/vm_page.h Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Wed Sep 13 18:32:43 2017 (r323557) +++ head/sys/vm/vm_object.h Wed Sep 13 19:03:59 2017 (r323558) @@ -87,12 +87,17 @@ * */ +#ifndef VM_PAGE_HAVE_PGLIST +TAILQ_HEAD(pglist, vm_page); +#define VM_PAGE_HAVE_PGLIST +#endif + struct vm_object { struct rwlock lock; TAILQ_ENTRY(vm_object) object_list; /* list of all objects */ LIST_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */ LIST_ENTRY(vm_object) shadow_list; /* chain of shadow objects */ - TAILQ_HEAD(respgs, vm_page) memq; /* list of resident pages */ + struct pglist memq; /* list of resident pages */ struct vm_radix rtree; /* root of the resident page radix trie*/ vm_pindex_t size; /* Object size */ int generation; /* generation ID */ Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Sep 13 18:32:43 2017 (r323557) +++ head/sys/vm/vm_page.h Wed Sep 13 19:03:59 2017 (r323558) @@ -210,7 +210,10 @@ struct vm_page { #define PQ_UNSWAPPABLE 3 #define PQ_COUNT 4 +#ifndef VM_PAGE_HAVE_PGLIST TAILQ_HEAD(pglist, vm_page); +#define VM_PAGE_HAVE_PGLIST +#endif SLIST_HEAD(spglist, vm_page); struct vm_pagequeue { From owner-svn-src-all@freebsd.org Wed Sep 13 19:11:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C1AAE0B175; Wed, 13 Sep 2017 19:11:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C1172E16; Wed, 13 Sep 2017 19:11:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DJBqwO076362; Wed, 13 Sep 2017 19:11:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DJBqcs076360; Wed, 13 Sep 2017 19:11:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131911.v8DJBqcs076360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 19:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323559 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 19:11:53 -0000 Author: kib Date: Wed Sep 13 19:11:52 2017 New Revision: 323559 URL: https://svnweb.freebsd.org/changeset/base/323559 Log: Split vm_page_free_toq() into two parts, preparation vm_page_free_prep() and insertion into the phys allocator free queues vm_page_free_phys(). Also provide a wrapper vm_page_free_phys_pglist() for batched free. Reviewed by: alc, markj Tested by: mjg (previous version) Sponsored by: The FreeBSD Foundation 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 Wed Sep 13 19:03:59 2017 (r323558) +++ head/sys/vm/vm_page.c Wed Sep 13 19:11:52 2017 (r323559) @@ -163,6 +163,7 @@ static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_enqueue(uint8_t queue, vm_page_t m); +static void vm_page_free_phys(vm_page_t m); static void vm_page_free_wakeup(void); static void vm_page_init(void *dummy); static int vm_page_insert_after(vm_page_t m, vm_object_t object, @@ -2402,13 +2403,7 @@ unlock: mtx_lock(&vm_page_queue_free_mtx); do { SLIST_REMOVE_HEAD(&free, plinks.s.ss); - vm_phys_freecnt_adj(m, 1); -#if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) -#else - if (true) -#endif - vm_phys_free_pages(m, 0); + vm_page_free_phys(m); } while ((m = SLIST_FIRST(&free)) != NULL); vm_page_free_wakeup(); mtx_unlock(&vm_page_queue_free_mtx); @@ -2770,15 +2765,18 @@ vm_page_free_wakeup(void) } /* - * vm_page_free_toq: + * vm_page_free_prep: * - * Returns the given page to the free list, - * disassociating it with any VM object. + * Prepares the given page to be put on the free list, + * disassociating it from any VM object. The caller may return + * the page to the free list only if this function returns true. * - * The object must be locked. The page must be locked if it is managed. + * The object must be locked. The page must be locked if it is + * managed. For a queued managed page, the pagequeue_locked + * argument specifies whether the page queue is already locked. */ -void -vm_page_free_toq(vm_page_t m) +bool +vm_page_free_prep(vm_page_t m, bool pagequeue_locked) { if ((m->oflags & VPO_UNMANAGED) == 0) { @@ -2799,16 +2797,20 @@ vm_page_free_toq(vm_page_t m) * callback routine until after we've put the page on the * appropriate free queue. */ - vm_page_remque(m); + if (m->queue != PQ_NONE) { + if (pagequeue_locked) + vm_page_dequeue_locked(m); + else + vm_page_dequeue(m); + } vm_page_remove(m); /* * If fictitious remove object association and * return, otherwise delay object association removal. */ - if ((m->flags & PG_FICTITIOUS) != 0) { - return; - } + if ((m->flags & PG_FICTITIOUS) != 0) + return (false); m->valid = 0; vm_page_undirty(m); @@ -2820,28 +2822,66 @@ vm_page_free_toq(vm_page_t m) KASSERT((m->flags & PG_UNHOLDFREE) == 0, ("vm_page_free: freeing PG_UNHOLDFREE page %p", m)); m->flags |= PG_UNHOLDFREE; - } else { - /* - * Restore the default memory attribute to the page. - */ - if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) - pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); + return (false); + } - /* - * Insert the page into the physical memory allocator's free - * page queues. - */ - mtx_lock(&vm_page_queue_free_mtx); - vm_phys_freecnt_adj(m, 1); + /* + * Restore the default memory attribute to the page. + */ + if (pmap_page_get_memattr(m) != VM_MEMATTR_DEFAULT) + pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); + + return (true); +} + +/* + * Insert the page into the physical memory allocator's free page + * queues. This is the last step to free a page. + */ +static void +vm_page_free_phys(vm_page_t m) +{ + + mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); + + vm_phys_freecnt_adj(m, 1); #if VM_NRESERVLEVEL > 0 - if (!vm_reserv_free_page(m)) -#else - if (TRUE) + if (!vm_reserv_free_page(m)) #endif - vm_phys_free_pages(m, 0); - vm_page_free_wakeup(); - mtx_unlock(&vm_page_queue_free_mtx); - } + vm_phys_free_pages(m, 0); +} + +void +vm_page_free_phys_pglist(struct pglist *tq) +{ + vm_page_t m; + + mtx_lock(&vm_page_queue_free_mtx); + TAILQ_FOREACH(m, tq, listq) + vm_page_free_phys(m); + vm_page_free_wakeup(); + mtx_unlock(&vm_page_queue_free_mtx); +} + +/* + * vm_page_free_toq: + * + * Returns the given page to the free list, disassociating it + * from any VM object. + * + * The object must be locked. The page must be locked if it is + * managed. + */ +void +vm_page_free_toq(vm_page_t m) +{ + + if (!vm_page_free_prep(m, false)) + return; + mtx_lock(&vm_page_queue_free_mtx); + vm_page_free_phys(m); + vm_page_free_wakeup(); + mtx_unlock(&vm_page_queue_free_mtx); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Sep 13 19:03:59 2017 (r323558) +++ head/sys/vm/vm_page.h Wed Sep 13 19:11:52 2017 (r323559) @@ -483,6 +483,8 @@ void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); void vm_page_dequeue_locked(vm_page_t m); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); +void vm_page_free_phys_pglist(struct pglist *tq); +bool vm_page_free_prep(vm_page_t m, bool pagequeue_locked); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); From owner-svn-src-all@freebsd.org Wed Sep 13 19:22:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 755C5E0B863; Wed, 13 Sep 2017 19:22:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB9B73669; Wed, 13 Sep 2017 19:22:08 +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 v8DJM7iJ078962; Wed, 13 Sep 2017 19:22:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DJM7bi078961; Wed, 13 Sep 2017 19:22:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131922.v8DJM7bi078961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 19:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323561 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 19:22:08 -0000 Author: kib Date: Wed Sep 13 19:22:07 2017 New Revision: 323561 URL: https://svnweb.freebsd.org/changeset/base/323561 Log: Do not relock free queue mutex for each page, free whole terminating object' page queue under the single mutex lock. First, all pages on the queue are prepared for free by calls to vm_page_free_prep(), and pages which should not be returned to the physical allocator (e.g. wired or fictitious) are simply removed from the queue. On the second pass, vm_page_free_phys_pglist() inserts all pages from the queue without relocking the mutex. The change improves the object termination, e.g. on the process exit where large anonymous memory objects otherwise cause relocks the free queue mutex for each page. More, if several such processes are exiting or execing in parallel, the mutex was highly contended on the address space demolition. Diagnosed and tested by: mjg (previous version) Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Sep 13 19:12:28 2017 (r323560) +++ head/sys/vm/vm_object.c Wed Sep 13 19:22:07 2017 (r323561) @@ -713,9 +713,14 @@ static void vm_object_terminate_pages(vm_object_t object) { vm_page_t p, p_next; + struct mtx *mtx, *mtx1; + struct vm_pagequeue *pq, *pq1; VM_OBJECT_ASSERT_WLOCKED(object); + mtx = NULL; + pq = NULL; + /* * Free any remaining pageable pages. This also removes them from the * paging queues. However, don't free wired pages, just remove them @@ -724,21 +729,51 @@ vm_object_terminate_pages(vm_object_t object) */ TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { vm_page_assert_unbusied(p); - vm_page_lock(p); - /* - * Optimize the page's removal from the object by resetting - * its "object" field. Specifically, if the page is not - * wired, then the effect of this assignment is that - * vm_page_free()'s call to vm_page_remove() will return - * immediately without modifying the page or the object. - */ + if ((object->flags & OBJ_UNMANAGED) == 0) { + /* + * vm_page_free_prep() only needs the page + * lock for managed pages. + */ + mtx1 = vm_page_lockptr(p); + if (mtx1 != mtx) { + if (mtx != NULL) + mtx_unlock(mtx); + if (pq != NULL) { + vm_pagequeue_unlock(pq); + pq = NULL; + } + mtx = mtx1; + mtx_lock(mtx); + } + } p->object = NULL; - if (p->wire_count == 0) { - vm_page_free(p); - VM_CNT_INC(v_pfree); + if (p->wire_count != 0) + goto unlist; + VM_CNT_INC(v_pfree); + p->flags &= ~PG_ZERO; + if (p->queue != PQ_NONE) { + KASSERT(p->queue < PQ_COUNT, ("vm_object_terminate: " + "page %p is not queued", p)); + pq1 = vm_page_pagequeue(p); + if (pq != pq1) { + if (pq != NULL) + vm_pagequeue_unlock(pq); + pq = pq1; + vm_pagequeue_lock(pq); + } } - vm_page_unlock(p); + if (vm_page_free_prep(p, true)) + continue; +unlist: + TAILQ_REMOVE(&object->memq, p, listq); } + if (pq != NULL) + vm_pagequeue_unlock(pq); + if (mtx != NULL) + mtx_unlock(mtx); + + vm_page_free_phys_pglist(&object->memq); + /* * If the object contained any pages, then reset it to an empty state. * None of the object's fields, including "resident_page_count", were From owner-svn-src-all@freebsd.org Wed Sep 13 19:28:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D37FE0BD89; Wed, 13 Sep 2017 19:28:57 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (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 E602273999; Wed, 13 Sep 2017 19:28:56 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id sDL4d61nZDJTWsDL5dugqW; Wed, 13 Sep 2017 13:28:49 -0600 X-Authority-Analysis: v=2.2 cv=B4DJ6KlM c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=2JCJgTwv5E4A:10 a=6I5d2MoRAAAA:8 a=BWvPGDcYAAAA:8 a=pGLkceISAAAA:8 a=VxmjJ2MpAAAA:8 a=NEAV23lmAAAA:8 a=VwQbUJbxAAAA:8 a=YxBL1-UpAAAA:8 a=CArGUo-jAyrTWHpj-QgA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=pxhY87DP9d2VeQe4joPk:22 a=6kGIvZw6iX1k4Y-7sg4_:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=AjGcO6oz07-iQ99wixmX:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 2FED5410; Wed, 13 Sep 2017 12:28:46 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v8DJSTWV063084; Wed, 13 Sep 2017 12:28:29 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201709131928.v8DJSTWV063084@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: Sean Bruno cc: Cy Schubert , Ngie Cooper , Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys In-Reply-To: Message from Sean Bruno of "Wed, 13 Sep 2017 09:12:50 -0600." <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 13 Sep 2017 12:28:29 -0700 X-CMAE-Envelope: MS4wfDqLvObsyh24Oj8pmKNWyfgK5juNQGr2S0gJROPjiQC3rssJ9NeP8XGr/xzqq7v3hzmJ2EeoyLQbkgdtS+9GPXPFATW8QaCpc6G1HmyrGfW1cPtp0kgs 5WurNJY9nJ+lIFKAWqnCGnFd9G0np4Gt8PuirGxb+b6qBOFdSD0JR9TeXeouIIqVAIzwb/vvdiIScKyhMjTXMYKVJC1810i9QG+b/MhWNC/m2YdmNf5+HbNq gkKb0gpSRkqVsjJtRdLX7LvQiTbnXtXKfoTbpaa78XGVxv1jbGt+Xd9LY/Ym21pTHX/4gBQQXf0IhZuhIkCbG5XgRR+WSXJ6M0YyLA5SH8TO+ATDtOQf4vtP RVtSHyYC X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 19:28:57 -0000 In message <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org>, Sean Bruno write s: > This is an OpenPGP/MIME signed message (RFC 4880 and 3156) > --K3RXSO7fXoxBXqJUE1dpQ1sEQkuJPg1DQ > Content-Type: multipart/mixed; boundary="lalB5jI6dIhQxjTp1UFWH9Jx4OpW69Pfe"; > protected-headers="v1" > From: Sean Bruno > To: Cy Schubert , > Ngie Cooper > Cc: Stephen Hurd , src-committers@freebsd.org, > svn-src-all@freebsd.org, svn-src-head@freebsd.org > Message-ID: <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> > Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net > sys > References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> > In-Reply-To: <201709130711.v8D7BlTS003204@slippy.cwsent.com> > > --lalB5jI6dIhQxjTp1UFWH9Jx4OpW69Pfe > Content-Type: text/plain; charset=utf-8 > Content-Language: en-US > Content-Transfer-Encoding: quoted-printable > > >>> #blamebruno > >>> > >>> Reviewed by: sbruno > >>> Approved by: sbruno (mentor) > >>> Sponsored by: Limelight Networks > >>> Differential Revision: https://reviews.freebsd.org/D12235 > >> > >> *gasps at the LoC count and number of changed drivers* > >> > >> Could someone please better break this up in the future..? > >=20 > > Agreed. Down the road parsing out individual commits in this jumbo comm= > it=20 > > will be difficult to parse. IMO this may as well have simply been, impo= > rt=20 > > from https://github.com/mattmacy/networking/, just like Mr. Torvalds do= > es=20 > > at kernel.org. I expect to see a commit like this there but not here. C= > an=20 > > we break this down to its functional commits? > >=20 > >=20 > > > This ridiculous loc was due to the amount of restructuring needed to get > us back to being in sync with our development. The future will not have > this big of a commit/change and should be more bite/fun sized. > > The #blamebruno tag in the commit log was to indicate that this was not > something Stephen was doing on his own, but was something that I had > induced over the last few months during testing. I suppose it is sometimes unavoidable. -- 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-all@freebsd.org Wed Sep 13 19:30:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2513E0BECB; Wed, 13 Sep 2017 19:30:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FB3E73B17; Wed, 13 Sep 2017 19:30:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DJU97E080673; Wed, 13 Sep 2017 19:30:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DJU926080672; Wed, 13 Sep 2017 19:30:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709131930.v8DJU926080672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Sep 2017 19:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323562 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 19:30:10 -0000 Author: kib Date: Wed Sep 13 19:30:09 2017 New Revision: 323562 URL: https://svnweb.freebsd.org/changeset/base/323562 Log: Remove inline specifier from vm_page_free_wakeup(), do not micro-manage compiler. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Sep 13 19:22:07 2017 (r323561) +++ head/sys/vm/vm_page.c Wed Sep 13 19:30:09 2017 (r323562) @@ -2739,7 +2739,7 @@ vm_page_activate(vm_page_t m) * * The page queues must be locked. */ -static inline void +static void vm_page_free_wakeup(void) { From owner-svn-src-all@freebsd.org Wed Sep 13 19:49:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23222E0CA34 for ; Wed, 13 Sep 2017 19:49:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::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 D9B6274477 for ; Wed, 13 Sep 2017 19:49:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id v19so5360865ite.0 for ; Wed, 13 Sep 2017 12:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JVYvqiCGE39oCNKelyFtsyIMyKUv0KSsGon4a8nAlpM=; b=150OmQ2YJKzpPErv3ZfrG2kDN7p5casgUg9hX2oR+oaHePnlo8Dn3jX6ySLY1q5hMm qgbKhqsPY0RbmeFWXyVx8FU0selsi3TkLMKSSsnZjIuCOSNjexd4CZaZHWqt2OCmTApt jAuI70Hb+SG+OK1WtMoJvo5nN4vTl8vGgsmR5qwDdPD5HwxeGn1QQ3DB9Y9u7PRX00cZ XhCVS/kRCpE52Rn94rS0Jg5H1bmh2VCKFieR9+wAuH63XQV7BaNvc/7Ubn0yQibMr0Bx QIgl/dOOgrq4n2PxBo3d29PWlPYQMZzNz9Bsz2EGhV5diLqpbkyE5pElecpKuaiqrrth A9Eg== 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=JVYvqiCGE39oCNKelyFtsyIMyKUv0KSsGon4a8nAlpM=; b=gvpylRnRB5DBSQ8iSlLL65QSa0f0CW8fJijY3CKA3RPB1aXTRBcnyRw5BFJyhsKmqG jI9xrYzpPcY3YwhPYZmzZ8cQnbPhjkAi+60ogKteugYYNUDLp15UsvpGKW7xURlGtE8u gYU6WKKPivDtTdxM9+QhTC469m5A0GdC5pE+t/C2ZN0EqkwEcYnY6rQ0IVdYgFR/WXh3 FczE3KVf7mkB2rOawsRfKTqMIUPerSnEgwEEWzJMKHlNwsNqwmRUc5eyRGl2hhwk8B1C erxhhXTMffcnUpOIXXfxrdXhaYuGeB756LWZGEFTVHsQVjxe2XUIPLdTkMK80pzqtBvG THgQ== X-Gm-Message-State: AHPjjUiMAPfRqnOV/9wKOtno0uFxUf/ukO+BGVM/iGekqnT/6iF05Y/p 0CCkJDyig3AkWGWLhggrNsLiojnh8BfYlP/QR/73OQ== X-Google-Smtp-Source: AOwi7QByOPRsXeSPIHIX3+7yDQbhTI9ixCTz1XySk8DJGh4/I0yqLE3sVXOvM/odDAqoGarJ+7//JGy45qRSn0In2eU= X-Received: by 10.36.20.149 with SMTP id 143mr4867337itg.63.1505332196208; Wed, 13 Sep 2017 12:49:56 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Wed, 13 Sep 2017 12:49:55 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:60a7:d7e6:aef8:c203] In-Reply-To: <201709131345.v8DDjXH0033179@slippy.cwsent.com> References: <201709131345.v8DDjXH0033179@slippy.cwsent.com> From: Warner Losh Date: Wed, 13 Sep 2017 13:49:55 -0600 X-Google-Sender-Auth: JaNTbpgFsW7KN3zMdh2FtGUBDVo Message-ID: Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys To: Cy Schubert Cc: Ngie Cooper , Stephen Hurd , 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 19:49:57 -0000 On Wed, Sep 13, 2017 at 7:45 AM, Cy Schubert wrote: > In message KcmTA@mail.gmail.c > om> > , Warner Losh writes: > > --001a1141f15ac444250559123c56 > > Content-Type: text/plain; charset="UTF-8" > > > > On Wed, Sep 13, 2017 at 1:11 AM, Cy Schubert > > wrote: > > > > > In message <4D5AE475-5A38-4429-8B71-DBECDFB0A1FF@gmail.com>, Ngie > Cooper > > > writes > > > : > > > > > > > > > On Sep 12, 2017, at 18:18, Stephen Hurd wrote: > > > > > > > > > > Author: shurd > > > > > Date: Wed Sep 13 01:18:42 2017 > > > > > New Revision: 323516 > > > > > URL: https://svnweb.freebsd.org/changeset/base/323516 > > > > > > > > > > Log: > > > > > Roll up iflib commits from github. This pulls in most of the work > > > done > > > > > by Matt Macy as well as other changes which he has accepted via > pull > > > > > request to his github repo at https://github.com/mattmacy/ > networking/ > > > > > > > > > > This should bring -CURRENT and the github repo into close enough > sync > > > to > > > > > allow small feature branches rather than a large chain of > > > interdependant > > > > > patches being developed out of tree. The reset of the > synchronization > > > > > should be able to be completed on github by splitting the > remaining > > > > > changes that are not yet ready into short feature branches for > later > > > > > review as smaller commits. > > > > > > > > > > Here is a summary of changes included in this patch: > > > > > > > > > > 1) More checks when INVARIANTS are enabled for eariler problem > > > > > detection > > > > > 2) Group Task Queue cleanups > > > > > - Fix use of duplicate shortdesc for gtaskqueue malloc type. > > > > > Some interfaces such as memguard(9) use the short > description to > > > > > identify malloc types, so duplicates should be avoided. > > > > > 3) Allow gtaskqueues to use ithreads in addition to taskqueues > > > > > - In some cases, this can improve performance > > > > > 4) Better logging when taskqgroup_attach*() fails to set > interrupt > > > > > affinity. > > > > > 5) Do not start gtaskqueues until they're needed > > > > > 6) Have mp_ring enqueue function enter the ABDICATED rather than > BUSY > > > > > state. This moves the TX to the gtaskq and allows processing > to > > > > > continue faster as well as make TX batching more likely. > > > > > 7) Add an ift_txd_errata function to struct if_txrx. This allows > > > > > drivers to inspect/modify mbufs before transmission. > > > > > 8) Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they > need > > > > > checksums zeroed for checksum offload to work. This avoids > > > modifying > > > > > packet data in the TX path when possible. > > > > > 9) Use ithreads for iflib I/O instead of taskqueues > > > > > 10) Clean up ioctl and support async ioctl functions > > > > > 11) Prefetch two cachlines from each mbuf instead of one up to > 128B. > > > We > > > > > often need to parse packet header info beyond 64B. > > > > > 12) Fix potential memory corruption due to fence post error in > > > > > bit_nclear() usage. > > > > > 13) Improved hang detection and handling > > > > > 14) If the packet is smaller than MTU, disable the TSO flags. > > > > > This avoids extra packet parsing when not needed. > > > > > 15) Move TCP header parsing inside the IS_TSO?() test. > > > > > This avoids extra packet parsing when not needed. > > > > > 16) Pass chains of mbufs that are not consumed by lro to > if_input() > > > > > rather call if_input() for each mbuf. > > > > > 17) Re-arrange packet header loads to get as much work as possible > > > done > > > > > before a cache stall. > > > > > 18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_ > > > POST()/ > > > > > IFDI_DETACH(); > > > > > 19) Attempt to distribute RX/TX tasks across cores more sensibly, > > > > > especially when RX and TX share an interrupt. RX will > attempt to > > > > > take the first threads on a core, and TX will attempt to take > > > > > successive threads. > > > > > 20) Allow iflib_softirq_alloc_generic() to request affinity to the > > > same > > > > > cpus an interrupt has affinity with. This allows TX queues to > > > > > ensure they are serviced by the socket the device is on. > > > > > 21) Add new iflib sysctls to net.iflib: > > > > > - timer_int - interval at which to run per-queue timers in > ticks > > > > > - force_busdma > > > > > 22) Add new per-device iflib sysctls to dev.X.Y.iflib > > > > > - rx_budget allows tuning the batch size on the RX path > > > > > - watchdog_events Count of watchdog events seen since load > > > > > 23) Fix error where netmap_rxq_init() could get called before > > > > > IFDI_INIT() > > > > > 24) e1000: Fixed version of r323008: post-cold sleep instead of > DELAY > > > > > when waiting for firmware > > > > > - After interrupts are enabled, convert all waits to sleeps > > > > > - Eliminates e1000 software/firmware synchronization busy > waits > > > after > > > > > startup > > > > > 25) e1000: Remove special case for budget=1 in em_txrx.c > > > > > - Premature optimization which may actually be incorrect with > > > > > multi-segment packets > > > > > 26) e1000: Split out TX interrupt rather than share an interrupt > for > > > > > RX and TX. > > > > > - Allows better performance by keeping RX and TX paths > separate > > > > > 27) e1000: Separate igb from em code where suitable > > > > > Much easier to understand separate functions and "if (is_igb)" > > > than > > > > > previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | > > > E1000_ICR_LSC))" > > > > > > > > > > #blamebruno > > > > > > > > > > Reviewed by: sbruno > > > > > Approved by: sbruno (mentor) > > > > > Sponsored by: Limelight Networks > > > > > Differential Revision: https://reviews.freebsd.org/D12235 > > > > > > > > *gasps at the LoC count and number of changed drivers* > > > > > > > > Could someone please better break this up in the future..? > > > > > > Agreed. Down the road parsing out individual commits in this jumbo > commit > > > will be difficult to parse. IMO this may as well have simply been, > import > > > from https://github.com/mattmacy/networking/, just like Mr. Torvalds > does > > > at kernel.org. I expect to see a commit like this there but not here. > Can > > > we break this down to its functional commits? > > > > > > I use git + svn for other things. It should be possible to use that to > push > > the changes in 'machine gun style' (meaning 27 changes pushed so fast > they > > show up as 27 consecutive r numbers). I do change curation, etc with it > so > > I get good sized commits. That's why you'll often see 10 or 20 commits > from > > me show up in a matter of a couple of minutes. git svn dcommit is to > blame, > > but so is about two dozen git rebases and other git crazy along the way. > > Something like that would be useful here. I'd be quite happy to walk > people > > through my setup if it helps to reduce this. > > I'm interested. Start with https://wiki.freebsd.org/GitWorkflow/GitSvn Once you get through that, we can chat... Warner From owner-svn-src-all@freebsd.org Wed Sep 13 20:34:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0301FE0E5DC; Wed, 13 Sep 2017 20:34:13 +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 D561075A12; Wed, 13 Sep 2017 20:34:12 +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 CD4F910A82D; Wed, 13 Sep 2017 16:34:11 -0400 (EDT) From: John Baldwin To: Ian Lepore Cc: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323518 - head/sys/conf Date: Wed, 13 Sep 2017 13:29:42 -0700 Message-ID: <4109326.8sPPBfrheX@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <1505320675.32063.123.camel@freebsd.org> References: <201709130356.v8D3u4ve095428@repo.freebsd.org> <2493527.d9eFbJjTgo@ralph.baldwin.cx> <1505320675.32063.123.camel@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 13 Sep 2017 16:34:11 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 20:34:13 -0000 On Wednesday, September 13, 2017 10:37:55 AM Ian Lepore wrote: > On Wed, 2017-09-13 at 09:26 -0700, John Baldwin wrote: > > On Wednesday, September 13, 2017 09:09:42 AM Sean Bruno wrote: > > > > > > > > > On 09/13/17 08:35, John Baldwin wrote: > > > > > > > > On Wednesday, September 13, 2017 03:56:04 AM Sean Bruno wrote: > > > > > > > > > > Author: sbruno > > > > > Date: Wed Sep 13 03:56:03 2017 > > > > > New Revision: 323518 > > > > > URL: https://svnweb.freebsd.org/changeset/base/323518 > > > > > > > > > > Log: > > > > > Jenkins i386 LINT build uses NOTES to generate its LINT kernel config. > > > > > > > > > > ixl(4) isn't in here either, so I'll remove lio(4) too. > > > > ixl missing is a bug, please put it in sys/amd64/conf/NOTES (or better yet, > > > > just fix the build on !amd64) > > > > > > > > > > In the case of lio(4), Cavium is explicitly not compiling for 32 bit > > > architectures. I'm inquiring to find out if they want to build on the > > > other 64bit architectures we have. > > > > > > In the case of ixl(4), Intel has said that this is not supported on > > > 32bit architectures. > > > > > > I'm unsure what the best course of action is. > > The bug is more if drivers aren't in NOTES at all. Any thing listed in > > sys/conf/files.* should be in some NOTES file, either sys/conf/NOTES for > > things that are MI or sys/${arch}/conf/NOTES for things that are MD. > > > > Didn't somebody start a task list of things for junior hackers to work > on? Writing a script/tool to verify the assertion in that last > sentence seems like a good candidate for such a list. tools/tools/notescheck/notescheck.py (I haven't run it myself in a long while though) -- John Baldwin From owner-svn-src-all@freebsd.org Wed Sep 13 21:21:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A89FFE10341; Wed, 13 Sep 2017 21:21:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83E2277270; Wed, 13 Sep 2017 21:21:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DLLXm4026215; Wed, 13 Sep 2017 21:21:33 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DLLXs7026213; Wed, 13 Sep 2017 21:21:33 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709132121.v8DLLXs7026213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 13 Sep 2017 21:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323563 - stable/11/contrib/zlib X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/contrib/zlib X-SVN-Commit-Revision: 323563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 21:21:34 -0000 Author: marius Date: Wed Sep 13 21:21:33 2017 New Revision: 323563 URL: https://svnweb.freebsd.org/changeset/base/323563 Log: MFC: 323382, MFV: r323381 Permit a deflateParams() parameter change as soon as possible. This change fixes compression errors seen when the embedded Tomcat web server of a UniFi Controller zlib compresses responses. Given that Tomcat just uses Java/OpenJDK which in turn employs zlib for its compression/decompression support, this bug might very well affect other applications, too. PR: 222136 Modified: stable/11/contrib/zlib/deflate.c stable/11/contrib/zlib/zlib.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/zlib/deflate.c ============================================================================== --- stable/11/contrib/zlib/deflate.c Wed Sep 13 19:30:09 2017 (r323562) +++ stable/11/contrib/zlib/deflate.c Wed Sep 13 21:21:33 2017 (r323563) @@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm) s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); @@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { Modified: stable/11/contrib/zlib/zlib.h ============================================================================== --- stable/11/contrib/zlib/zlib.h Wed Sep 13 19:30:09 2017 (r323562) +++ stable/11/contrib/zlib/zlib.h Wed Sep 13 21:21:33 2017 (r323563) @@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not From owner-svn-src-all@freebsd.org Wed Sep 13 21:54:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 059BDE11655; Wed, 13 Sep 2017 21:54:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C73EE7C5EA; Wed, 13 Sep 2017 21:54:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DLsbcg041514; Wed, 13 Sep 2017 21:54:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DLsbuS041513; Wed, 13 Sep 2017 21:54:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709132154.v8DLsbuS041513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 13 Sep 2017 21:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323564 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 21:54:39 -0000 Author: markj Date: Wed Sep 13 21:54:37 2017 New Revision: 323564 URL: https://svnweb.freebsd.org/changeset/base/323564 Log: Widen uk_pgoff, the slab header offset field. 16 bits is only wide enough for kegs with an item size of up to 64KB. At that size or larger, slab headers are typically offpage because the item size is a multiple of the page size, but there is no requirement that this be the case. We can widen the field without affecting the layout of struct uma_keg since the removal of uk_slabsize in r315077 left an adjacent hole. PR: 218911 MFC after: 2 weeks Modified: head/sys/vm/uma_int.h Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Wed Sep 13 21:21:33 2017 (r323563) +++ head/sys/vm/uma_int.h Wed Sep 13 21:54:37 2017 (r323564) @@ -210,7 +210,7 @@ struct uma_keg { vm_offset_t uk_kva; /* Zone base KVA */ uma_zone_t uk_slabzone; /* Slab zone backing us, if OFFPAGE */ - uint16_t uk_pgoff; /* Offset to uma_slab struct */ + uint32_t uk_pgoff; /* Offset to uma_slab struct */ uint16_t uk_ppera; /* pages per allocation from backend */ uint16_t uk_ipers; /* Items per slab */ uint32_t uk_flags; /* Internal flags */ From owner-svn-src-all@freebsd.org Wed Sep 13 21:56:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED4A9E117FB; Wed, 13 Sep 2017 21:56:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8CDE7C800; Wed, 13 Sep 2017 21:56:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DLunva041673; Wed, 13 Sep 2017 21:56:49 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DLun0k041671; Wed, 13 Sep 2017 21:56:49 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709132156.v8DLun0k041671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 13 Sep 2017 21:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323565 - stable/10/contrib/zlib X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/contrib/zlib X-SVN-Commit-Revision: 323565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 21:56:51 -0000 Author: marius Date: Wed Sep 13 21:56:49 2017 New Revision: 323565 URL: https://svnweb.freebsd.org/changeset/base/323565 Log: MFC: r323382, MFV: r323381 Permit a deflateParams() parameter change as soon as possible. This change fixes compression errors seen when the embedded Tomcat web server of a UniFi Controller zlib compresses responses. Given that Tomcat just uses Java/OpenJDK which in turn employs zlib for its compression/decompression support, this bug might very well affect other applications, too. PR: 222136 Approved by: re (gjb) Modified: stable/10/contrib/zlib/deflate.c stable/10/contrib/zlib/zlib.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/zlib/deflate.c ============================================================================== --- stable/10/contrib/zlib/deflate.c Wed Sep 13 21:54:37 2017 (r323564) +++ stable/10/contrib/zlib/deflate.c Wed Sep 13 21:56:49 2017 (r323565) @@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm) s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); @@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { Modified: stable/10/contrib/zlib/zlib.h ============================================================================== --- stable/10/contrib/zlib/zlib.h Wed Sep 13 21:54:37 2017 (r323564) +++ stable/10/contrib/zlib/zlib.h Wed Sep 13 21:56:49 2017 (r323565) @@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not From owner-svn-src-all@freebsd.org Wed Sep 13 22:11:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50964E12157; Wed, 13 Sep 2017 22:11:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12D077D0F0; Wed, 13 Sep 2017 22:11:06 +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 v8DMB6rA048327; Wed, 13 Sep 2017 22:11:06 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DMB6Pp048326; Wed, 13 Sep 2017 22:11:06 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201709132211.v8DMB6Pp048326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 13 Sep 2017 22:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323566 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 22:11:07 -0000 Author: glebius Date: Wed Sep 13 22:11:05 2017 New Revision: 323566 URL: https://svnweb.freebsd.org/changeset/base/323566 Log: Use soref() in sendfile(2) instead fhold() to reference a socket. The problem is that fdrop() requires syscall context, as it may enter sleep in some cases. The reason to use it in the original non-blocking sendfile implementation, was to avoid use of global ACCEPT_LOCK() on every I/O completion. Now in head sorele() no longer requires this lock. Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Wed Sep 13 21:56:49 2017 (r323565) +++ head/sys/kern/kern_sendfile.c Wed Sep 13 22:11:05 2017 (r323566) @@ -80,7 +80,7 @@ struct sf_io { volatile u_int nios; u_int error; int npages; - struct file *sock_fp; + struct socket *so; struct mbuf *m; vm_page_t pa[]; }; @@ -255,7 +255,7 @@ static void sendfile_iodone(void *arg, vm_page_t *pg, int count, int error) { struct sf_io *sfio = arg; - struct socket *so; + struct socket *so = sfio->so; for (int i = 0; i < count; i++) if (pg[i] != bogus_page) @@ -267,8 +267,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i if (!refcount_release(&sfio->nios)) return; - so = sfio->sock_fp->f_data; - if (sfio->error) { struct mbuf *m; @@ -296,8 +294,8 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i CURVNET_RESTORE(); } - /* XXXGL: curthread */ - fdrop(sfio->sock_fp, curthread); + SOCK_LOCK(so); + sorele(so); free(sfio, M_TEMP); } @@ -724,6 +722,7 @@ retry_space: sfio = malloc(sizeof(struct sf_io) + npages * sizeof(vm_page_t), M_TEMP, M_WAITOK); refcount_init(&sfio->nios, 1); + sfio->so = so; sfio->error = 0; nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages, @@ -858,9 +857,8 @@ prepend_header: error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, td); } else { - sfio->sock_fp = sock_fp; sfio->npages = npages; - fhold(sock_fp); + soref(so); error = (*so->so_proto->pr_usrreqs->pru_send) (so, PRUS_NOTREADY, m, NULL, NULL, td); sendfile_iodone(sfio, NULL, 0, 0); From owner-svn-src-all@freebsd.org Wed Sep 13 22:42:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D48BFE13750; Wed, 13 Sep 2017 22:42:34 +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 190167DF96; Wed, 13 Sep 2017 22:42:34 +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 v8DMWWOJ015130 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 13 Sep 2017 15:32:32 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v8DMWVTs015129; Wed, 13 Sep 2017 15:32:31 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 13 Sep 2017 15:32:31 -0700 From: Gleb Smirnoff To: Mateusz Guzik Cc: Bruce Evans , Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r323393 - in head/sys: sys vm Message-ID: <20170913223231.GN1055@FreeBSD.org> References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 22:42:34 -0000 On Mon, Sep 11, 2017 at 09:30:10AM +0200, Mateusz Guzik wrote: M> First, there is a bunch of counter(9) fields. I don't know the original M> reasoning. I would expect these counters to be statically defined in a M> per-cpu struct. The reasoning was to remove 'struct vmmeter' from the 'struct pcpu', which sounds inline with your desire to remote struct vmmeter from the kernel at all. Maintainance wise, it is much easier not to bloat 'struct pcpu' with various global statistics, but keep them as counter(9)s instead. Indeed, what's the big difference between TCP statistics and VM statistics, why treat them differently? Performance wise, I haven't seen any regressions when collapsed multiple entities of struct vmmeter sitting in struct pcpu, into single one with counter(9)s. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Sep 14 00:33:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 435AAE17DB9; Thu, 14 Sep 2017 00:33: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 0FBA181153; Thu, 14 Sep 2017 00:33:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E0XSxj006614; Thu, 14 Sep 2017 00:33:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E0XSkY006613; Thu, 14 Sep 2017 00:33:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709140033.v8E0XSkY006613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Sep 2017 00:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323567 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 323567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 00:33:29 -0000 Author: markj Date: Thu Sep 14 00:33:27 2017 New Revision: 323567 URL: https://svnweb.freebsd.org/changeset/base/323567 Log: MFC r323280: Fix indentation. Modified: stable/11/sys/ofed/drivers/infiniband/core/cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/cma.c Wed Sep 13 22:11:05 2017 (r323566) +++ stable/11/sys/ofed/drivers/infiniband/core/cma.c Thu Sep 14 00:33:27 2017 (r323567) @@ -3203,9 +3203,9 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_con NULL, 0); } else { if (conn_param) - ret = cma_accept_ib(id_priv, conn_param); - else - ret = cma_rep_recv(id_priv); + ret = cma_accept_ib(id_priv, conn_param); + else + ret = cma_rep_recv(id_priv); } break; case RDMA_TRANSPORT_IWARP: From owner-svn-src-all@freebsd.org Thu Sep 14 00:35:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C212CE17FCD; Thu, 14 Sep 2017 00:35:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D95C812DC; Thu, 14 Sep 2017 00:35:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E0ZRXv006748; Thu, 14 Sep 2017 00:35:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E0ZRMv006747; Thu, 14 Sep 2017 00:35:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709140035.v8E0ZRMv006747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 Sep 2017 00:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323568 - stable/11/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 323568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 00:35:28 -0000 Author: emaste Date: Thu Sep 14 00:35:27 2017 New Revision: 323568 URL: https://svnweb.freebsd.org/changeset/base/323568 Log: MFC r323448: bsdinstall: Ignore error return from newaliases(1) This was originally added as "exit $SUCCESS" but with nothing to set the SUCCESS variable. Thus it became an exit with no argument, which just exits with the status of the preceding command. Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/bsdinstall/scripts/config Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsdinstall/scripts/config ============================================================================== --- stable/11/usr.sbin/bsdinstall/scripts/config Thu Sep 14 00:33:27 2017 (r323567) +++ stable/11/usr.sbin/bsdinstall/scripts/config Thu Sep 14 00:35:27 2017 (r323568) @@ -48,7 +48,7 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot # Set up other things from installed config chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 -exit $SUCCESS +exit 0 ################################################################################ # END From owner-svn-src-all@freebsd.org Thu Sep 14 00:39:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7751AE18266; Thu, 14 Sep 2017 00:39:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45EE681560; Thu, 14 Sep 2017 00:39:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E0d8Lh007043; Thu, 14 Sep 2017 00:39:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E0d8US007042; Thu, 14 Sep 2017 00:39:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709140039.v8E0d8US007042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 Sep 2017 00:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323569 - stable/11/usr.sbin/bsdinstall/partedit X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 323569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 00:39:09 -0000 Author: emaste Date: Thu Sep 14 00:39:08 2017 New Revision: 323569 URL: https://svnweb.freebsd.org/changeset/base/323569 Log: MFC r316802 (cem): bsdinstall(8): Sprinkle a snprintf to fixed size buffer Use a snprintf to write an environment variable to a fixed-size buffer to avoid stack overflow. Reported by: Coverity (CWE-120) CID: 1238926 Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Sep 14 00:35:27 2017 (r323568) +++ stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Sep 14 00:39:08 2017 (r323569) @@ -148,7 +148,7 @@ newfs_command(const char *fstype, char *command, int u strcpy(command, "zpool create -f -m none "); if (getenv("BSDINSTALL_TMPBOOT") != NULL) { char zfsboot_path[MAXPATHLEN]; - sprintf(zfsboot_path, "%s/zfs", + snprintf(zfsboot_path, sizeof(zfsboot_path), "%s/zfs", getenv("BSDINSTALL_TMPBOOT")); mkdir(zfsboot_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); From owner-svn-src-all@freebsd.org Thu Sep 14 00:41:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA8CBE18523; Thu, 14 Sep 2017 00:41:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 780A18185E; Thu, 14 Sep 2017 00:41:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E0fR2q007863; Thu, 14 Sep 2017 00:41:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E0fR2q007862; Thu, 14 Sep 2017 00:41:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709140041.v8E0fR2q007862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 Sep 2017 00:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323570 - stable/11/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 323570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 00:41:28 -0000 Author: emaste Date: Thu Sep 14 00:41:27 2017 New Revision: 323570 URL: https://svnweb.freebsd.org/changeset/base/323570 Log: MFC r321226: bsdinstall: improve checksum mismatch error for snapshots The usual case of a mismatched checksum for installer snapshots (e.g., -CURRENT, -ALPHA*) is that a newer snapshot has been built and the old install sets have been replaced. Provide a specific error message for checksum mismatches there that suggests looking for a newer snapshot. Submitted by: Guangyuan Yang Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/bsdinstall/scripts/checksum Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsdinstall/scripts/checksum ============================================================================== --- stable/11/usr.sbin/bsdinstall/scripts/checksum Thu Sep 14 00:39:08 2017 (r323569) +++ stable/11/usr.sbin/bsdinstall/scripts/checksum Thu Sep 14 00:41:27 2017 (r323570) @@ -62,8 +62,16 @@ for dist in $DISTRIBUTIONS; do percentage=$(echo $percentage + 100/`echo $DISTRIBUTIONS | wc -w` | bc) else eval "status_$distname=1" - dialog --backtitle "FreeBSD Installer" --title "Error" \ - --msgbox "The checksum for $dist does not match. It may have become corrupted, and should be redownloaded." 0 0 + case $(/bin/freebsd-version -u) in + *-ALPHA*|*-CURRENT|*-STABLE|*-PRERELEASE) + dialog --backtitle "FreeBSD Installer" --title "Error" \ + --msgbox "The checksum for $dist does not match. It may have become corrupted, or it may be from a newer version of FreeBSD. Please check for a newer snapshot." 0 0 + ;; + *) + dialog --backtitle "FreeBSD Installer" --title "Error" \ + --msgbox "The checksum for $dist does not match. It may have become corrupted, and should be redownloaded." 0 0 + ;; + esac exit 1 fi done From owner-svn-src-all@freebsd.org Thu Sep 14 01:24:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AEA3E1A9FE; Thu, 14 Sep 2017 01:24:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 388F382E91; Thu, 14 Sep 2017 01:24:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E1OHYU027018; Thu, 14 Sep 2017 01:24:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E1OHf2027017; Thu, 14 Sep 2017 01:24:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709140124.v8E1OHf2027017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 Sep 2017 01:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323571 - stable/10/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 323571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 01:24:18 -0000 Author: emaste Date: Thu Sep 14 01:24:17 2017 New Revision: 323571 URL: https://svnweb.freebsd.org/changeset/base/323571 Log: MFC r323448: bsdinstall: Ignore error return from newaliases(1) This was originally added as "exit $SUCCESS" but with nothing to set the SUCCESS variable. Thus it became an exit with no argument, which just exits with the status of the preceding command. Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/bsdinstall/scripts/config Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdinstall/scripts/config ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/config Thu Sep 14 00:41:27 2017 (r323570) +++ stable/10/usr.sbin/bsdinstall/scripts/config Thu Sep 14 01:24:17 2017 (r323571) @@ -45,7 +45,7 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot # Set up other things from installed config chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 -exit $SUCCESS +exit 0 ################################################################################ # END From owner-svn-src-all@freebsd.org Thu Sep 14 03:39:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2D8AE229EF; Thu, 14 Sep 2017 03:39:43 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C01AA30FB; Thu, 14 Sep 2017 03:39:43 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E3dgCc081036; Thu, 14 Sep 2017 03:39:42 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E3dguc081035; Thu, 14 Sep 2017 03:39:42 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709140339.v8E3dguc081035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Thu, 14 Sep 2017 03:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323572 - head/usr.sbin/zic/zic X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/usr.sbin/zic/zic X-SVN-Commit-Revision: 323572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 03:39:44 -0000 Author: rlibby Date: Thu Sep 14 03:39:42 2017 New Revision: 323572 URL: https://svnweb.freebsd.org/changeset/base/323572 Log: zic: -Wno-error=strict-overflow Reviewed by: emaste Sponsored by: Dell EMC Isilon X-Differential Revision: https://reviews.freebsd.org/D12284 Modified: head/usr.sbin/zic/zic/Makefile Modified: head/usr.sbin/zic/zic/Makefile ============================================================================== --- head/usr.sbin/zic/zic/Makefile Thu Sep 14 01:24:17 2017 (r323571) +++ head/usr.sbin/zic/zic/Makefile Thu Sep 14 03:39:42 2017 (r323572) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + .PATH: ${SRCTOP}/contrib/tzcode/zic PROG= zic @@ -12,5 +14,9 @@ CFLAGS+= -DHAVE_STRERROR -DHAVE_UNISTD_H CFLAGS+= -I${.CURDIR:H} -I${SRCTOP}/contrib/tzcode/stdtime WARNS?= 2 + +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50300 +CWARNFLAGS+= -Wno-error=strict-overflow +.endif .include From owner-svn-src-all@freebsd.org Thu Sep 14 03:41:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4213E22B30; Thu, 14 Sep 2017 03:41:50 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83F013468; Thu, 14 Sep 2017 03:41:50 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E3fnWn085035; Thu, 14 Sep 2017 03:41:49 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E3fn2Y085034; Thu, 14 Sep 2017 03:41:49 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709140341.v8E3fn2Y085034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Thu, 14 Sep 2017 03:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323573 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 323573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 03:41:50 -0000 Author: rlibby Date: Thu Sep 14 03:41:49 2017 New Revision: 323573 URL: https://svnweb.freebsd.org/changeset/base/323573 Log: gcc builds: reenable -Wstrict-overflow for bsd.sys.mk This effectively reverts r304877, after having relegated the warning suppression to the zic(8) makefile in r323572. Reviewed by: emaste Sponsored by: Dell EMC Isilon X-Differential Revision: https://reviews.freebsd.org/D12284 Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Thu Sep 14 03:39:42 2017 (r323572) +++ head/share/mk/bsd.sys.mk Thu Sep 14 03:41:49 2017 (r323573) @@ -131,11 +131,6 @@ CWARNFLAGS+= -Wno-error=address \ -Wno-error=unused-value .endif -# GCC 5.3.0 -.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50300 -CWARNFLAGS+= -Wno-error=strict-overflow -.endif - # GCC 6.1.0 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 CWARNFLAGS+= -Wno-error=misleading-indentation \ From owner-svn-src-all@freebsd.org Thu Sep 14 03:42:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F277E22D26; Thu, 14 Sep 2017 03:42:42 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29A2A364A; Thu, 14 Sep 2017 03:42:42 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E3gfpt085112; Thu, 14 Sep 2017 03:42:41 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E3gfEm085111; Thu, 14 Sep 2017 03:42:41 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201709140342.v8E3gfEm085111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Thu, 14 Sep 2017 03:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323574 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 323574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 03:42:42 -0000 Author: rlibby Date: Thu Sep 14 03:42:41 2017 New Revision: 323574 URL: https://svnweb.freebsd.org/changeset/base/323574 Log: gcc builds: reenable -Wstrict-overflow for kern.mk Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12284 Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Sep 14 03:41:49 2017 (r323573) +++ head/sys/conf/kern.mk Thu Sep 14 03:42:41 2017 (r323574) @@ -58,7 +58,6 @@ CWARNEXTRA?= -Wno-error=address \ -Wno-error=maybe-uninitialized \ -Wno-error=overflow \ -Wno-error=sequence-point \ - -Wno-error=strict-overflow \ -Wno-error=unused-but-set-variable .if ${COMPILER_VERSION} >= 60100 CWARNEXTRA+= -Wno-error=misleading-indentation \ From owner-svn-src-all@freebsd.org Thu Sep 14 04:51:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF112E253C7; Thu, 14 Sep 2017 04:51:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 764CD6452E; Thu, 14 Sep 2017 04:51:18 +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 v8E4pHhC012365; Thu, 14 Sep 2017 04:51:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E4pHT6012364; Thu, 14 Sep 2017 04:51:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201709140451.v8E4pHT6012364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 14 Sep 2017 04:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323575 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 323575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 04:51:18 -0000 Author: mav Date: Thu Sep 14 04:51:17 2017 New Revision: 323575 URL: https://svnweb.freebsd.org/changeset/base/323575 Log: Add second entry to LUT on a link side in B2B mode. Each of two entries on a virtual side should have its counterpart on a peer's link side. MFC after: 1 week Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Sep 14 03:42:41 2017 (r323574) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Sep 14 04:51:17 2017 (r323575) @@ -197,8 +197,8 @@ ntb_plx_init(device_t dev) } } - /* Enable Link Interface LUT entry 0 for 0:0.0. */ - PNTX_WRITE(sc, 0xdb4, 1); + /* Enable Link Interface LUT entries 0/1 for peer 0/1. */ + PNTX_WRITE(sc, 0xdb4, 0x00090001); } /* @@ -631,13 +631,12 @@ ntb_plx_mw_set_trans_internal(device_t dev, unsigned m val64 = 0; if (size > 0) val64 = (~(size - 1) & ~0xfffff); - val64 |= 0x4; + val64 |= 0xc; PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4, val64); PNTX_WRITE(sc, 0xe8 + (mw->mw_bar - 2) * 4 + 4, val64 >> 32); /* Set Link Interface BAR address. */ val64 = 0x2000000000000000 * mw->mw_bar + off; - val64 |= 0x4; PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar), val64); PNTX_WRITE(sc, PCIR_BAR(mw->mw_bar) + 4, val64 >> 32); } From owner-svn-src-all@freebsd.org Thu Sep 14 05:47:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A09EDE01357; Thu, 14 Sep 2017 05:47:56 +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 79B246592D; Thu, 14 Sep 2017 05:47:56 +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 v8E5lt9B033557; Thu, 14 Sep 2017 05:47:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E5ltM3033554; Thu, 14 Sep 2017 05:47:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709140547.v8E5ltM3033554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 14 Sep 2017 05:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323576 - 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: 323576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 05:47:56 -0000 Author: imp Date: Thu Sep 14 05:47:55 2017 New Revision: 323576 URL: https://svnweb.freebsd.org/changeset/base/323576 Log: Bring in bit operation functions, ala gawk. These are from OpenBSD: >>> Extend awk with bitwise operations. This is an extension to the awk >>> spec and documented as such, but comes in handy from time to time. >>> The prototypes make it compatible with a similar GNU awk extension. >>> >>> ok millert@, enthusiasm from deraadt@ Edited to fix cut and paste in error messages, as well as using tabs instead of spaces after #defines added. Obtained From: OpenBSD awk.h 1.12, lex.c 1.10, run.c 1.29 Differential Revision: https://reviews.freebsd.org/D12361 Sponsored by: Netflix Modified: head/contrib/one-true-awk/awk.h head/contrib/one-true-awk/lex.c head/contrib/one-true-awk/run.c Modified: head/contrib/one-true-awk/awk.h ============================================================================== --- head/contrib/one-true-awk/awk.h Thu Sep 14 04:51:17 2017 (r323575) +++ head/contrib/one-true-awk/awk.h Thu Sep 14 05:47:55 2017 (r323576) @@ -126,6 +126,12 @@ extern Cell *rlengthloc; /* RLENGTH */ #define FTOUPPER 12 #define FTOLOWER 13 #define FFLUSH 14 +#define FAND 15 +#define FFOR 16 +#define FXOR 17 +#define FCOMPL 18 +#define FLSHIFT 19 +#define FRSHIFT 20 /* Node: parse tree is made of nodes, with Cell's at bottom */ Modified: head/contrib/one-true-awk/lex.c ============================================================================== --- head/contrib/one-true-awk/lex.c Thu Sep 14 04:51:17 2017 (r323575) +++ head/contrib/one-true-awk/lex.c Thu Sep 14 05:47:55 2017 (r323576) @@ -47,9 +47,11 @@ Keyword keywords[] ={ /* keep sorted: binary searched { "BEGIN", XBEGIN, XBEGIN }, { "END", XEND, XEND }, { "NF", VARNF, VARNF }, + { "and", FAND, BLTIN }, { "atan2", FATAN, BLTIN }, { "break", BREAK, BREAK }, { "close", CLOSE, CLOSE }, + { "compl", FCOMPL, BLTIN }, { "continue", CONTINUE, CONTINUE }, { "cos", FCOS, BLTIN }, { "delete", DELETE, DELETE }, @@ -69,13 +71,16 @@ Keyword keywords[] ={ /* keep sorted: binary searched { "int", FINT, BLTIN }, { "length", FLENGTH, BLTIN }, { "log", FLOG, BLTIN }, + { "lshift", FLSHIFT, BLTIN }, { "match", MATCHFCN, MATCHFCN }, { "next", NEXT, NEXT }, { "nextfile", NEXTFILE, NEXTFILE }, + { "or", FFOR, BLTIN }, { "print", PRINT, PRINT }, { "printf", PRINTF, PRINTF }, { "rand", FRAND, BLTIN }, { "return", RETURN, RETURN }, + { "rshift", FRSHIFT, BLTIN }, { "sin", FSIN, BLTIN }, { "split", SPLIT, SPLIT }, { "sprintf", SPRINTF, SPRINTF }, @@ -87,6 +92,7 @@ Keyword keywords[] ={ /* keep sorted: binary searched { "tolower", FTOLOWER, BLTIN }, { "toupper", FTOUPPER, BLTIN }, { "while", WHILE, WHILE }, + { "xor", FXOR, BLTIN }, }; #define RET(x) { if(dbg)printf("lex %s\n", tokname(x)); return(x); } Modified: head/contrib/one-true-awk/run.c ============================================================================== --- head/contrib/one-true-awk/run.c Thu Sep 14 04:51:17 2017 (r323575) +++ head/contrib/one-true-awk/run.c Thu Sep 14 05:47:55 2017 (r323576) @@ -1516,6 +1516,64 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0 nextarg = nextarg->nnext; } break; + case FCOMPL: + u = ~((int)getfval(x)); + break; + case FAND: + if (nextarg == 0) { + WARNING("and requires two arguments; returning 0"); + u = 0; + break; + } + y = execute(a[1]->nnext); + u = ((int)getfval(x)) & ((int)getfval(y)); + tempfree(y); + nextarg = nextarg->nnext; + break; + case FFOR: + if (nextarg == 0) { + WARNING("or requires two arguments; returning 0"); + u = 0; + break; + } + y = execute(a[1]->nnext); + u = ((int)getfval(x)) | ((int)getfval(y)); + tempfree(y); + nextarg = nextarg->nnext; + break; + case FXOR: + if (nextarg == 0) { + WARNING("xor requires two arguments; returning 0"); + u = 0; + break; + } + y = execute(a[1]->nnext); + u = ((int)getfval(x)) ^ ((int)getfval(y)); + tempfree(y); + nextarg = nextarg->nnext; + break; + case FLSHIFT: + if (nextarg == 0) { + WARNING("lshift requires two arguments; returning 0"); + u = 0; + break; + } + y = execute(a[1]->nnext); + u = ((int)getfval(x)) << ((int)getfval(y)); + tempfree(y); + nextarg = nextarg->nnext; + break; + case FRSHIFT: + if (nextarg == 0) { + WARNING("rshift requires two arguments; returning 0"); + u = 0; + break; + } + y = execute(a[1]->nnext); + u = ((int)getfval(x)) >> ((int)getfval(y)); + tempfree(y); + nextarg = nextarg->nnext; + break; case FSYSTEM: fflush(stdout); /* in case something is buffered already */ u = (Awkfloat) system(getsval(x)) / 256; /* 256 is unix-dep */ From owner-svn-src-all@freebsd.org Thu Sep 14 05:48:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F753E013CD; Thu, 14 Sep 2017 05:48:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4962265A76; Thu, 14 Sep 2017 05:48:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8E5mNtG033625; Thu, 14 Sep 2017 05:48:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E5mNIf033623; Thu, 14 Sep 2017 05:48:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709140548.v8E5mNIf033623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 14 Sep 2017 05:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323577 - in head: contrib/one-true-awk usr.bin/awk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: contrib/one-true-awk usr.bin/awk X-SVN-Commit-Revision: 323577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 05:48:24 -0000 Author: imp Date: Thu Sep 14 05:48:23 2017 New Revision: 323577 URL: https://svnweb.freebsd.org/changeset/base/323577 Log: Implement gawk multiple-arg extension to and, or, and xor. gawk allows multiple arguemnts to bit-wiste and, or and xor functions. Implement an arbitrary number of arguments for these functions. Also, use NULL in preference to 0 to match rest of file. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D12361 Modified: head/contrib/one-true-awk/run.c head/usr.bin/awk/awk.1 Modified: head/contrib/one-true-awk/run.c ============================================================================== --- head/contrib/one-true-awk/run.c Thu Sep 14 05:47:55 2017 (r323576) +++ head/contrib/one-true-awk/run.c Thu Sep 14 05:48:23 2017 (r323577) @@ -1476,7 +1476,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0 { Cell *x, *y; Awkfloat u; - int t; + int t, i; Awkfloat tmp; char *p, *buf; Node *nextarg; @@ -1520,40 +1520,52 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0 u = ~((int)getfval(x)); break; case FAND: - if (nextarg == 0) { + if (nextarg == NULL) { WARNING("and requires two arguments; returning 0"); u = 0; break; } - y = execute(a[1]->nnext); - u = ((int)getfval(x)) & ((int)getfval(y)); - tempfree(y); - nextarg = nextarg->nnext; + i = ((int)getfval(x)); + while (nextarg != NULL) { + y = execute(nextarg); + i &= (int)getfval(y); + tempfree(y); + nextarg = nextarg->nnext; + } + u = i; break; case FFOR: - if (nextarg == 0) { + if (nextarg == NULL) { WARNING("or requires two arguments; returning 0"); u = 0; break; } - y = execute(a[1]->nnext); - u = ((int)getfval(x)) | ((int)getfval(y)); - tempfree(y); - nextarg = nextarg->nnext; + i = ((int)getfval(x)); + while (nextarg != NULL) { + y = execute(nextarg); + i |= (int)getfval(y); + tempfree(y); + nextarg = nextarg->nnext; + } + u = i; break; case FXOR: - if (nextarg == 0) { + if (nextarg == NULL) { WARNING("xor requires two arguments; returning 0"); u = 0; break; } - y = execute(a[1]->nnext); - u = ((int)getfval(x)) ^ ((int)getfval(y)); - tempfree(y); - nextarg = nextarg->nnext; + i = ((int)getfval(x)); + while (nextarg != NULL) { + y = execute(nextarg); + i ^= (int)getfval(y); + tempfree(y); + nextarg = nextarg->nnext; + } + u = i; break; case FLSHIFT: - if (nextarg == 0) { + if (nextarg == NULL) { WARNING("lshift requires two arguments; returning 0"); u = 0; break; @@ -1564,7 +1576,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0 nextarg = nextarg->nnext; break; case FRSHIFT: - if (nextarg == 0) { + if (nextarg == NULL) { WARNING("rshift requires two arguments; returning 0"); u = 0; break; Modified: head/usr.bin/awk/awk.1 ============================================================================== --- head/usr.bin/awk/awk.1 Thu Sep 14 05:47:55 2017 (r323576) +++ head/usr.bin/awk/awk.1 Thu Sep 14 05:48:23 2017 (r323577) @@ -690,12 +690,15 @@ and returns its exit status. .Bl -tag -width "lshift(a, b)" .It Fn compl x Returns the bitwise complement of integer argument x. -.It Fn and x y -Performs a bitwise AND on integer arguments x and y. -.It Fn or x y -Performs a bitwise OR on integer arguments x and y. -.It Fn xor x y -Performs a bitwise Exclusive-OR on integer arguments x and y. +.It Fn and v1 v2 ... +Performs a bitwise AND on all arguments provided, as integers. +There must be at least two values. +.It Fn or v1 v2 ... +Performs a bitwise OR on all arguments provided, as integers. +There must be at least two values. +.It Fn xor v1 v2 ... +Performs a bitwise Exclusive-OR on all arguments provided, as integers. +There must be at least two values. .It Fn lshift x n Returns integer argument x shifted by n bits to the left. .It Fn rshift x n From owner-svn-src-all@freebsd.org Thu Sep 14 07:32:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50347E054D6 for ; Thu, 14 Sep 2017 07:32:01 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3CFC686B7 for ; Thu, 14 Sep 2017 07:32:00 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x231.google.com with SMTP id g206so6585905wme.0 for ; Thu, 14 Sep 2017 00:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=lqL0jDHkT7Aa0ibCjgLsmAyLGzBbXwILQfvqJ+k7XPw=; b=a23va4EJbdk2ozo5JGjK1K3BoD6vpx3vl3LT85VfjsHPTks6dbhkOfYdPp0jdkUjZV G2FKVgZ3Q/amf7NyJIEK2JxS13mkmvMfDwhG4L7zDZugeD8dlVsDcrhWFT/i9GFi0gmg SJ6yTnRxUUIkEDvYZLmvjQloSPXeSpZMTdQQA0BCu9QUcHwGArgSVv5jKSJfWQNz4rXf ixoDqy/osy2Jm5A+En+Os4iUzMMbYczkd1g0Z0FRN8P80EYF1iolryrh40SXVWZYWudo YJ9QLaNcCdJMmxnN+LJQQpYWGD1WfoL+znxS0NZe8cQ8BZVctXVkbjsSlaCIbhcVSN4+ w6qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=lqL0jDHkT7Aa0ibCjgLsmAyLGzBbXwILQfvqJ+k7XPw=; b=IAfKUNgTlGlUB4/9Hc6/nZMVLgf4C2sLYzJjelILeJAIKjQs1+H8G1FZ8zARXJb9wa NewzWl/VrWwSgfs0iYuHCCrN3/7O0YkUb5cr+/hvyvKXGMFXbUxsbbf+HrzmZS7OEoCK UQmOHsmJu2vtwK3azVzXGNO1mdRQEiW4+6nNPiT+h1ule5BIF0g34SscuttJqcwaWUTb /qUn60P7NOL+rHxiT8EFGtbiGCYlonvjZy21eBOCxp+wJVZhtdgG48wwuidr/CB3T0mM R1KbkRhM4zTODmx9qlaE3iZZs4tqjTbCpkbvxBzArfUjASuo5EafUKGNuG0j8eIII9VT IuzQ== X-Gm-Message-State: AHPjjUi5jr3To1C8LOFTsDJIK0uxMDU1t1mat8jjl19VvLrrhdnWs0xR TtqkXzz4rZ5nSAH4 X-Google-Smtp-Source: AOwi7QBuAH3ostErlok7x/nes+qan34fkyudobrA0CaxTk9VbW0g7npm84YxXUh8KQAeNzcxlcQOqw== X-Received: by 10.28.212.65 with SMTP id l62mr966550wmg.77.1505374319157; Thu, 14 Sep 2017 00:31:59 -0700 (PDT) Received: from [10.10.1.111] ([185.97.61.1]) by smtp.gmail.com with ESMTPSA id g37sm19563379wra.6.2017.09.14.00.31.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2017 00:31:57 -0700 (PDT) Subject: Re: svn commit: r323566 - head/sys/kern To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709132211.v8DMB6Pp048326@repo.freebsd.org> From: Steven Hartland Message-ID: <4ae03e74-4fc3-d23b-4f14-3329b20b8df0@multiplay.co.uk> Date: Thu, 14 Sep 2017 08:31:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <201709132211.v8DMB6Pp048326@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 07:32:01 -0000 Is this something that will be MFC'ed to 11 or is this 12 / CURRENT only? On 13/09/2017 23:11, Gleb Smirnoff wrote: > Author: glebius > Date: Wed Sep 13 22:11:05 2017 > New Revision: 323566 > URL: https://svnweb.freebsd.org/changeset/base/323566 > > Log: > Use soref() in sendfile(2) instead fhold() to reference a socket. > > The problem is that fdrop() requires syscall context, as it may > enter sleep in some cases. The reason to use it in the original > non-blocking sendfile implementation, was to avoid use of global > ACCEPT_LOCK() on every I/O completion. Now in head sorele() no > longer requires this lock. > > Modified: > head/sys/kern/kern_sendfile.c > > Modified: head/sys/kern/kern_sendfile.c > ============================================================================== > --- head/sys/kern/kern_sendfile.c Wed Sep 13 21:56:49 2017 (r323565) > +++ head/sys/kern/kern_sendfile.c Wed Sep 13 22:11:05 2017 (r323566) > @@ -80,7 +80,7 @@ struct sf_io { > volatile u_int nios; > u_int error; > int npages; > - struct file *sock_fp; > + struct socket *so; > struct mbuf *m; > vm_page_t pa[]; > }; > @@ -255,7 +255,7 @@ static void > sendfile_iodone(void *arg, vm_page_t *pg, int count, int error) > { > struct sf_io *sfio = arg; > - struct socket *so; > + struct socket *so = sfio->so; > > for (int i = 0; i < count; i++) > if (pg[i] != bogus_page) > @@ -267,8 +267,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i > if (!refcount_release(&sfio->nios)) > return; > > - so = sfio->sock_fp->f_data; > - > if (sfio->error) { > struct mbuf *m; > > @@ -296,8 +294,8 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i > CURVNET_RESTORE(); > } > > - /* XXXGL: curthread */ > - fdrop(sfio->sock_fp, curthread); > + SOCK_LOCK(so); > + sorele(so); > free(sfio, M_TEMP); > } > > @@ -724,6 +722,7 @@ retry_space: > sfio = malloc(sizeof(struct sf_io) + > npages * sizeof(vm_page_t), M_TEMP, M_WAITOK); > refcount_init(&sfio->nios, 1); > + sfio->so = so; > sfio->error = 0; > > nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages, > @@ -858,9 +857,8 @@ prepend_header: > error = (*so->so_proto->pr_usrreqs->pru_send) > (so, 0, m, NULL, NULL, td); > } else { > - sfio->sock_fp = sock_fp; > sfio->npages = npages; > - fhold(sock_fp); > + soref(so); > error = (*so->so_proto->pr_usrreqs->pru_send) > (so, PRUS_NOTREADY, m, NULL, NULL, td); > sendfile_iodone(sfio, NULL, 0, 0); > From owner-svn-src-all@freebsd.org Thu Sep 14 08:47:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE62AE08A6E; Thu, 14 Sep 2017 08:47:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7C766AD3F; Thu, 14 Sep 2017 08:47:07 +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 v8E8l6Ct006796; Thu, 14 Sep 2017 08:47:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8E8l6GN006794; Thu, 14 Sep 2017 08:47:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709140847.v8E8l6GN006794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Sep 2017 08:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323578 - in head/sys: cddl/compat/opensolaris/kern kern X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys: cddl/compat/opensolaris/kern kern X-SVN-Commit-Revision: 323578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 08:47:08 -0000 Author: avg Date: Thu Sep 14 08:47:06 2017 New Revision: 323578 URL: https://svnweb.freebsd.org/changeset/base/323578 Log: dounmount: do not release the mount point's reference on the covered vnode As long as mnt_ref is not zero there can be a consumer that might try to access mnt_vnodecovered. For this reason the covered vnode must not be freed until mnt_ref goes to zero. So, move the release of the covered vnode to vfs_mount_destroy. Reviewed by: kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D12329 Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/kern/vfs_mount.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Thu Sep 14 05:48:23 2017 (r323577) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Thu Sep 14 08:47:06 2017 (r323578) @@ -209,6 +209,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const cha vput(vp); vfs_unbusy(mp); vfs_freeopts(mp->mnt_optnew); + mp->mnt_vnodecovered = NULL; vfs_mount_destroy(mp); return (error); } Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Sep 14 05:48:23 2017 (r323577) +++ head/sys/kern/vfs_mount.c Thu Sep 14 08:47:06 2017 (r323578) @@ -507,6 +507,8 @@ vfs_mount_destroy(struct mount *mp) KASSERT(mp->mnt_ref == 0, ("%s: invalid refcount in the drain path @ %s:%d", __func__, __FILE__, __LINE__)); + if (mp->mnt_vnodecovered != NULL) + vrele(mp->mnt_vnodecovered); if (mp->mnt_writeopcount != 0) panic("vfs_mount_destroy: nonzero writeopcount"); if (mp->mnt_secondary_writes != 0) @@ -819,6 +821,7 @@ vfs_domount_first( error = VFS_MOUNT(mp); if (error != 0) { vfs_unbusy(mp); + mp->mnt_vnodecovered = NULL; vfs_mount_destroy(mp); VI_LOCK(vp); vp->v_iflag &= ~VI_MOUNT; @@ -1426,7 +1429,7 @@ dounmount(struct mount *mp, int flags, struct thread * EVENTHANDLER_INVOKE(vfs_unmounted, mp, td); if (coveredvp != NULL) { coveredvp->v_mountedhere = NULL; - vput(coveredvp); + VOP_UNLOCK(coveredvp, 0); } vfs_event_signal(NULL, VQ_UNMOUNT, 0); if (mp == rootdevmp) From owner-svn-src-all@freebsd.org Thu Sep 14 14:26:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD1CCE1B8C8; Thu, 14 Sep 2017 14:26:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A740B75FDA; Thu, 14 Sep 2017 14:26:57 +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 v8EEQupt045499; Thu, 14 Sep 2017 14:26:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EEQupo045490; Thu, 14 Sep 2017 14:26:56 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141426.v8EEQupo045490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 14:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323579 - in head/sys: arm/include arm64/include kern mips/include powerpc/include riscv/include sparc64/include sys x86/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: arm/include arm64/include kern mips/include powerpc/include riscv/include sparc64/include sys x86/include X-SVN-Commit-Revision: 323579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 14:26:57 -0000 Author: jhb Date: Thu Sep 14 14:26:55 2017 New Revision: 323579 URL: https://svnweb.freebsd.org/changeset/base/323579 Log: Add AT_HWCAP and AT_EHDRFLAGS on all platforms. A new 'u_long *sv_hwcap' field is added to 'struct sysentvec'. A process ABI can set this field to point to a value holding a mask of architecture-specific CPU feature flags. If an ABI does not wish to supply AT_HWCAP to processes the field can be left as NULL. The support code for AT_EHDRFLAGS was already present on all systems, just the #define was not present. This is a step towards unifying the AT_* constants across platforms. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12290 Modified: head/sys/arm/include/elf.h head/sys/arm64/include/elf.h head/sys/kern/imgact_elf.c head/sys/mips/include/elf.h head/sys/powerpc/include/elf.h head/sys/riscv/include/elf.h head/sys/sparc64/include/elf.h head/sys/sys/sysent.h head/sys/x86/include/elf.h Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/arm/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -85,8 +85,9 @@ __ElfType(Auxinfo); #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ #define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 25 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ #define R_ARM_COUNT 33 /* Count of defined relocation types. */ Modified: head/sys/arm64/include/elf.h ============================================================================== --- head/sys/arm64/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/arm64/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -90,8 +90,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 24 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ /* Define "machine" characteristics */ #define ELF_TARG_CLASS ELFCLASS64 Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/kern/imgact_elf.c Thu Sep 14 14:26:55 2017 (r323579) @@ -1110,9 +1110,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); -#ifdef AT_EHDRFLAGS AUXARGS_ENTRY(pos, AT_EHDRFLAGS, args->hdr_eflags); -#endif if (imgp->execpathp != 0) AUXARGS_ENTRY(pos, AT_EXECPATH, imgp->execpathp); AUXARGS_ENTRY(pos, AT_OSRELDATE, @@ -1133,6 +1131,8 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct AUXARGS_ENTRY(pos, AT_STACKPROT, imgp->sysent->sv_shared_page_obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : imgp->sysent->sv_stackprot); + if (imgp->sysent->sv_hwcap != NULL) + AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/mips/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -144,8 +144,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 24 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ #define ET_DYN_LOAD_ADDR 0x0120000 Modified: head/sys/powerpc/include/elf.h ============================================================================== --- head/sys/powerpc/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/powerpc/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -107,8 +107,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 19 /* Number of pagesizes. */ #define AT_STACKPROT 21 /* Initial stack protection. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 23 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ /* * Relocation types. Modified: head/sys/riscv/include/elf.h ============================================================================== --- head/sys/riscv/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/riscv/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -90,8 +90,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 24 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ /* Define "machine" characteristics */ #define ELF_TARG_CLASS ELFCLASS64 Modified: head/sys/sparc64/include/elf.h ============================================================================== --- head/sys/sparc64/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/sparc64/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -92,8 +92,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 24 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ /* Define "machine" characteristics */ #if __ELF_WORD_SIZE == 32 Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/sys/sysent.h Thu Sep 14 14:26:55 2017 (r323579) @@ -129,6 +129,7 @@ struct sysentvec { void (*sv_schedtail)(struct thread *); void (*sv_thread_detach)(struct thread *); int (*sv_trap)(struct thread *); + u_long *sv_hwcap; /* Value passed in AT_HWCAP. */ }; #define SV_ILP32 0x000100 /* 32-bit executable. */ Modified: head/sys/x86/include/elf.h ============================================================================== --- head/sys/x86/include/elf.h Thu Sep 14 08:47:06 2017 (r323578) +++ head/sys/x86/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) @@ -100,8 +100,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 24 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ /* * Relocation types. From owner-svn-src-all@freebsd.org Thu Sep 14 14:30:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73552E1BC44; Thu, 14 Sep 2017 14:30:45 +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 4C39D7620E; Thu, 14 Sep 2017 14:30:45 +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 v8EEUiPx045695; Thu, 14 Sep 2017 14:30:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EEUieQ045691; Thu, 14 Sep 2017 14:30:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141430.v8EEUieQ045691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 14:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323580 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 323580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 14:30:45 -0000 Author: jhb Date: Thu Sep 14 14:30:43 2017 New Revision: 323580 URL: https://svnweb.freebsd.org/changeset/base/323580 Log: Add AT_HWCAP flags for VFP settings for FreeBSD/arm. These flags match the meaning and value of flags in Linux, though Linux has many more flags. Reviewed by: stevek, Michal Meloun (earlier version) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12291 Modified: head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/vfp.c head/sys/arm/include/elf.h head/sys/arm/include/md_var.h Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/arm/elf_machdep.c Thu Sep 14 14:30:43 2017 (r323580) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); static boolean_t elf32_arm_abi_supported(struct image_params *); +u_long elf_hwcap; + struct sysentvec elf32_freebsd_sysvec = { .sv_size = SYS_MAXSYSCALL, .sv_table = sysent, @@ -86,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_hwcap = &elf_hwcap, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: head/sys/arm/arm/vfp.c ============================================================================== --- head/sys/arm/arm/vfp.c Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/arm/vfp.c Thu Sep 14 14:30:43 2017 (r323580) @@ -33,9 +33,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -115,6 +117,7 @@ vfp_init(void) vfp_exists = 1; is_d32 = 0; PCPU_SET(vfpsid, fpsid); /* save the fpsid */ + elf_hwcap |= HWCAP_VFP; vfp_arch = (fpsid & VFPSID_SUBVERSION2_MASK) >> VFPSID_SUBVERSION_OFF; @@ -122,9 +125,13 @@ vfp_init(void) if (vfp_arch >= VFP_ARCH3) { tmp = fmrx(mvfr0); PCPU_SET(vfpmvfr0, tmp); + elf_hwcap |= HWCAP_VFPv3; - if ((tmp & VMVFR0_RB_MASK) == 2) + if ((tmp & VMVFR0_RB_MASK) == 2) { + elf_hwcap |= HWCAP_VFPD32; is_d32 = 1; + } else + elf_hwcap |= HWCAP_VFPv3D16; tmp = fmrx(mvfr1); PCPU_SET(vfpmvfr1, tmp); Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/include/elf.h Thu Sep 14 14:30:43 2017 (r323580) @@ -115,4 +115,10 @@ __ElfType(Auxinfo); #define ET_DYN_LOAD_ADDR 0x12000 +/* Flags passed in AT_HWCAP. */ +#define HWCAP_VFP 0x00000040 +#define HWCAP_VFPv3 0x00000200 +#define HWCAP_VFPv3D16 0x00000400 +#define HWCAP_VFPD32 0x00080000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/arm/include/md_var.h ============================================================================== --- head/sys/arm/include/md_var.h Thu Sep 14 14:26:55 2017 (r323579) +++ head/sys/arm/include/md_var.h Thu Sep 14 14:30:43 2017 (r323580) @@ -38,6 +38,7 @@ extern char sigcode[]; extern int szsigcode; extern uint32_t *vm_page_dump; extern int vm_page_dump_size; +extern u_long elf_hwcap; extern int (*_arm_memcpy)(void *, void *, int, int); extern int (*_arm_bzero)(void *, int, int); From owner-svn-src-all@freebsd.org Thu Sep 14 14:36:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E4C6E1C2F1; Thu, 14 Sep 2017 14:36:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D03E5766D6; Thu, 14 Sep 2017 14:36:57 +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 v8EEavGH049786; Thu, 14 Sep 2017 14:36:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EEavSd049785; Thu, 14 Sep 2017 14:36:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141436.v8EEavSd049785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 14:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323581 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 323581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 14:36:58 -0000 Author: jhb Date: Thu Sep 14 14:36:56 2017 New Revision: 323581 URL: https://svnweb.freebsd.org/changeset/base/323581 Log: Only mess with VFP state on the CPU for curthread for get/set_vfpcontext. Future changes will use these functions to fetch and store VFP state for threads other than curthread. Reviewed by: andrew, stevek, Michal Meloun MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12292 Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Sep 14 14:30:43 2017 (r323580) +++ head/sys/arm/arm/machdep.c Thu Sep 14 14:36:56 2017 (r323581) @@ -408,17 +408,18 @@ exec_setregs(struct thread *td, struct image_params *i static void get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) { - struct pcb *curpcb; + struct pcb *pcb; - curpcb = curthread->td_pcb; - critical_enter(); - - vfp_store(&curpcb->pcb_vfpstate, false); - memcpy(vfp->mcv_reg, curpcb->pcb_vfpstate.reg, + pcb = td->td_pcb; + if (td == curthread) { + critical_enter(); + vfp_store(&pcb->pcb_vfpstate, false); + critical_exit(); + } else + MPASS(TD_IS_SUSPENDED(td)); + memcpy(vfp->mcv_reg, pcb->pcb_vfpstate.reg, sizeof(vfp->mcv_reg)); - vfp->mcv_fpscr = curpcb->pcb_vfpstate.fpscr; - - critical_exit(); + vfp->mcv_fpscr = pcb->pcb_vfpstate.fpscr; } /* @@ -427,17 +428,18 @@ get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) static void set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) { - struct pcb *curpcb; + struct pcb *pcb; - curpcb = curthread->td_pcb; - critical_enter(); - - vfp_discard(td); - memcpy(curpcb->pcb_vfpstate.reg, vfp->mcv_reg, - sizeof(curpcb->pcb_vfpstate.reg)); - curpcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr; - - critical_exit(); + pcb = td->td_pcb; + if (td == curthread) { + critical_enter(); + vfp_discard(td); + critical_exit(); + } else + MPASS(TD_IS_SUSPENDED(td)); + memcpy(pcb->pcb_vfpstate.reg, vfp->mcv_reg, + sizeof(pcb->pcb_vfpstate.reg)); + pcb->pcb_vfpstate.fpscr = vfp->mcv_fpscr; } #endif From owner-svn-src-all@freebsd.org Thu Sep 14 15:03:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 612D6E1DE70; Thu, 14 Sep 2017 15:03:45 +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 3B9CC77BAA; Thu, 14 Sep 2017 15:03:45 +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 v8EF3ikC061745; Thu, 14 Sep 2017 15:03:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EF3irB061741; Thu, 14 Sep 2017 15:03:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141503.v8EF3irB061741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 15:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323582 - in head: lib/libc/sys sys/arm/arm sys/arm/include sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: lib/libc/sys sys/arm/arm sys/arm/include sys/conf X-SVN-Commit-Revision: 323582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 15:03:45 -0000 Author: jhb Date: Thu Sep 14 15:03:43 2017 New Revision: 323582 URL: https://svnweb.freebsd.org/changeset/base/323582 Log: Add ptrace operations to fetch and store VFP registers. Reviewed by: mmel, kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12294 Added: head/sys/arm/arm/ptrace_machdep.c (contents, props changed) Modified: head/lib/libc/sys/ptrace.2 head/sys/arm/include/ptrace.h head/sys/conf/files.arm Modified: head/lib/libc/sys/ptrace.2 ============================================================================== --- head/lib/libc/sys/ptrace.2 Thu Sep 14 14:36:56 2017 (r323581) +++ head/lib/libc/sys/ptrace.2 Thu Sep 14 15:03:43 2017 (r323582) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd June 11, 2017 +.Dd September 14, 2017 .Dt PTRACE 2 .Os .Sh NAME @@ -762,6 +762,28 @@ The .Fa data argument is ignored. .El +.Sh ARM MACHINE-SPECIFIC REQUESTS +.Bl -tag -width "Dv PT_SETVFPREGS" +.It Dv PT_GETVFPREGS +Return the thread's +.Dv VFP +machine state in the buffer pointed to by +.Fa addr . +.Pp +The +.Fa data +argument is ignored. +.It Dv PT_SETVFPREGS +Set the thread's +.Dv VFP +machine state from the buffer pointed to by +.Fa addr . +.Pp +The +.Fa data +argument is ignored. +.El +.Pp .Sh x86 MACHINE-SPECIFIC REQUESTS .Bl -tag -width "Dv PT_GETXSTATE_INFO" .It Dv PT_GETXMMREGS Added: head/sys/arm/arm/ptrace_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/ptrace_machdep.c Thu Sep 14 15:03:43 2017 (r323582) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2017 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#ifdef VFP +#include +#endif + +int +cpu_ptrace(struct thread *td, int req, void *addr, int data) +{ +#ifdef VFP + mcontext_vfp_t vfp; +#endif + int error; + + switch (req) { +#ifdef VFP + case PT_GETVFPREGS: + get_vfpcontext(td, &vfp); + error = copyout(&vfp, addr, sizeof(vfp)); + break; + case PT_SETVFPREGS: + error = copyin(addr, &vfp, sizeof(vfp)); + if (error == 0) + set_vfpcontext(td, &vfp); + break; +#endif + default: + error = EINVAL; + } + + return (error); +} Modified: head/sys/arm/include/ptrace.h ============================================================================== --- head/sys/arm/include/ptrace.h Thu Sep 14 14:36:56 2017 (r323581) +++ head/sys/arm/include/ptrace.h Thu Sep 14 15:03:43 2017 (r323582) @@ -4,5 +4,20 @@ #ifndef _MACHINE_PTRACE_H_ #define _MACHINE_PTRACE_H_ +#define __HAVE_PTRACE_MACHDEP + +/* + * Must match mcontext_vfp_t. Note that mcontext_vfp_t does not + * include explicit padding. + */ +struct vfpreg { + __uint64_t vfp_reg[32]; + __uint32_t vfp_scr; + __uint32_t vfp_pad0; +}; + +#define PT_GETVFPREGS (PT_FIRSTMACH + 0) +#define PT_SETVFPREGS (PT_FIRSTMACH + 1) + #endif /* !_MACHINE_PTRACE_H */ Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Sep 14 14:36:56 2017 (r323581) +++ head/sys/conf/files.arm Thu Sep 14 15:03:43 2017 (r323582) @@ -88,6 +88,7 @@ arm/arm/platform_pl310_if.m optional platform pl310 arm/arm/pmap-v4.c optional !armv6 arm/arm/pmap-v6.c optional armv6 arm/arm/pmu.c optional pmu | fdt hwpmc +arm/arm/ptrace_machdep.c standard arm/arm/sc_machdep.c optional sc arm/arm/setcpsr.S standard arm/arm/setstack.s standard From owner-svn-src-all@freebsd.org Thu Sep 14 15:06:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA9F8E1E155; Thu, 14 Sep 2017 15:06:30 +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 9849777E23; Thu, 14 Sep 2017 15:06:30 +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 v8EF6TVe061889; Thu, 14 Sep 2017 15:06:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EF6TNO061887; Thu, 14 Sep 2017 15:06:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141506.v8EF6TNO061887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 15:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323583 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 323583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 15:06:30 -0000 Author: jhb Date: Thu Sep 14 15:06:29 2017 New Revision: 323583 URL: https://svnweb.freebsd.org/changeset/base/323583 Log: Export get/set_vfpcontext from machdep.c. Should have been part of the previous commit to add ptrace operations for VFP registers. MFC after: 1 month Modified: head/sys/arm/arm/machdep.c head/sys/arm/include/vfp.h Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Sep 14 15:03:43 2017 (r323582) +++ head/sys/arm/arm/machdep.c Thu Sep 14 15:06:29 2017 (r323583) @@ -405,7 +405,7 @@ exec_setregs(struct thread *td, struct image_params *i /* * Get machine VFP context. */ -static void +void get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) { struct pcb *pcb; @@ -425,7 +425,7 @@ get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) /* * Set machine VFP context. */ -static void +void set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp) { struct pcb *pcb; Modified: head/sys/arm/include/vfp.h ============================================================================== --- head/sys/arm/include/vfp.h Thu Sep 14 15:03:43 2017 (r323582) +++ head/sys/arm/include/vfp.h Thu Sep 14 15:06:29 2017 (r323583) @@ -142,6 +142,8 @@ struct vfp_state { }; #ifdef _KERNEL +void get_vfpcontext(struct thread *, mcontext_vfp_t *); +void set_vfpcontext(struct thread *, mcontext_vfp_t *); void vfp_init(void); void vfp_store(struct vfp_state *, boolean_t); void vfp_discard(struct thread *); From owner-svn-src-all@freebsd.org Thu Sep 14 15:07:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0C93E1E2DB; Thu, 14 Sep 2017 15:07:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B39A7C150; Thu, 14 Sep 2017 15:07:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EF7mOr061974; Thu, 14 Sep 2017 15:07:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EF7mEc061971; Thu, 14 Sep 2017 15:07:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141507.v8EF7mEc061971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 15:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323584 - in head: sys/arm/arm sys/sys usr.bin/gcore X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: sys/arm/arm sys/sys usr.bin/gcore X-SVN-Commit-Revision: 323584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 15:07:49 -0000 Author: jhb Date: Thu Sep 14 15:07:48 2017 New Revision: 323584 URL: https://svnweb.freebsd.org/changeset/base/323584 Log: Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread. The core note matches the format and layout of NT_ARM_VFP on Linux. Debuggers use the AT_HWCAP flags to determine how many VFP registers are actually used and their format. Reviewed by: mmel (earlier version w/o gcore) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12293 Modified: head/sys/arm/arm/elf_machdep.c head/sys/sys/elf_common.h head/usr.bin/gcore/elfcore.c Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Thu Sep 14 15:06:29 2017 (r323583) +++ head/sys/arm/arm/elf_machdep.c Thu Sep 14 15:07:48 2017 (r323584) @@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VFP +#include +#endif static boolean_t elf32_arm_abi_supported(struct image_params *); @@ -127,9 +130,19 @@ elf32_arm_abi_supported(struct image_params *imgp) } void -elf32_dump_thread(struct thread *td __unused, void *dst __unused, - size_t *off __unused) +elf32_dump_thread(struct thread *td, void *dst, size_t *off) { +#ifdef VFP + mcontext_vfp_t vfp; + + if (dst != NULL) { + get_vfpcontext(td, &vfp); + *off = elf32_populate_note(NT_ARM_VFP, &vfp, dst, sizeof(vfp), + NULL); + } else + *off = elf32_populate_note(NT_ARM_VFP, NULL, NULL, sizeof(vfp), + NULL); +#endif } /* Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Thu Sep 14 15:06:29 2017 (r323583) +++ head/sys/sys/elf_common.h Thu Sep 14 15:07:48 2017 (r323584) @@ -757,6 +757,7 @@ typedef struct { #define NT_PTLWPINFO 17 /* Thread ptrace miscellaneous info. */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ #define NT_X86_XSTATE 0x202 /* x86 XSAVE extended state. */ +#define NT_ARM_VFP 0x400 /* ARM VFP registers */ /* Symbol Binding - ELFNN_ST_BIND - st_info */ #define STB_LOCAL 0 /* Local symbol */ Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Thu Sep 14 15:06:29 2017 (r323583) +++ head/usr.bin/gcore/elfcore.c Thu Sep 14 15:07:48 2017 (r323584) @@ -109,6 +109,9 @@ static void *elf_note_prpsinfo(void *, size_t *); static void *elf_note_prstatus(void *, size_t *); static void *elf_note_thrmisc(void *, size_t *); static void *elf_note_ptlwpinfo(void *, size_t *); +#if defined(__arm__) +static void *elf_note_arm_vfp(void *, size_t *); +#endif #if defined(__i386__) || defined(__amd64__) static void *elf_note_x86_xstate(void *, size_t *); #endif @@ -368,6 +371,9 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep elf_putnote(NT_FPREGSET, elf_note_fpregset, tids + i, sb); elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb); elf_putnote(NT_PTLWPINFO, elf_note_ptlwpinfo, tids + i, sb); +#if defined(__arm__) + elf_putnote(NT_ARM_VFP, elf_note_arm_vfp, tids + i, sb); +#endif #if defined(__i386__) || defined(__amd64__) elf_putnote(NT_X86_XSTATE, elf_note_x86_xstate, tids + i, sb); #endif @@ -717,6 +723,31 @@ elf_note_ptlwpinfo(void *arg, size_t *sizep) *sizep = sizeof(int) + sizeof(struct ptrace_lwpinfo); return (p); } + +#if defined(__arm__) +static void * +elf_note_arm_vfp(void *arg, size_t *sizep) +{ + lwpid_t tid; + struct vfpreg *vfp; + static bool has_vfp = true; + struct vfpreg info; + + tid = *(lwpid_t *)arg; + if (has_vfp) { + if (ptrace(PT_GETVFPREGS, tid, (void *)&info, 0) != 0) + has_vfp = false; + } + if (!has_vfp) { + *sizep = 0; + return (NULL); + } + vfp = calloc(1, sizeof(*vfp)); + memcpy(vfp, &info, sizeof(*vfp)); + *sizep = sizeof(*vfp); + return (vfp); +} +#endif #if defined(__i386__) || defined(__amd64__) static void * From owner-svn-src-all@freebsd.org Thu Sep 14 15:34:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BF89E1FECB; Thu, 14 Sep 2017 15:34:31 +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 CED0E804AA; Thu, 14 Sep 2017 15:34:30 +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 v8EFYT10074041; Thu, 14 Sep 2017 15:34:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EFYTMW074040; Thu, 14 Sep 2017 15:34:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141534.v8EFYTMW074040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 15:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323585 - head/sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/x86/include X-SVN-Commit-Revision: 323585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 15:34:31 -0000 Author: jhb Date: Thu Sep 14 15:34:29 2017 New Revision: 323585 URL: https://svnweb.freebsd.org/changeset/base/323585 Log: Add AT_EHDRFLAGS and AT_HWCAP on amd64. x86 has two separate (but identical) list of AT_* constants and the earlier commit to add AT_HWCAP only updated the i386 list. Modified: head/sys/x86/include/elf.h Modified: head/sys/x86/include/elf.h ============================================================================== --- head/sys/x86/include/elf.h Thu Sep 14 15:07:48 2017 (r323584) +++ head/sys/x86/include/elf.h Thu Sep 14 15:34:29 2017 (r323585) @@ -187,8 +187,10 @@ __ElfType(Auxinfo); #define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ #define AT_TIMEKEEP 22 /* Pointer to timehands. */ #define AT_STACKPROT 23 /* Initial stack protection. */ +#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */ +#define AT_HWCAP 25 /* CPU feature flags. */ -#define AT_COUNT 24 /* Count of defined aux entry types. */ +#define AT_COUNT 26 /* Count of defined aux entry types. */ /* * Relocation types. From owner-svn-src-all@freebsd.org Thu Sep 14 15:34:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0667E1FF4C; Thu, 14 Sep 2017 15:34:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BAB0805BB; Thu, 14 Sep 2017 15:34:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EFYjWe074095; Thu, 14 Sep 2017 15:34:45 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EFYjKh074090; Thu, 14 Sep 2017 15:34:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709141534.v8EFYjKh074090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 14 Sep 2017 15:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323586 - in head/sys/dev: amdsmn amdtemp intpm ioat ntb/ntb_hw X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/dev: amdsmn amdtemp intpm ioat ntb/ntb_hw X-SVN-Commit-Revision: 323586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 15:34:46 -0000 Author: cem Date: Thu Sep 14 15:34:45 2017 New Revision: 323586 URL: https://svnweb.freebsd.org/changeset/base/323586 Log: Add PNP metadata to a few drivers An eventual devd(8) or other component should be able to scan buses and automatically load drivers that match device ids described in this metadata. Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12364 Modified: head/sys/dev/amdsmn/amdsmn.c head/sys/dev/amdtemp/amdtemp.c head/sys/dev/intpm/intpm.c head/sys/dev/ioat/ioat.c head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Modified: head/sys/dev/amdsmn/amdsmn.c ============================================================================== --- head/sys/dev/amdsmn/amdsmn.c Thu Sep 14 15:34:29 2017 (r323585) +++ head/sys/dev/amdsmn/amdsmn.c Thu Sep 14 15:34:45 2017 (r323586) @@ -89,6 +89,8 @@ static driver_t amdsmn_driver = { static devclass_t amdsmn_devclass; DRIVER_MODULE(amdsmn, hostb, amdsmn_driver, amdsmn_devclass, NULL, NULL); MODULE_VERSION(amdsmn, 1); +MODULE_PNP_INFO("W32:vendor/device", pci, amdsmn, amdsmn_ids, + sizeof(amdsmn_ids[0]), nitems(amdsmn_ids)); static bool amdsmn_match(device_t parent) Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Thu Sep 14 15:34:29 2017 (r323585) +++ head/sys/dev/amdtemp/amdtemp.c Thu Sep 14 15:34:45 2017 (r323586) @@ -100,7 +100,6 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC16_M30H }, { VENDORID_AMD, DEVICEID_AMD_MISC17 }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H }, - { 0, 0 } }; /* @@ -165,6 +164,8 @@ static devclass_t amdtemp_devclass; DRIVER_MODULE(amdtemp, hostb, amdtemp_driver, amdtemp_devclass, NULL, NULL); MODULE_VERSION(amdtemp, 1); MODULE_DEPEND(amdtemp, amdsmn, 1, 1, 1); +MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdtemp, amdtemp_products, + sizeof(amdtemp_products[0]), nitems(amdtemp_products)); static int amdtemp_match(device_t dev) @@ -175,7 +176,7 @@ amdtemp_match(device_t dev) vendor = pci_get_vendor(dev); devid = pci_get_device(dev); - for (i = 0; amdtemp_products[i].amdtemp_vendorid != 0; i++) { + for (i = 0; i < nitems(amdtemp_products); i++) { if (vendor == amdtemp_products[i].amdtemp_vendorid && devid == amdtemp_products[i].amdtemp_deviceid) return (1); Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Thu Sep 14 15:34:29 2017 (r323585) +++ head/sys/dev/intpm/intpm.c Thu Sep 14 15:34:45 2017 (r323586) @@ -88,34 +88,38 @@ static int intsmb_stop_poll(struct intsmb_softc *sc); static int intsmb_free(struct intsmb_softc *sc); static void intsmb_rawintr(void *arg); +const struct intsmb_device { + uint32_t devid; + const char *description; +} intsmb_products[] = { + { 0x71138086, "Intel PIIX4 SMBUS Interface" }, + { 0x719b8086, "Intel PIIX4 SMBUS Interface" }, +#if 0 + /* Not a good idea yet, this stops isab0 functioning */ + { 0x02001166, "ServerWorks OSB4" }, +#endif + { 0x43721002, "ATI IXP400 SMBus Controller" }, + { AMDSB_SMBUS_DEVID, "AMD SB600/7xx/8xx/9xx SMBus Controller" }, + { AMDFCH_SMBUS_DEVID, "AMD FCH SMBus Controller" }, + { AMDCZ_SMBUS_DEVID, "AMD FCH SMBus Controller" }, +}; + static int intsmb_probe(device_t dev) { + const struct intsmb_device *isd; + uint32_t devid; + size_t i; - switch (pci_get_devid(dev)) { - case 0x71138086: /* Intel 82371AB */ - case 0x719b8086: /* Intel 82443MX */ -#if 0 - /* Not a good idea yet, this stops isab0 functioning */ - case 0x02001166: /* ServerWorks OSB4 */ -#endif - device_set_desc(dev, "Intel PIIX4 SMBUS Interface"); - break; - case 0x43721002: - device_set_desc(dev, "ATI IXP400 SMBus Controller"); - break; - case AMDSB_SMBUS_DEVID: - device_set_desc(dev, "AMD SB600/7xx/8xx/9xx SMBus Controller"); - break; - case AMDFCH_SMBUS_DEVID: /* AMD FCH */ - case AMDCZ_SMBUS_DEVID: /* AMD Carizzo FCH */ - device_set_desc(dev, "AMD FCH SMBus Controller"); - break; - default: - return (ENXIO); + devid = pci_get_devid(dev); + for (i = 0; i < nitems(intsmb_products); i++) { + isd = &intsmb_products[i]; + if (isd->devid == devid) { + device_set_desc(dev, isd->description); + return (BUS_PROBE_DEFAULT); + } } - - return (BUS_PROBE_DEFAULT); + return (ENXIO); } static uint8_t @@ -891,3 +895,5 @@ DRIVER_MODULE_ORDERED(intsmb, pci, intsmb_driver, ints DRIVER_MODULE(smbus, intsmb, smbus_driver, smbus_devclass, 0, 0); MODULE_DEPEND(intsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); MODULE_VERSION(intsmb, 1); +MODULE_PNP_INFO("W32:vendor/device;D:human", pci, intpm, intsmb_products, + sizeof(intsmb_products[0]), nitems(intsmb_products)); Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Thu Sep 14 15:34:29 2017 (r323585) +++ head/sys/dev/ioat/ioat.c Thu Sep 14 15:34:45 2017 (r323586) @@ -236,10 +236,11 @@ static struct _pcsid { 0x6f278086, "BDX IOAT Ch7" }, { 0x6f2e8086, "BDX IOAT Ch0 (RAID)" }, { 0x6f2f8086, "BDX IOAT Ch1 (RAID)" }, - - { 0x00000000, NULL } }; +MODULE_PNP_INFO("W32:vendor/device;D:human", pci, ioat, pci_ids, + sizeof(pci_ids[0]), nitems(pci_ids)); + /* * OS <-> Driver linkage functions */ @@ -250,7 +251,7 @@ ioat_probe(device_t device) u_int32_t type; type = pci_get_devid(device); - for (ep = pci_ids; ep->type; ep++) { + for (ep = pci_ids; ep < &pci_ids[nitems(pci_ids)]; ep++) { if (ep->type == type) { device_set_desc(device, ep->desc); return (0); Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Sep 14 15:34:29 2017 (r323585) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Sep 14 15:34:45 2017 (r323586) @@ -495,8 +495,6 @@ static struct ntb_hw_info pci_ids[] = { { 0x6F0D8086, "BDX Xeon E5 V4 Non-Transparent Bridge B2B", NTB_XEON, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | NTB_SB01BASE_LOCKUP }, - - { 0x00000000, NULL, NTB_ATOM, 0 } }; static const struct ntb_reg atom_reg = { @@ -1390,12 +1388,11 @@ intel_ntb_get_msix_info(struct ntb_softc *ntb) static struct ntb_hw_info * intel_ntb_get_device_info(uint32_t device_id) { - struct ntb_hw_info *ep = pci_ids; + struct ntb_hw_info *ep; - while (ep->device_id) { + for (ep = pci_ids; ep < &pci_ids[nitems(pci_ids)]; ep++) { if (ep->device_id == device_id) return (ep); - ++ep; } return (NULL); } @@ -3122,3 +3119,5 @@ static DEFINE_CLASS_0(ntb_hw, ntb_intel_driver, ntb_in DRIVER_MODULE(ntb_hw_intel, pci, ntb_intel_driver, ntb_hw_devclass, NULL, NULL); MODULE_DEPEND(ntb_hw_intel, ntb, 1, 1, 1); MODULE_VERSION(ntb_hw_intel, 1); +MODULE_PNP_INFO("W32:vendor/device;D:human", pci, ntb_hw_intel, pci_ids, + sizeof(pci_ids[0]), nitems(pci_ids)); From owner-svn-src-all@freebsd.org Thu Sep 14 15:37:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B579E2026A; Thu, 14 Sep 2017 15:37:45 +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 4AF9480B55; Thu, 14 Sep 2017 15:37:45 +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 8166110A7DB; Thu, 14 Sep 2017 11:37:43 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323580 - in head/sys/arm: arm include Date: Thu, 14 Sep 2017 07:54:17 -0700 Message-ID: <2385698.hFNfOSpqlD@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201709141430.v8EEUieQ045691@repo.freebsd.org> References: <201709141430.v8EEUieQ045691@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 14 Sep 2017 11:37:43 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 15:37:45 -0000 On Thursday, September 14, 2017 02:30:44 PM John Baldwin wrote: > Author: jhb > Date: Thu Sep 14 14:30:43 2017 > New Revision: 323580 > URL: https://svnweb.freebsd.org/changeset/base/323580 > > Log: > Add AT_HWCAP flags for VFP settings for FreeBSD/arm. > > These flags match the meaning and value of flags in Linux, though > Linux has many more flags. > > Reviewed by: stevek, Michal Meloun (earlier version) > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D12291 It would probably be good to add HWCAP_NEON if someone knows the right things to check to detect it. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Sep 14 16:27:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42B5BE22BEA; Thu, 14 Sep 2017 16:27:23 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 1117983789; Thu, 14 Sep 2017 16:27:21 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from dhcp-10-248-113-1.eduroam.wireless.private.cam.ac.uk (global-5-143.nat-2.net.cam.ac.uk [131.111.5.143]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id A66A64E690; Thu, 14 Sep 2017 16:27:14 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r323580 - in head/sys/arm: arm include From: Andrew Turner In-Reply-To: <2385698.hFNfOSpqlD@ralph.baldwin.cx> Date: Thu, 14 Sep 2017 17:27:14 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <5678B08C-F4FD-474C-A3F2-8B4C8973FC22@fubar.geek.nz> References: <201709141430.v8EEUieQ045691@repo.freebsd.org> <2385698.hFNfOSpqlD@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:27:23 -0000 > On 14 Sep 2017, at 15:54, John Baldwin wrote: >=20 > On Thursday, September 14, 2017 02:30:44 PM John Baldwin wrote: >> Author: jhb >> Date: Thu Sep 14 14:30:43 2017 >> New Revision: 323580 >> URL: https://svnweb.freebsd.org/changeset/base/323580 >>=20 >> Log: >> Add AT_HWCAP flags for VFP settings for FreeBSD/arm. >>=20 >> These flags match the meaning and value of flags in Linux, though >> Linux has many more flags. >>=20 >> Reviewed by: stevek, Michal Meloun = (earlier version) >> MFC after: 1 month >> Differential Revision: https://reviews.freebsd.org/D12291 >=20 > It would probably be good to add HWCAP_NEON if someone knows the right = things > to check to detect it. You=E2=80=99ll need to check the mvfr1 register for it. Linux checks the = A_SIMD SPFP, A_SIMD integer, and A_SIMD load/store fields are all 1. Andrew=20 From owner-svn-src-all@freebsd.org Thu Sep 14 16:41:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CF15E235C9; Thu, 14 Sep 2017 16:41:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A41D844D0; Thu, 14 Sep 2017 16:41:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EGfMFq099691; Thu, 14 Sep 2017 16:41:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EGfMCn099690; Thu, 14 Sep 2017 16:41:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709141641.v8EGfMCn099690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 Sep 2017 16:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323587 - head/sys/contrib/octeon-sdk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/contrib/octeon-sdk X-SVN-Commit-Revision: 323587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:41:23 -0000 Author: emaste Date: Thu Sep 14 16:41:22 2017 New Revision: 323587 URL: https://svnweb.freebsd.org/changeset/base/323587 Log: octeon sdk: initialize variable to quiet Clang warning Clang complains "variable 'dummy' is uninitialized when used here". Reported by: Clang MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/contrib/octeon-sdk/cvmx-l2c.c Modified: head/sys/contrib/octeon-sdk/cvmx-l2c.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-l2c.c Thu Sep 14 15:34:45 2017 (r323586) +++ head/sys/contrib/octeon-sdk/cvmx-l2c.c Thu Sep 14 16:41:22 2017 (r323587) @@ -339,7 +339,7 @@ uint64_t cvmx_l2c_read_perf(uint32_t counter) static void fault_in(uint64_t addr, int len) { volatile char *ptr; - volatile char dummy; + volatile char dummy = 0; /* * Adjust addr and length so we get all cache lines even for * small ranges spanning two cache lines. From owner-svn-src-all@freebsd.org Thu Sep 14 16:41:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47B18E235CF; Thu, 14 Sep 2017 16:41:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15660844DA; Thu, 14 Sep 2017 16:41:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EGfOi4099738; Thu, 14 Sep 2017 16:41:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EGfOLg099737; Thu, 14 Sep 2017 16:41:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709141641.v8EGfOLg099737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 16:41:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323588 - head/contrib/elftoolchain/readelf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 323588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:41:25 -0000 Author: jhb Date: Thu Sep 14 16:41:24 2017 New Revision: 323588 URL: https://svnweb.freebsd.org/changeset/base/323588 Log: Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores. Reviewed by: emaste MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12371 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Thu Sep 14 16:41:22 2017 (r323587) +++ head/contrib/elftoolchain/readelf/readelf.c Thu Sep 14 16:41:24 2017 (r323588) @@ -1141,7 +1141,9 @@ note_type_freebsd_core(unsigned int nt) case 14: return "NT_PROCSTAT_OSREL"; case 15: return "NT_PROCSTAT_PSSTRINGS"; case 16: return "NT_PROCSTAT_AUXV"; + case 17: return "NT_PTLWPINFO"; case 0x202: return "NT_X86_XSTATE (x86 XSAVE extended state)"; + case 0x400: return "NT_ARM_VFP (arm VFP registers)"; default: return (note_type_unknown(nt)); } } From owner-svn-src-all@freebsd.org Thu Sep 14 16:42:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B1F0E2384D; Thu, 14 Sep 2017 16:42:31 +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 EA10284863; Thu, 14 Sep 2017 16:42:30 +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 v8EGgUfY002912; Thu, 14 Sep 2017 16:42:30 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EGgUuf002911; Thu, 14 Sep 2017 16:42:30 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201709141642.v8EGgUuf002911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 14 Sep 2017 16:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323589 - head/sys/boot/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/boot/i386/libi386 X-SVN-Commit-Revision: 323589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:42:31 -0000 Author: tsoome Date: Thu Sep 14 16:42:29 2017 New Revision: 323589 URL: https://svnweb.freebsd.org/changeset/base/323589 Log: loader: biosmem.c cstyle cleanup No functional changes, just cleanup. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12370 Modified: head/sys/boot/i386/libi386/biosmem.c Modified: head/sys/boot/i386/libi386/biosmem.c ============================================================================== --- head/sys/boot/i386/libi386/biosmem.c Thu Sep 14 16:41:24 2017 (r323588) +++ head/sys/boot/i386/libi386/biosmem.c Thu Sep 14 16:42:29 2017 (r323589) @@ -63,150 +63,157 @@ static uint8_t b_bios_probed; * memory correctly. You need both maker and product as * reported by smbios. */ -#define BQ_DISTRUST_E820_EXTMEM 0x1 /* e820 might not return useful - extended memory */ +/* e820 might not return useful extended memory */ +#define BQ_DISTRUST_E820_EXTMEM 0x1 struct bios_getmem_quirks { - const char* bios_vendor; - const char* maker; - const char* product; - int quirk; + const char *bios_vendor; + const char *maker; + const char *product; + int quirk; }; static struct bios_getmem_quirks quirks[] = { - {"coreboot", "Acer", "Peppy", BQ_DISTRUST_E820_EXTMEM}, - {NULL, NULL, NULL, 0} + {"coreboot", "Acer", "Peppy", BQ_DISTRUST_E820_EXTMEM}, + {NULL, NULL, NULL, 0} }; static int bios_getquirks(void) { - int i; + int i; - for (i=0; quirks[i].quirk != 0; ++i) - if (smbios_match(quirks[i].bios_vendor, quirks[i].maker, - quirks[i].product)) - return (quirks[i].quirk); + for (i = 0; quirks[i].quirk != 0; ++i) { + if (smbios_match(quirks[i].bios_vendor, quirks[i].maker, + quirks[i].product)) + return (quirks[i].quirk); + } - return (0); + return (0); } void bios_getmem(void) { - uint64_t size; + uint64_t size; - /* Parse system memory map */ - v86.ebx = 0; - do { - v86.ctl = V86_FLAGS; - v86.addr = 0x15; /* int 0x15 function 0xe820*/ - v86.eax = 0xe820; - v86.ecx = sizeof(struct bios_smap_xattr); - v86.edx = SMAP_SIG; - v86.es = VTOPSEG(&smap); - v86.edi = VTOPOFF(&smap); - v86int(); - if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG)) - break; - /* look for a low-memory segment that's large enough */ - if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) && - (smap.length >= (512 * 1024))) { - bios_basemem = smap.length; - b_bios_probed |= B_BASEMEM_E820; - } + /* Parse system memory map */ + v86.ebx = 0; + do { + v86.ctl = V86_FLAGS; + v86.addr = 0x15; /* int 0x15 function 0xe820 */ + v86.eax = 0xe820; + v86.ecx = sizeof(struct bios_smap_xattr); + v86.edx = SMAP_SIG; + v86.es = VTOPSEG(&smap); + v86.edi = VTOPOFF(&smap); + v86int(); + if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG)) + break; + /* look for a low-memory segment that's large enough */ + if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) && + (smap.length >= (512 * 1024))) { + bios_basemem = smap.length; + b_bios_probed |= B_BASEMEM_E820; + } - /* look for the first segment in 'extended' memory */ - if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0x100000) && - !(bios_getquirks() & BQ_DISTRUST_E820_EXTMEM)) { - bios_extmem = smap.length; - b_bios_probed |= B_EXTMEM_E820; - } + /* look for the first segment in 'extended' memory */ + if ((smap.type == SMAP_TYPE_MEMORY) && + (smap.base == 0x100000) && + !(bios_getquirks() & BQ_DISTRUST_E820_EXTMEM)) { + bios_extmem = smap.length; + b_bios_probed |= B_EXTMEM_E820; + } - /* - * Look for the largest segment in 'extended' memory beyond - * 1MB but below 4GB. - */ - if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base > 0x100000) && - (smap.base < 0x100000000ull)) { - size = smap.length; + /* + * Look for the largest segment in 'extended' memory beyond + * 1MB but below 4GB. + */ + if ((smap.type == SMAP_TYPE_MEMORY) && + (smap.base > 0x100000) && + (smap.base < 0x100000000ull)) { + size = smap.length; - /* - * If this segment crosses the 4GB boundary, truncate it. - */ - if (smap.base + size > 0x100000000ull) - size = 0x100000000ull - smap.base; + /* + * If this segment crosses the 4GB boundary, + * truncate it. + */ + if (smap.base + size > 0x100000000ull) + size = 0x100000000ull - smap.base; - if (size > high_heap_size) { - high_heap_size = size; - high_heap_base = smap.base; - } - } - } while (v86.ebx != 0); + if (size > high_heap_size) { + high_heap_size = size; + high_heap_base = smap.base; + } + } + } while (v86.ebx != 0); - /* Fall back to the old compatibility function for base memory */ - if (bios_basemem == 0) { - v86.ctl = 0; - v86.addr = 0x12; /* int 0x12 */ - v86int(); - - bios_basemem = (v86.eax & 0xffff) * 1024; - b_bios_probed |= B_BASEMEM_12; - } + /* Fall back to the old compatibility function for base memory */ + if (bios_basemem == 0) { + v86.ctl = 0; + v86.addr = 0x12; /* int 0x12 */ + v86int(); - /* Fall back through several compatibility functions for extended memory */ - if (bios_extmem == 0) { - v86.ctl = V86_FLAGS; - v86.addr = 0x15; /* int 0x15 function 0xe801*/ - v86.eax = 0xe801; - v86int(); - if (!(V86_CY(v86.efl))) { - /* - * Clear high_heap; it may end up overlapping - * with the segment we're determining here. - * Let the default "steal stuff from top of - * bios_extmem" code below pick up on it. - */ - high_heap_size = 0; - high_heap_base = 0; + bios_basemem = (v86.eax & 0xffff) * 1024; + b_bios_probed |= B_BASEMEM_12; + } - /* - * %cx is the number of 1KiB blocks between 1..16MiB. - * It can only be up to 0x3c00; if it's smaller then - * there's a PC AT memory hole so we can't treat - * it as contiguous. - */ - bios_extmem = (v86.ecx & 0xffff) * 1024; - if (bios_extmem == (1024 * 0x3c00)) - bios_extmem += (v86.edx & 0xffff) * 64 * 1024; + /* + * Fall back through several compatibility functions for extended + * memory. + */ + if (bios_extmem == 0) { + v86.ctl = V86_FLAGS; + v86.addr = 0x15; /* int 0x15 function 0xe801 */ + v86.eax = 0xe801; + v86int(); + if (!(V86_CY(v86.efl))) { + /* + * Clear high_heap; it may end up overlapping + * with the segment we're determining here. + * Let the default "steal stuff from top of + * bios_extmem" code below pick up on it. + */ + high_heap_size = 0; + high_heap_base = 0; - /* truncate bios_extmem */ - if (bios_extmem > 0x3ff00000) - bios_extmem = 0x3ff00000; + /* + * %cx is the number of 1KiB blocks between 1..16MiB. + * It can only be up to 0x3c00; if it's smaller then + * there's a PC AT memory hole so we can't treat + * it as contiguous. + */ + bios_extmem = (v86.ecx & 0xffff) * 1024; + if (bios_extmem == (1024 * 0x3c00)) + bios_extmem += (v86.edx & 0xffff) * 64 * 1024; - b_bios_probed |= B_EXTMEM_E801; + /* truncate bios_extmem */ + if (bios_extmem > 0x3ff00000) + bios_extmem = 0x3ff00000; + + b_bios_probed |= B_EXTMEM_E801; + } } - } - if (bios_extmem == 0) { - v86.ctl = 0; - v86.addr = 0x15; /* int 0x15 function 0x88*/ - v86.eax = 0x8800; - v86int(); - bios_extmem = (v86.eax & 0xffff) * 1024; - b_bios_probed |= B_EXTMEM_8800; - } + if (bios_extmem == 0) { + v86.ctl = 0; + v86.addr = 0x15; /* int 0x15 function 0x88 */ + v86.eax = 0x8800; + v86int(); + bios_extmem = (v86.eax & 0xffff) * 1024; + b_bios_probed |= B_EXTMEM_8800; + } - /* Set memtop to actual top of memory */ - memtop = memtop_copyin = 0x100000 + bios_extmem; + /* Set memtop to actual top of memory */ + memtop = memtop_copyin = 0x100000 + bios_extmem; - /* - * If we have extended memory and did not find a suitable heap - * region in the SMAP, use the last HEAP_MIN of 'extended' memory as a - * high heap candidate. - */ - if (bios_extmem >= HEAP_MIN && high_heap_size < HEAP_MIN) { - high_heap_size = HEAP_MIN; - high_heap_base = memtop - HEAP_MIN; - } + /* + * If we have extended memory and did not find a suitable heap + * region in the SMAP, use the last HEAP_MIN of 'extended' memory as a + * high heap candidate. + */ + if (bios_extmem >= HEAP_MIN && high_heap_size < HEAP_MIN) { + high_heap_size = HEAP_MIN; + high_heap_base = memtop - HEAP_MIN; + } } static int @@ -214,16 +221,16 @@ command_biosmem(int argc, char *argv[]) { int bq = bios_getquirks(); - printf("bios_basemem: 0x%llx\n", (unsigned long long) bios_basemem); - printf("bios_extmem: 0x%llx\n", (unsigned long long) bios_extmem); - printf("memtop: 0x%llx\n", (unsigned long long) memtop); - printf("high_heap_base: 0x%llx\n", (unsigned long long) high_heap_base); - printf("high_heap_size: 0x%llx\n", (unsigned long long) high_heap_size); + printf("bios_basemem: 0x%llx\n", (unsigned long long)bios_basemem); + printf("bios_extmem: 0x%llx\n", (unsigned long long)bios_extmem); + printf("memtop: 0x%llx\n", (unsigned long long)memtop); + printf("high_heap_base: 0x%llx\n", (unsigned long long)high_heap_base); + printf("high_heap_size: 0x%llx\n", (unsigned long long)high_heap_size); printf("bios_quirks: 0x%02x", bq); if (bq & BQ_DISTRUST_E820_EXTMEM) printf(" BQ_DISTRUST_E820_EXTMEM"); printf("\n"); - printf("b_bios_probed: 0x%02x", (int) b_bios_probed); + printf("b_bios_probed: 0x%02x", (int)b_bios_probed); if (b_bios_probed & B_BASEMEM_E820) printf(" B_BASEMEM_E820"); if (b_bios_probed & B_BASEMEM_12) From owner-svn-src-all@freebsd.org Thu Sep 14 16:49:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD3C3E23E6E; Thu, 14 Sep 2017 16:49:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99C1984E53; Thu, 14 Sep 2017 16:49:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EGnhZE003223; Thu, 14 Sep 2017 16:49:43 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EGnhr0003222; Thu, 14 Sep 2017 16:49:43 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709141649.v8EGnhr0003222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 14 Sep 2017 16:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323590 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 323590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:49:44 -0000 Author: gjb Date: Thu Sep 14 16:49:43 2017 New Revision: 323590 URL: https://svnweb.freebsd.org/changeset/base/323590 Log: Document r320312 and r321074, cancel-safe support in stdio(3) and syslog(3). Submitted by: eugen Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 16:42:29 2017 (r323589) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 16:49:43 2017 (r323590) @@ -294,7 +294,19 @@ The &man.kvm.close.3; function has been updated to return the accumulated error from previous &man.close.2; calls. - + + The &man.syslog.3; function has been + updated to be more resilent to thread cancellation occurring + in supported deferred mode, eliminating possible lockups in + multi-threaded applications that often create and cancel + threads using the function, such as net/mpd5. + + The &man.stdio.3; function has been + updated to be deferred cancel-safe, eliminating possible + lockups in multi-threaded applications using functions such + as &man.funopen.3;, &man.fropen.3;, and &man.fwopen.3;. + ABI Compatibility From owner-svn-src-all@freebsd.org Thu Sep 14 16:54:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 295FDE24290; Thu, 14 Sep 2017 16:54:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9DB36C9; Thu, 14 Sep 2017 16:54:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EGs5U0006953; Thu, 14 Sep 2017 16:54:05 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EGs5ZF006952; Thu, 14 Sep 2017 16:54:05 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709141654.v8EGs5ZF006952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 14 Sep 2017 16:54:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323591 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 323591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:54:07 -0000 Author: gjb Date: Thu Sep 14 16:54:05 2017 New Revision: 323591 URL: https://svnweb.freebsd.org/changeset/base/323591 Log: Document r320772, syslogd(8) logging retry after restarting unexpectedly. Submitted by: eugen Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 16:49:43 2017 (r323590) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 16:54:05 2017 (r323591) @@ -200,6 +200,10 @@ been marked as deprecated, and planned for removal in &os; 12.0-RELEASE. + The &man.syslogd.8; utility has been + updated to restart logging a subprocess that had restarted + unexpectedly. + The &man.gdb.1; and &man.kgdb.1; utilities have been marked as deprecated, and planned for removal from the base system in the future. A newer version From owner-svn-src-all@freebsd.org Thu Sep 14 16:58:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECED8E24537; Thu, 14 Sep 2017 16:58:27 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B99EAADC; Thu, 14 Sep 2017 16:58:27 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EGwQbN007166; Thu, 14 Sep 2017 16:58:26 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EGwQGu007165; Thu, 14 Sep 2017 16:58:26 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709141658.v8EGwQGu007165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 14 Sep 2017 16:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323592 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 323592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 16:58:28 -0000 Author: gjb Date: Thu Sep 14 16:58:26 2017 New Revision: 323592 URL: https://svnweb.freebsd.org/changeset/base/323592 Log: Fix an indentation mistake that snuck in with r323590. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 16:54:05 2017 (r323591) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 16:58:26 2017 (r323592) @@ -310,7 +310,7 @@ updated to be deferred cancel-safe, eliminating possible lockups in multi-threaded applications using functions such as &man.funopen.3;, &man.fropen.3;, and &man.fwopen.3;. - + ABI Compatibility From owner-svn-src-all@freebsd.org Thu Sep 14 17:29:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3F10E25DB8; Thu, 14 Sep 2017 17:29:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDE852224; Thu, 14 Sep 2017 17:29:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EHTpEA019782; Thu, 14 Sep 2017 17:29:51 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EHTpM0019776; Thu, 14 Sep 2017 17:29:51 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201709141729.v8EHTpM0019776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Sep 2017 17:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323593 - in head/sys: arm64/arm64 arm64/include conf X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/include conf X-SVN-Commit-Revision: 323593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 17:29:53 -0000 Author: andrew Date: Thu Sep 14 17:29:51 2017 New Revision: 323593 URL: https://svnweb.freebsd.org/changeset/base/323593 Log: Add support for handling undefined instructions in userspace and the kernel. We can register callbacks to perform the required operation on the saved registers before returning. This is initially used to work around a bug in old versions of QEMU that trigger such an exception when reading from an ID register when it should load z zero value. I expect this could be used with other exception types, e.g. to emulate special register access from userland. Sponsored by: DARPA, AFRL Added: head/sys/arm64/arm64/undefined.c (contents, props changed) head/sys/arm64/include/undefined.h (contents, props changed) Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/trap.c head/sys/conf/files.arm64 Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Thu Sep 14 16:58:26 2017 (r323592) +++ head/sys/arm64/arm64/identcpu.c Thu Sep 14 17:29:51 2017 (r323593) @@ -897,11 +897,7 @@ identify_cpu(void) cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(ID_AA64ISAR1_EL1); cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(ID_AA64MMFR0_EL1); cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(ID_AA64MMFR1_EL1); -#ifdef NOTYET cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(ID_AA64MMFR2_EL1); -#else - cpu_desc[cpu].id_aa64mmfr2 = 0; -#endif cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1); cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(ID_AA64PFR1_EL1); Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu Sep 14 16:58:26 2017 (r323592) +++ head/sys/arm64/arm64/machdep.c Thu Sep 14 17:29:51 2017 (r323593) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef VFP @@ -162,6 +163,7 @@ static void cpu_startup(void *dummy) { + undef_init(); identify_cpu(); vm_ksubmap_init(&kmi); Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Sep 14 16:58:26 2017 (r323592) +++ head/sys/arm64/arm64/trap.c Thu Sep 14 17:29:51 2017 (r323593) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef KDTRACE_HOOKS #include @@ -332,6 +333,10 @@ do_el1h_sync(struct thread *td, struct trapframe *fram panic("No debugger in kernel.\n"); #endif break; + case EXCP_UNKNOWN: + if (undef_insn(1, frame)) + break; + /* FALLTHROUGH */ default: print_registers(frame); panic("Unknown kernel exception %x esr_el1 %lx\n", exception, @@ -341,20 +346,6 @@ do_el1h_sync(struct thread *td, struct trapframe *fram td->td_frame = oframe; } -/* - * The attempted execution of an instruction bit pattern that has no allocated - * instruction results in an exception with an unknown reason. - */ -static void -el0_excp_unknown(struct trapframe *frame, uint64_t far) -{ - struct thread *td; - - td = curthread; - call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far); - userret(td, frame); -} - void do_el0_sync(struct thread *td, struct trapframe *frame) { @@ -399,7 +390,9 @@ do_el0_sync(struct thread *td, struct trapframe *frame data_abort(td, frame, esr, far, 1); break; case EXCP_UNKNOWN: - el0_excp_unknown(frame, far); + if (!undef_insn(0, frame)) + call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far); + userret(td, frame); break; case EXCP_SP_ALIGN: call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp); Added: head/sys/arm64/arm64/undefined.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/undefined.c Thu Sep 14 17:29:51 2017 (r323593) @@ -0,0 +1,145 @@ +/*- + * Copyright (c) 2017 Andrew Turner + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +MALLOC_DEFINE(M_UNDEF, "undefhandler", "Undefined instruction handler data"); + +struct undef_handler { + LIST_ENTRY(undef_handler) uh_link; + undef_handler_t uh_handler; +}; + +/* + * Create two undefined instruction handler lists, one for userspace, one for + * the kernel. This allows us to handle instructions that will trap + */ +LIST_HEAD(, undef_handler) undef_handlers[2]; + +/* + * Work around a bug in QEMU prior to 2.5.1 where reading unknown ID + * registers would raise an exception when they should return 0. + */ +static int +id_aa64mmfr2_handler(vm_offset_t va, uint32_t insn, struct trapframe *frame, + uint32_t esr) +{ + int reg; + +#define MRS_MASK 0xfff00000 +#define MRS_VALUE 0xd5300000 +#define MRS_REGISTER(insn) ((insn) & 0x1f) +#define MRS_ID_AA64MMFR2_EL0_MASK (MRS_MASK | 0x000fffe0) +#define MRS_ID_AA64MMFR2_EL0_VALUE (MRS_VALUE | 0x00080740) + + /* mrs xn, id_aa64mfr2_el1 */ + if ((insn & MRS_ID_AA64MMFR2_EL0_MASK) == MRS_ID_AA64MMFR2_EL0_VALUE) { + reg = MRS_REGISTER(insn); + + frame->tf_elr += INSN_SIZE; + if (reg < nitems(frame->tf_x)) { + frame->tf_x[reg] = 0; + } else if (reg == 30) { + frame->tf_lr = 0; + } + /* If reg is 32 then write to xzr, i.e. do nothing */ + + return (1); + } + return (0); +} + +void +undef_init(void) +{ + + LIST_INIT(&undef_handlers[0]); + LIST_INIT(&undef_handlers[1]); + + install_undef_handler(false, id_aa64mmfr2_handler); +} + +void * +install_undef_handler(bool user, undef_handler_t func) +{ + struct undef_handler *uh; + + uh = malloc(sizeof(*uh), M_UNDEF, M_WAITOK); + uh->uh_handler = func; + LIST_INSERT_HEAD(&undef_handlers[user ? 0 : 1], uh, uh_link); + + return (uh); +} + +void +remove_undef_handler(void *handle) +{ + struct undef_handler *uh; + + uh = handle; + LIST_REMOVE(uh, uh_link); + free(handle, M_UNDEF); +} + +int +undef_insn(u_int el, struct trapframe *frame) +{ + struct undef_handler *uh; + uint32_t insn; + int ret; + + KASSERT(el < 2, ("Invalid exception level %u", el)); + + if (el == 0) { + ret = fueword32((uint32_t *)frame->tf_elr, &insn); + if (ret != 0) + panic("Unable to read userspace faulting instruction"); + } else { + insn = *(uint32_t *)frame->tf_elr; + } + + LIST_FOREACH(uh, &undef_handlers[el], uh_link) { + ret = uh->uh_handler(frame->tf_elr, insn, frame, frame->tf_esr); + if (ret) + return (1); + } + + return (0); +} Added: head/sys/arm64/include/undefined.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/include/undefined.h Thu Sep 14 17:29:51 2017 (r323593) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2017 Andrew Turner + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE__UNDEFINED_H_ +#define _MACHINE__UNDEFINED_H_ + +typedef int (*undef_handler_t)(vm_offset_t, uint32_t, struct trapframe *, + uint32_t); + +void undef_init(void); +void *install_undef_handler(bool, undef_handler_t); +void remove_undef_handler(void *); +int undef_insn(u_int, struct trapframe *); + +#endif Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Sep 14 16:58:26 2017 (r323592) +++ head/sys/conf/files.arm64 Thu Sep 14 17:29:51 2017 (r323593) @@ -118,6 +118,7 @@ arm64/arm64/sys_machdep.c standard arm64/arm64/trap.c standard arm64/arm64/uio_machdep.c standard arm64/arm64/uma_machdep.c standard +arm64/arm64/undefined.c standard arm64/arm64/unwind.c optional ddb | kdtrace_hooks | stack arm64/arm64/vfp.c standard arm64/arm64/vm_machdep.c standard From owner-svn-src-all@freebsd.org Thu Sep 14 18:05:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84B16E01DAF; Thu, 14 Sep 2017 18:05:55 +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 5FBB43DC5; Thu, 14 Sep 2017 18:05:55 +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 v8EI5s8V036477; Thu, 14 Sep 2017 18:05:54 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EI5s8r036476; Thu, 14 Sep 2017 18:05:54 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201709141805.v8EI5s8r036476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 14 Sep 2017 18:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323594 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 18:05:55 -0000 Author: glebius Date: Thu Sep 14 18:05:54 2017 New Revision: 323594 URL: https://svnweb.freebsd.org/changeset/base/323594 Log: Fix locking in soisconnected(). When a newborn socket moves from incomplete queue to complete one, we need to obtain the listening socket lock after the child, which is a wrong order. The old code did that in potentially endless loop of mtx_trylock(). The new one does only one attempt of mtx_trylock(), and in case of failure references listening socket, unlocks child and locks everything in right order. In case if listening socket shuts down during that, just bail out. Reported & tested by: Jason Eggleston Reported & tested by: Jason Wolfe Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Sep 14 17:29:51 2017 (r323593) +++ head/sys/kern/uipc_socket.c Thu Sep 14 18:05:54 2017 (r323594) @@ -3688,24 +3688,41 @@ soisconnecting(struct socket *so) void soisconnected(struct socket *so) { - struct socket *head; - int ret; - /* - * XXXGL: this is the only place where we acquire socket locks - * in reverse order: first child, then listening socket. To - * avoid possible LOR, use try semantics. - */ -restart: SOCK_LOCK(so); - if ((head = so->so_listen) != NULL && - __predict_false(SOLISTEN_TRYLOCK(head) == 0)) { - SOCK_UNLOCK(so); - goto restart; - } so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); so->so_state |= SS_ISCONNECTED; - if (head != NULL && (so->so_qstate == SQ_INCOMP)) { + + if (so->so_qstate == SQ_INCOMP) { + struct socket *head = so->so_listen; + int ret; + + KASSERT(head, ("%s: so %p on incomp of NULL", __func__, so)); + /* + * Promoting a socket from incomplete queue to complete, we + * need to go through reverse order of locking. We first do + * trylock, and if that doesn't succeed, we go the hard way + * leaving a reference and rechecking consistency after proper + * locking. + */ + if (__predict_false(SOLISTEN_TRYLOCK(head) == 0)) { + soref(head); + SOCK_UNLOCK(so); + SOLISTEN_LOCK(head); + SOCK_LOCK(so); + if (__predict_false(head != so->so_listen)) { + /* + * The socket went off the listen queue, + * should be lost race to close(2) of sol. + * The socket is about to soabort(). + */ + SOCK_UNLOCK(so); + sorele(head); + return; + } + /* Not the last one, as so holds a ref. */ + refcount_release(&head->so_count); + } again: if ((so->so_options & SO_ACCEPTFILTER) == 0) { TAILQ_REMOVE(&head->sol_incomp, so, so_list); @@ -3734,8 +3751,6 @@ again: } return; } - if (head != NULL) - SOLISTEN_UNLOCK(head); SOCK_UNLOCK(so); wakeup(&so->so_timeo); sorwakeup(so); From owner-svn-src-all@freebsd.org Thu Sep 14 18:07:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC1B6E01F59; Thu, 14 Sep 2017 18:07:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7B143F92; Thu, 14 Sep 2017 18:07:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EI7U9U036570; Thu, 14 Sep 2017 18:07:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EI7UPZ036569; Thu, 14 Sep 2017 18:07:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709141807.v8EI7UPZ036569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 14 Sep 2017 18:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323595 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 323595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 18:07:32 -0000 Author: gjb Date: Thu Sep 14 18:07:30 2017 New Revision: 323595 URL: https://svnweb.freebsd.org/changeset/base/323595 Log: Document r316348, pw(8) respecting pw.conf(5). Document r322793, GEOM_JOURNAL flush_queue handling fixed. Submitted by: eugen Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 18:05:54 2017 (r323594) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 18:07:30 2017 (r323595) @@ -191,6 +191,9 @@ added, providing one-time &man.boot.config.5;-style options for &man.zfsboot.8;. + The &man.pw.8; utility has been updated + to properly respect &man.pw.conf.5;, if present. + The &man.cxgbetool.8; utility has been added, providing command-line access to features and debugging facilities of &man.cxgbe.4; devices. @@ -357,6 +360,10 @@ updated to prevent keep state from incorrectly implying keep frags, matching the behavior documented in &man.ipf.5;. + + The &man.geom.4; + JOURNAL class has been updated to fix + flush_queue handling. From owner-svn-src-all@freebsd.org Thu Sep 14 18:50:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CA7AE044E8; Thu, 14 Sep 2017 18:50:42 +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 CE53D6480F; Thu, 14 Sep 2017 18:50:41 +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 v8EIoewB053908; Thu, 14 Sep 2017 18:50:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EIoewN053907; Thu, 14 Sep 2017 18:50:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709141850.v8EIoewN053907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 14 Sep 2017 18:50:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323596 - head/usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/tcpdrop X-SVN-Commit-Revision: 323596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 18:50:42 -0000 Author: tuexen Date: Thu Sep 14 18:50:40 2017 New Revision: 323596 URL: https://svnweb.freebsd.org/changeset/base/323596 Log: Add a description how tcpdrop handles the case of specifying the -s and the -S option. Sponsored by: Netflix, Inc. Modified: head/usr.sbin/tcpdrop/tcpdrop.8 Modified: head/usr.sbin/tcpdrop/tcpdrop.8 ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 18:07:30 2017 (r323595) +++ head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 18:50:40 2017 (r323596) @@ -78,6 +78,26 @@ is one of .Dv FIN_WAIT_2 , or .Dv TIME_WAIT . .Pp +If +.Fl S Ar stack +and +.Fl s Ar state +are specified, +.Nm +will attempt to drop all TCP connections being in the state +.Ar state +and using the TCP stack +.Ar stack . +Since TCP connections in the +.Dv TIME_WAIT +state are not tied to any TCP stack, using the option +.Fl s Dv TIME_WAIT +in combination with the +.Fl S Ar stack +option results in +.Nm +not dropping any TCP connection. +.Pp The .Fl l flag may be given in addition to the From owner-svn-src-all@freebsd.org Thu Sep 14 19:18:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C36E4E05C31; Thu, 14 Sep 2017 19:18:25 +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 92C8B654DF; Thu, 14 Sep 2017 19:18:25 +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 v8EJIONG065196; Thu, 14 Sep 2017 19:18:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EJIOLu065194; Thu, 14 Sep 2017 19:18:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709141918.v8EJIOLu065194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 14 Sep 2017 19:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323597 - head/lib/libc/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/net X-SVN-Commit-Revision: 323597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 19:18:25 -0000 Author: kib Date: Thu Sep 14 19:18:24 2017 New Revision: 323597 URL: https://svnweb.freebsd.org/changeset/base/323597 Log: Silently handle freeaddrinfo(NULL) for compatibility with code which works on other OSes. Also avoid unnecessary NULL check, free(NULL) is valid. Reviewed by: bjk (man page), hrs, hselasky, ume Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D12354 Modified: head/lib/libc/net/getaddrinfo.3 head/lib/libc/net/getaddrinfo.c Modified: head/lib/libc/net/getaddrinfo.3 ============================================================================== --- head/lib/libc/net/getaddrinfo.3 Thu Sep 14 18:50:40 2017 (r323596) +++ head/lib/libc/net/getaddrinfo.3 Thu Sep 14 19:18:24 2017 (r323597) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2015 +.Dd September 13, 2017 .Dt GETADDRINFO 3 .Os .Sh NAME @@ -351,6 +351,17 @@ pointer should be a .Li addrinfo structure created by a call to .Fn getaddrinfo . +.Sh IMPLEMENTATION NOTES +The behavior of +.Li freeadrinfo(NULL) +is left unspecified by both +.St -susv4 +and +.Dv "RFC 3493" . +The current implementation ignores a +.Dv NULL +argument for compatibility with programs that rely on the implementation +details of other operating systems. .Sh RETURN VALUES .Fn getaddrinfo returns zero on success or one of the error codes listed in Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Thu Sep 14 18:50:40 2017 (r323596) +++ head/lib/libc/net/getaddrinfo.c Thu Sep 14 19:18:24 2017 (r323597) @@ -35,7 +35,7 @@ * in the source code. This is because RFC2553 is silent about which error * code must be returned for which situation. * - freeaddrinfo(NULL). RFC2553 is silent about it. XNET 5.2 says it is - * invalid. current code - SEGV on freeaddrinfo(NULL) + * invalid. Current code accepts NULL to be compatible with other OSes. * * Note: * - The code filters out AFs that are not supported by the kernel, @@ -359,14 +359,13 @@ freeaddrinfo(struct addrinfo *ai) { struct addrinfo *next; - do { + while (ai != NULL) { next = ai->ai_next; - if (ai->ai_canonname) - free(ai->ai_canonname); + free(ai->ai_canonname); /* no need to free(ai->ai_addr) */ free(ai); ai = next; - } while (ai); + } } static int From owner-svn-src-all@freebsd.org Thu Sep 14 19:50:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9845E07897; Thu, 14 Sep 2017 19:50:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97757667A9; Thu, 14 Sep 2017 19:50:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EJo7xc077812; Thu, 14 Sep 2017 19:50:07 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EJo745077811; Thu, 14 Sep 2017 19:50:07 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201709141950.v8EJo745077811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 14 Sep 2017 19:50:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323598 - head/lib/libedit X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libedit X-SVN-Commit-Revision: 323598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 19:50:08 -0000 Author: pfg Date: Thu Sep 14 19:50:07 2017 New Revision: 323598 URL: https://svnweb.freebsd.org/changeset/base/323598 Log: libedit: raise the warning level to 3. NetBSD has the warning level to 5 but that actually triggers -Wcast-qual. Modified: head/lib/libedit/Makefile Modified: head/lib/libedit/Makefile ============================================================================== --- head/lib/libedit/Makefile Thu Sep 14 19:18:24 2017 (r323597) +++ head/lib/libedit/Makefile Thu Sep 14 19:50:07 2017 (r323598) @@ -7,6 +7,8 @@ LIB= edit SHLIB_MAJOR= 7 SHLIBDIR?= /lib +WARNS?= 3 + OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \ hist.c keymacro.c map.c chartype.c \ parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c @@ -40,8 +42,6 @@ CLEANFILES+= tokenizern.c historyn.c CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR #CFLAGS+= -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH #CFLAGS+= -DDEBUG_PASTE -DDEBUG_EDIT - -WARNS?= 1 SUBDIR= edit/readline From owner-svn-src-all@freebsd.org Thu Sep 14 19:51:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53F14E07AD1; Thu, 14 Sep 2017 19:51:21 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.imp.ch (smtp.imp.ch [IPv6:2001:4060:1:1001::13:197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BC6966A89; Thu, 14 Sep 2017 19:51:21 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from [10.6.32.30] (unknown [185.12.128.224]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPSA id 92CB5C0B97; Thu, 14 Sep 2017 21:51:17 +0200 (CEST) Subject: Re: svn commit: r323290 - head/sys/vm To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709072143.v87Lhdsg060310@repo.freebsd.org> From: Andreas Tobler Message-ID: Date: Thu, 14 Sep 2017 21:51:17 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <201709072143.v87Lhdsg060310@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 7bit X-Scanned-By: Asterix Submit on 127.0.1.1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 19:51:21 -0000 Hi Mark, On 07.09.17 23:43, Mark Johnston wrote: > Author: markj > Date: Thu Sep 7 21:43:39 2017 > New Revision: 323290 > URL: https://svnweb.freebsd.org/changeset/base/323290 > > Log: > Speed up vm_page_array initialization. > > We currently initialize the vm_page array in three passes: one to zero > the array, one to initialize the "order" field of each page (necessary > when inserting them into the vm_phys buddy allocator one-by-one), and > one to initialize the remaining non-zero fields and individually insert > each page into the allocator. > > Merge the three passes into one following a suggestion from alc: > initialize vm_page fields in a single pass, and use vm_phys_free_contig() > to efficiently insert physical memory segments into the buddy allocator. > This reduces the initialization time to a third or a quarter of what it > was before on most systems that I tested. > > Reviewed by: alc, kib > MFC after: 3 weeks > Differential Revision: https://reviews.freebsd.org/D12248 > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_phys.c > head/sys/vm/vm_phys.h I just found out that this commit breaks booting my powerpc64 Quad G5. It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue]. Sometimes it hangs earlier when the kbd is not there yet (usb), then I can't get the process/task where it hangs. Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD) Any ideas how to find out what's wrong? The previous revision, r323289 seems stable, at least it survived several kernel builds. TIA, Andreas From owner-svn-src-all@freebsd.org Thu Sep 14 20:02:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB57AE083AB; Thu, 14 Sep 2017 20:02:20 +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 B86CA67018; Thu, 14 Sep 2017 20:02:20 +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 v8EK2IVH022277 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 14 Sep 2017 13:02:18 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v8EK2IXj022276; Thu, 14 Sep 2017 13:02:18 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 14 Sep 2017 13:02:18 -0700 From: Gleb Smirnoff To: Steven Hartland Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323566 - head/sys/kern Message-ID: <20170914200218.GU1055@FreeBSD.org> References: <201709132211.v8DMB6Pp048326@repo.freebsd.org> <4ae03e74-4fc3-d23b-4f14-3329b20b8df0@multiplay.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ae03e74-4fc3-d23b-4f14-3329b20b8df0@multiplay.co.uk> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 20:02:21 -0000 Steven, I don't want to MFC that, since that will hurt performance on stable/11 due to ACCEPT_LOCK(). On Thu, Sep 14, 2017 at 08:31:57AM +0100, Steven Hartland wrote: S> Is this something that will be MFC'ed to 11 or is this 12 / CURRENT only? S> S> On 13/09/2017 23:11, Gleb Smirnoff wrote: S> > Author: glebius S> > Date: Wed Sep 13 22:11:05 2017 S> > New Revision: 323566 S> > URL: https://svnweb.freebsd.org/changeset/base/323566 S> > S> > Log: S> > Use soref() in sendfile(2) instead fhold() to reference a socket. S> > S> > The problem is that fdrop() requires syscall context, as it may S> > enter sleep in some cases. The reason to use it in the original S> > non-blocking sendfile implementation, was to avoid use of global S> > ACCEPT_LOCK() on every I/O completion. Now in head sorele() no S> > longer requires this lock. S> > S> > Modified: S> > head/sys/kern/kern_sendfile.c S> > S> > Modified: head/sys/kern/kern_sendfile.c S> > ============================================================================== S> > --- head/sys/kern/kern_sendfile.c Wed Sep 13 21:56:49 2017 (r323565) S> > +++ head/sys/kern/kern_sendfile.c Wed Sep 13 22:11:05 2017 (r323566) S> > @@ -80,7 +80,7 @@ struct sf_io { S> > volatile u_int nios; S> > u_int error; S> > int npages; S> > - struct file *sock_fp; S> > + struct socket *so; S> > struct mbuf *m; S> > vm_page_t pa[]; S> > }; S> > @@ -255,7 +255,7 @@ static void S> > sendfile_iodone(void *arg, vm_page_t *pg, int count, int error) S> > { S> > struct sf_io *sfio = arg; S> > - struct socket *so; S> > + struct socket *so = sfio->so; S> > S> > for (int i = 0; i < count; i++) S> > if (pg[i] != bogus_page) S> > @@ -267,8 +267,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i S> > if (!refcount_release(&sfio->nios)) S> > return; S> > S> > - so = sfio->sock_fp->f_data; S> > - S> > if (sfio->error) { S> > struct mbuf *m; S> > S> > @@ -296,8 +294,8 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i S> > CURVNET_RESTORE(); S> > } S> > S> > - /* XXXGL: curthread */ S> > - fdrop(sfio->sock_fp, curthread); S> > + SOCK_LOCK(so); S> > + sorele(so); S> > free(sfio, M_TEMP); S> > } S> > S> > @@ -724,6 +722,7 @@ retry_space: S> > sfio = malloc(sizeof(struct sf_io) + S> > npages * sizeof(vm_page_t), M_TEMP, M_WAITOK); S> > refcount_init(&sfio->nios, 1); S> > + sfio->so = so; S> > sfio->error = 0; S> > S> > nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages, S> > @@ -858,9 +857,8 @@ prepend_header: S> > error = (*so->so_proto->pr_usrreqs->pru_send) S> > (so, 0, m, NULL, NULL, td); S> > } else { S> > - sfio->sock_fp = sock_fp; S> > sfio->npages = npages; S> > - fhold(sock_fp); S> > + soref(so); S> > error = (*so->so_proto->pr_usrreqs->pru_send) S> > (so, PRUS_NOTREADY, m, NULL, NULL, td); S> > sendfile_iodone(sfio, NULL, 0, 0); S> > S> -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Sep 14 20:32:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDF1AE0A461; Thu, 14 Sep 2017 20:32:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 847A6684D9; Thu, 14 Sep 2017 20:32:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt0-x242.google.com with SMTP id l25so326346qtf.2; Thu, 14 Sep 2017 13:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gQTMp9EJEWG4BITNlQGbis0fBUxcxiUv1Uz/oy4/kHA=; b=o2iSXtZgp1c4H+aKf44ODiWf938AJd2aGZmj/jVIiRwEuC6x71EKsA4NFcqb/GfnCx ZXE+vgGhAjvwc8tbhyLL4+F5FJK1Al2xqNzABEzuQjka802Vh61sdW9hP1JRJcdE3Tdy 7D2gM/RqY8HUBmBzU3uK144Yk0ywyloKo76FaP1Dyhv0LQf2GvccO/pYgvv2gQCCySkC A5yRoWuwtfbVKh/7g8vCwAifgwMyO+9hLo4n8x3rdaObVgZ0zGHO3JfeQ27T/m0aS6Vh Ph/cZVeQAYXB/E2CRQE2JJgZtNkK73oNvHG1vvYhjwQlD86G5Y/sKw3PGXlSqtZet5az JZjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=gQTMp9EJEWG4BITNlQGbis0fBUxcxiUv1Uz/oy4/kHA=; b=S9jktkv6zEMw0d1isfiVtv5drjZ93dnbMDA+6rgWH57DpATBaCSPzEQNEgZ6gQIv6t +YOKW8XIdc4UJI3VXMfyfDCtXigzys56NM2fCUtOXu9X4zmy47pZF8JFYBmO9Hj5KpTC B1lPi/NKs27v9BvE9WKs4kVy9TvDeCscgPma9hOQI6D1L/rzFopcx65xfQL6nWe+bkgV iTYUcpYIm9n2DraiCmuMTKG9iAIUHahcQ4Pv+WnPADbdBztJ7zu7/rS62f1hBNO4RKCi x9h5ZbhwssauuJlI12OUg3bOIbkgTM1Cw7XH3XOPFVqiMoNWnybkQqq6AZK73Su8dcec Pzbw== X-Gm-Message-State: AHPjjUie6Xh/aItOGZv7OkmAaeLQTw3YASbbTzUQQjylLPKKjxGgUIOE qeHRbiWBFYKfv7J2 X-Google-Smtp-Source: AOwi7QCQkHgwfLGwG+8wDPnpdVOhMbpWbuMX5F+XGgpnkQ5qh2H5Am//7tJiQSWIfrRHvmEc9hFLMQ== X-Received: by 10.237.52.69 with SMTP id w63mr17515037qtd.78.1505421160226; Thu, 14 Sep 2017 13:32:40 -0700 (PDT) Received: from bish (toroon0560w-lp140-01-69-159-37-127.dsl.bell.ca. [69.159.37.127]) by smtp.gmail.com with ESMTPSA id j206sm11520819qke.7.2017.09.14.13.32.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2017 13:32:38 -0700 (PDT) Sender: Mark Johnston Date: Thu, 14 Sep 2017 16:32:32 -0400 From: Mark Johnston To: Andreas Tobler Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323290 - head/sys/vm Message-ID: <20170914203232.GA72190@bish> References: <201709072143.v87Lhdsg060310@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 20:32:42 -0000 On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote: > Hi Mark, > > On 07.09.17 23:43, Mark Johnston wrote: > > Author: markj > > Date: Thu Sep 7 21:43:39 2017 > > New Revision: 323290 > > URL: https://svnweb.freebsd.org/changeset/base/323290 > > > > Log: > > Speed up vm_page_array initialization. > > > > We currently initialize the vm_page array in three passes: one to zero > > the array, one to initialize the "order" field of each page (necessary > > when inserting them into the vm_phys buddy allocator one-by-one), and > > one to initialize the remaining non-zero fields and individually insert > > each page into the allocator. > > > > Merge the three passes into one following a suggestion from alc: > > initialize vm_page fields in a single pass, and use vm_phys_free_contig() > > to efficiently insert physical memory segments into the buddy allocator. > > This reduces the initialization time to a third or a quarter of what it > > was before on most systems that I tested. > > > > Reviewed by: alc, kib > > MFC after: 3 weeks > > Differential Revision: https://reviews.freebsd.org/D12248 > > > > Modified: > > head/sys/vm/vm_page.c > > head/sys/vm/vm_phys.c > > head/sys/vm/vm_phys.h > > I just found out that this commit breaks booting my powerpc64 Quad G5. > It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue]. > > Sometimes it hangs earlier when the kbd is not there yet (usb), then I > can't get the process/task where it hangs. > > Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD) > > Any ideas how to find out what's wrong? Are you able to break into DDB when the hang occurs? If so, the output of "show page" would be helpful. Are you running with INVARIANTS configured? If not, please try that. > The previous revision, r323289 seems stable, at least it survived > several kernel builds. Could you apply the patch below and capture the first page or so of output from after the kernel starts booting? diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index fda8d1cf37f7..6862195c3e9c 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -648,8 +648,11 @@ vm_page_startup(vm_offset_t vaddr) * Add physical memory segments corresponding to the available * physical pages. */ - for (i = 0; phys_avail[i + 1] != 0; i += 2) + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + printf("adding phys_avail seg %#jx - %#jx\n", + phys_avail[i], phys_avail[i + 1]); vm_phys_add_seg(phys_avail[i], phys_avail[i + 1]); + } /* * Initialize the physical memory allocator. @@ -664,6 +667,8 @@ vm_page_startup(vm_offset_t vaddr) vm_cnt.v_free_count = 0; for (segind = 0; segind < vm_phys_nsegs; segind++) { seg = &vm_phys_segs[segind]; + printf("inserting seg %d: %#jx - %#jx\n", segind, + (uintmax_t)seg->start, (uintmax_t)seg->end); for (pa = seg->start; pa < seg->end; pa += PAGE_SIZE) vm_phys_init_page(pa); @@ -679,6 +684,7 @@ vm_page_startup(vm_offset_t vaddr) seg->end > phys_avail[i + 1]) continue; + printf("inserting seg %d into vm_phys\n", segind); m = seg->first_page; pagecount = (u_long)atop(seg->end - seg->start); @@ -694,6 +700,7 @@ vm_page_startup(vm_offset_t vaddr) break; } } + printf("v_free_count: %u\n", vm_cnt.v_free_count); /* * Remove blacklisted pages from the physical memory allocator. From owner-svn-src-all@freebsd.org Thu Sep 14 20:42:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93772E0ADE4; Thu, 14 Sep 2017 20:42:20 +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 6037968A3E; Thu, 14 Sep 2017 20:42:20 +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 v8EKgJfx001915; Thu, 14 Sep 2017 20:42:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EKgJ8Q001914; Thu, 14 Sep 2017 20:42:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709142042.v8EKgJ8Q001914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 14 Sep 2017 20:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323599 - head/usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/tcpdrop X-SVN-Commit-Revision: 323599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 20:42:20 -0000 Author: tuexen Date: Thu Sep 14 20:42:19 2017 New Revision: 323599 URL: https://svnweb.freebsd.org/changeset/base/323599 Log: Bump date missed in r323596. Trim trailing whitespace. Sponsored by: Netflix, Inc. Modified: head/usr.sbin/tcpdrop/tcpdrop.8 Modified: head/usr.sbin/tcpdrop/tcpdrop.8 ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 19:50:07 2017 (r323598) +++ head/usr.sbin/tcpdrop/tcpdrop.8 Thu Sep 14 20:42:19 2017 (r323599) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 12, 2017 +.Dd September 14, 2017 .Dt TCPDROP 8 .Os .Sh NAME @@ -88,7 +88,7 @@ will attempt to drop all TCP connections being in the .Ar state and using the TCP stack .Ar stack . -Since TCP connections in the +Since TCP connections in the .Dv TIME_WAIT state are not tied to any TCP stack, using the option .Fl s Dv TIME_WAIT From owner-svn-src-all@freebsd.org Thu Sep 14 21:06:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEA20E0C1A5; Thu, 14 Sep 2017 21:06:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBDA869A6E; Thu, 14 Sep 2017 21:06:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EL68Rp011817; Thu, 14 Sep 2017 21:06:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EL68He011816; Thu, 14 Sep 2017 21:06:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709142106.v8EL68He011816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Sep 2017 21:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323600 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 323600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 21:06:10 -0000 Author: jhb Date: Thu Sep 14 21:06:08 2017 New Revision: 323600 URL: https://svnweb.freebsd.org/changeset/base/323600 Log: Fix some incorrect sysctl pointers for some error stats. The bad_session, sglist_error, and process_error sysctl nodes were returning the value of the pad_error node instead of the appropriate error counters. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Thu Sep 14 20:42:19 2017 (r323599) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Thu Sep 14 21:06:08 2017 (r323600) @@ -1483,11 +1483,12 @@ ccr_sysctls(struct ccr_softc *sc) SYSCTL_ADD_U64(ctx, children, OID_AUTO, "pad_error", CTLFLAG_RD, &sc->stats_pad_error, 0, "Padding errors"); SYSCTL_ADD_U64(ctx, children, OID_AUTO, "bad_session", CTLFLAG_RD, - &sc->stats_pad_error, 0, "Requests with invalid session ID"); + &sc->stats_bad_session, 0, "Requests with invalid session ID"); SYSCTL_ADD_U64(ctx, children, OID_AUTO, "sglist_error", CTLFLAG_RD, - &sc->stats_pad_error, 0, "Requests for which DMA mapping failed"); + &sc->stats_sglist_error, 0, + "Requests for which DMA mapping failed"); SYSCTL_ADD_U64(ctx, children, OID_AUTO, "process_error", CTLFLAG_RD, - &sc->stats_pad_error, 0, "Requests failed during queueing"); + &sc->stats_process_error, 0, "Requests failed during queueing"); } static int From owner-svn-src-all@freebsd.org Thu Sep 14 22:19:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB221E0FD10; Thu, 14 Sep 2017 22:19:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 975AF6BEB4; Thu, 14 Sep 2017 22:19:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8EMJuXk040486; Thu, 14 Sep 2017 22:19:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8EMJu02040485; Thu, 14 Sep 2017 22:19:56 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709142219.v8EMJu02040485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 14 Sep 2017 22:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323601 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 323601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 22:19:57 -0000 Author: gjb Date: Thu Sep 14 22:19:56 2017 New Revision: 323601 URL: https://svnweb.freebsd.org/changeset/base/323601 Log: Document r301772, Dummynet AQM imported to the base system. Submitted by: truckman Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 21:06:08 2017 (r323600) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Sep 14 22:19:56 2017 (r323601) @@ -571,6 +571,10 @@ Network Protocols + Dummynet AQM, an independent + implementation of CoDel and FQ-CoDel for ipfw/dummynet has + been imported to the base system. + Support for GARP (gratuitous ARP) retransmit has been added. From owner-svn-src-all@freebsd.org Fri Sep 15 00:08:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D084E16171; Fri, 15 Sep 2017 00:08:37 +0000 (UTC) (envelope-from leres@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AAFA6F87C; Fri, 15 Sep 2017 00:08:37 +0000 (UTC) (envelope-from leres@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8F08aQZ086223; Fri, 15 Sep 2017 00:08:36 GMT (envelope-from leres@FreeBSD.org) Received: (from leres@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F08a9B086222; Fri, 15 Sep 2017 00:08:36 GMT (envelope-from leres@FreeBSD.org) Message-Id: <201709150008.v8F08a9B086222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: leres set sender to leres@FreeBSD.org using -f From: Craig Leres Date: Fri, 15 Sep 2017 00:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323602 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: leres X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 323602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 00:08:37 -0000 Author: leres (ports committer) Date: Fri Sep 15 00:08:36 2017 New Revision: 323602 URL: https://svnweb.freebsd.org/changeset/base/323602 Log: Add myself (leres) as a ports committer with ler and matthew as mentors. Reviewed by: matthew (mentor) Approved by: matthew (mentor) Differential Revision: https://reviews.freebsd.org/D12372 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Thu Sep 14 22:19:56 2017 (r323601) +++ head/share/misc/committers-ports.dot Fri Sep 15 00:08:36 2017 (r323602) @@ -149,6 +149,7 @@ lawrance [label="Sam Lawrance\nlawrance@FreeBSD.org\n2 lbr [label="Lars Balker Rasmussen\nlbr@FreeBSD.org\n2006/04/30"] leeym [label="Yen-Ming Lee\nleeym@FreeBSD.org\n2002/08/14"] ler [label="Larry Rosenman\nler@FreeBSD.org\n2017/01/09"] +leres [label="Craig Leres\nleres@FreeBSD.org\n2017/10/10"] lev [label="Lev Serebryakov\nlev@FreeBSD.org\n2003/06/17"] lifanov [label="Nikolai Lifanov\nlifanov@FreeBSD.org\n2016/12/11"] linimon [label="Mark Linimon\nlinimon@FreeBSD.org\n2003/10/23"] @@ -468,6 +469,8 @@ lawrance -> itetcu leeym -> clsung +ler -> leres + lifanov -> ultima lioux -> pat @@ -502,6 +505,7 @@ mat -> thierry mat -> tobik mat -> woodsb02 +matthew -> leres matthew -> lifanov matthew -> ultima From owner-svn-src-all@freebsd.org Fri Sep 15 00:31:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6E13E17530; Fri, 15 Sep 2017 00:31:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A462770426; Fri, 15 Sep 2017 00:31:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8F0V4vc097685; Fri, 15 Sep 2017 00:31:04 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F0V416097684; Fri, 15 Sep 2017 00:31:04 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709150031.v8F0V416097684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 15 Sep 2017 00:31:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r323603 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: marius X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 323603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 00:31:06 -0000 Author: marius Date: Fri Sep 15 00:31:04 2017 New Revision: 323603 URL: https://svnweb.freebsd.org/changeset/base/323603 Log: Require explicit re@ approval for commits to releng/10.4. Approved by: re (implicit) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Fri Sep 15 00:08:36 2017 (r323602) +++ svnadmin/conf/approvers Fri Sep 15 00:31:04 2017 (r323603) @@ -21,6 +21,7 @@ ^stable/10/ re ^release/ re ^releng/11.[0-1]/ (security-officer|so) +^releng/10.4/ re ^releng/10.[0-3]/ (security-officer|so) ^releng/9.[0-3]/ (security-officer|so) ^releng/8.[0-4]/ (security-officer|so) From owner-svn-src-all@freebsd.org Fri Sep 15 00:31:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 589E4E176EB; Fri, 15 Sep 2017 00:31:27 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25A417068F; Fri, 15 Sep 2017 00:31:27 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8F0VQns098586; Fri, 15 Sep 2017 00:31:26 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F0VQI4098583; Fri, 15 Sep 2017 00:31:26 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709150031.v8F0VQI4098583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 15 Sep 2017 00:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r323604 - in releng/10.4: release/pkg_repos sys/conf sys/sys X-SVN-Group: releng X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in releng/10.4: release/pkg_repos sys/conf sys/sys X-SVN-Commit-Revision: 323604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 00:31:27 -0000 Author: marius Date: Fri Sep 15 00:31:25 2017 New Revision: 323604 URL: https://svnweb.freebsd.org/changeset/base/323604 Log: - Copy stable/10@323601 to releng/10.4 in preparation for 10.4-RC1 builds. - Update newvers.sh to reflect RC1. - Update __FreeBSD_version to reflect 10.4. - Switch the pkg(8) repository to use the 10.4 release package set for DVD image creation. Approved by: re (implicit) Added: - copied from r323601, stable/10/ Directory Properties: releng/10.4/ (props changed) Modified: releng/10.4/release/pkg_repos/release-dvd.conf releng/10.4/sys/conf/newvers.sh releng/10.4/sys/sys/param.h Modified: releng/10.4/release/pkg_repos/release-dvd.conf ============================================================================== --- stable/10/release/pkg_repos/release-dvd.conf Thu Sep 14 22:19:56 2017 (r323601) +++ releng/10.4/release/pkg_repos/release-dvd.conf Fri Sep 15 00:31:25 2017 (r323604) @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_4", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: releng/10.4/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Thu Sep 14 22:19:56 2017 (r323601) +++ releng/10.4/sys/conf/newvers.sh Fri Sep 15 00:31:25 2017 (r323604) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.4" -BRANCH="BETA4" +BRANCH="RC1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.4/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Thu Sep 14 22:19:56 2017 (r323601) +++ releng/10.4/sys/sys/param.h Fri Sep 15 00:31:25 2017 (r323604) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003516 /* Master, propagated to newvers */ +#define __FreeBSD_version 1004000 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Fri Sep 15 00:32:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D126E1784B; Fri, 15 Sep 2017 00:32:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4936F70877; Fri, 15 Sep 2017 00:32:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8F0WN9G098673; Fri, 15 Sep 2017 00:32:23 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F0WN1N098668; Fri, 15 Sep 2017 00:32:23 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709150032.v8F0WN1N098668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 15 Sep 2017 00:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323605 - in stable/10: etc/pkg release/pkg_repos sys/conf sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: etc/pkg release/pkg_repos sys/conf sys/sys X-SVN-Commit-Revision: 323605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 00:32:24 -0000 Author: marius Date: Fri Sep 15 00:32:22 2017 New Revision: 323605 URL: https://svnweb.freebsd.org/changeset/base/323605 Log: - Reset stable/10 back to -PRERELEASE status now that releng/10.4 has been branched. - Update __FreeBSD_version to reflect the new -STABLE branch. - Switch the pkg(8) configuration for the default installation and the DVD image creation back to the latest set, i. e. revert r322737. Approved by: re (implicit) Modified: stable/10/etc/pkg/FreeBSD.conf stable/10/release/pkg_repos/release-dvd.conf stable/10/sys/conf/newvers.sh stable/10/sys/sys/param.h Modified: stable/10/etc/pkg/FreeBSD.conf ============================================================================== --- stable/10/etc/pkg/FreeBSD.conf Fri Sep 15 00:31:25 2017 (r323604) +++ stable/10/etc/pkg/FreeBSD.conf Fri Sep 15 00:32:22 2017 (r323605) @@ -8,7 +8,7 @@ # FreeBSD: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: stable/10/release/pkg_repos/release-dvd.conf ============================================================================== --- stable/10/release/pkg_repos/release-dvd.conf Fri Sep 15 00:31:25 2017 (r323604) +++ stable/10/release/pkg_repos/release-dvd.conf Fri Sep 15 00:32:22 2017 (r323605) @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Fri Sep 15 00:31:25 2017 (r323604) +++ stable/10/sys/conf/newvers.sh Fri Sep 15 00:32:22 2017 (r323605) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.4" -BRANCH="BETA4" +BRANCH="PRERELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Fri Sep 15 00:31:25 2017 (r323604) +++ stable/10/sys/sys/param.h Fri Sep 15 00:32:22 2017 (r323605) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003516 /* Master, propagated to newvers */ +#define __FreeBSD_version 1004500 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Fri Sep 15 00:35:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02196E17AC8; Fri, 15 Sep 2017 00:35:01 +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 C4C1070A1E; Fri, 15 Sep 2017 00:35:00 +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 v8F0Yxrn098812; Fri, 15 Sep 2017 00:34:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F0Yx1S098811; Fri, 15 Sep 2017 00:34:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709150034.v8F0Yx1S098811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 15 Sep 2017 00:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323606 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 323606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 00:35:01 -0000 Author: markj Date: Fri Sep 15 00:34:59 2017 New Revision: 323606 URL: https://svnweb.freebsd.org/changeset/base/323606 Log: MFC r323498: Add a O_CLOEXEC use missed in r323166. Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Sep 15 00:32:22 2017 (r323605) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Sep 15 00:34:59 2017 (r323606) @@ -1111,7 +1111,7 @@ dt_vopen(int version, int flags, int *errp, */ if (err == ENOENT && modfind("dtraceall") < 0) { kldload("dtraceall"); /* ignore the error */ - dtfd = open("/dev/dtrace/dtrace", O_RDWR); + dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC); err = errno; } #endif From owner-svn-src-all@freebsd.org Fri Sep 15 00:54:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AD3BE18BBE; Fri, 15 Sep 2017 00:54:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CD2C712A6; Fri, 15 Sep 2017 00:54:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8F0sbfg007078; Fri, 15 Sep 2017 00:54:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F0sb3K007077; Fri, 15 Sep 2017 00:54:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709150054.v8F0sb3K007077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 15 Sep 2017 00:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323607 - head/tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/build/mk X-SVN-Commit-Revision: 323607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 00:54:39 -0000 Author: emaste Date: Fri Sep 15 00:54:37 2017 New Revision: 323607 URL: https://svnweb.freebsd.org/changeset/base/323607 Log: Update OptionalObsoleteFiles.inc with NTP docs The list of files for MK_NTP was incomplete. PR: 218193 Submitted by: brnrd MFC after: 1 week Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Sep 15 00:34:59 2017 (r323606) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Sep 15 00:54:37 2017 (r323607) @@ -6397,16 +6397,26 @@ OLD_FILES+=usr/sbin/ntpdate OLD_FILES+=usr/sbin/ntpdc OLD_FILES+=usr/sbin/ntptime OLD_FILES+=usr/sbin/sntp +OLD_FILES+=usr/share/doc/ntp/access.html OLD_FILES+=usr/share/doc/ntp/accopt.html OLD_FILES+=usr/share/doc/ntp/assoc.html OLD_FILES+=usr/share/doc/ntp/audio.html +OLD_FILES+=usr/share/doc/ntp/authentic.html OLD_FILES+=usr/share/doc/ntp/authopt.html +OLD_FILES+=usr/share/doc/ntp/autokey.html +OLD_FILES+=usr/share/doc/ntp/bugs.html OLD_FILES+=usr/share/doc/ntp/build.html +OLD_FILES+=usr/share/doc/ntp/clock.html OLD_FILES+=usr/share/doc/ntp/clockopt.html +OLD_FILES+=usr/share/doc/ntp/cluster.html +OLD_FILES+=usr/share/doc/ntp/comdex.html OLD_FILES+=usr/share/doc/ntp/config.html OLD_FILES+=usr/share/doc/ntp/confopt.html OLD_FILES+=usr/share/doc/ntp/copyright.html OLD_FILES+=usr/share/doc/ntp/debug.html +OLD_FILES+=usr/share/doc/ntp/decode.html +OLD_FILES+=usr/share/doc/ntp/discipline.html +OLD_FILES+=usr/share/doc/ntp/discover.html OLD_FILES+=usr/share/doc/ntp/driver1.html OLD_FILES+=usr/share/doc/ntp/driver10.html OLD_FILES+=usr/share/doc/ntp/driver11.html @@ -6435,34 +6445,227 @@ OLD_FILES+=usr/share/doc/ntp/driver6.html OLD_FILES+=usr/share/doc/ntp/driver7.html OLD_FILES+=usr/share/doc/ntp/driver8.html OLD_FILES+=usr/share/doc/ntp/driver9.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver1.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver10.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver11.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver12.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver16.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver18.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver19.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver20.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver22.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver26.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver27.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver28.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver29.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver3.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver30.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver31.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver32.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver33.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver34.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver35.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver36.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver37.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver38.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver39.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver4.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver40.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver42.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver43.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver44.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver45.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver46.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver5.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver6.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver7.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver8.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver9.html +OLD_FILES+=usr/share/doc/ntp/drivers/icons/home.gif +OLD_FILES+=usr/share/doc/ntp/drivers/icons/mail2.gif +OLD_FILES+=usr/share/doc/ntp/drivers/mx4200data.html +OLD_FILES+=usr/share/doc/ntp/drivers/oncore-shmem.html +OLD_FILES+=usr/share/doc/ntp/drivers/scripts/footer.txt +OLD_FILES+=usr/share/doc/ntp/drivers/scripts/style.css +OLD_FILES+=usr/share/doc/ntp/drivers/tf582_4.html OLD_FILES+=usr/share/doc/ntp/extern.html +OLD_FILES+=usr/share/doc/ntp/filter.html OLD_FILES+=usr/share/doc/ntp/hints.html +OLD_FILES+=usr/share/doc/ntp/hints/a-ux +OLD_FILES+=usr/share/doc/ntp/hints/aix +OLD_FILES+=usr/share/doc/ntp/hints/bsdi +OLD_FILES+=usr/share/doc/ntp/hints/changes +OLD_FILES+=usr/share/doc/ntp/hints/decosf1 +OLD_FILES+=usr/share/doc/ntp/hints/decosf2 +OLD_FILES+=usr/share/doc/ntp/hints/freebsd +OLD_FILES+=usr/share/doc/ntp/hints/hpux +OLD_FILES+=usr/share/doc/ntp/hints/linux +OLD_FILES+=usr/share/doc/ntp/hints/mpeix +OLD_FILES+=usr/share/doc/ntp/hints/notes-xntp-v3 +OLD_FILES+=usr/share/doc/ntp/hints/parse +OLD_FILES+=usr/share/doc/ntp/hints/refclocks +OLD_FILES+=usr/share/doc/ntp/hints/rs6000 +OLD_FILES+=usr/share/doc/ntp/hints/sco.html +OLD_FILES+=usr/share/doc/ntp/hints/sgi +OLD_FILES+=usr/share/doc/ntp/hints/solaris-dosynctodr.html +OLD_FILES+=usr/share/doc/ntp/hints/solaris.html +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.4023118 +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.4095849 +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.S99ntpd +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.patchfreq +OLD_FILES+=usr/share/doc/ntp/hints/sun4 +OLD_FILES+=usr/share/doc/ntp/hints/svr4-dell +OLD_FILES+=usr/share/doc/ntp/hints/svr4_package +OLD_FILES+=usr/share/doc/ntp/hints/todo +OLD_FILES+=usr/share/doc/ntp/hints/vxworks.html +OLD_FILES+=usr/share/doc/ntp/hints/winnt.html +OLD_FILES+=usr/share/doc/ntp/history.html OLD_FILES+=usr/share/doc/ntp/howto.html +OLD_FILES+=usr/share/doc/ntp/huffpuff.html +OLD_FILES+=usr/share/doc/ntp/icons/home.gif +OLD_FILES+=usr/share/doc/ntp/icons/mail2.gif +OLD_FILES+=usr/share/doc/ntp/icons/sitemap.png OLD_FILES+=usr/share/doc/ntp/index.html OLD_FILES+=usr/share/doc/ntp/kern.html +OLD_FILES+=usr/share/doc/ntp/kernpps.html +OLD_FILES+=usr/share/doc/ntp/keygen.html OLD_FILES+=usr/share/doc/ntp/ldisc.html +OLD_FILES+=usr/share/doc/ntp/leap.html OLD_FILES+=usr/share/doc/ntp/measure.html OLD_FILES+=usr/share/doc/ntp/miscopt.html OLD_FILES+=usr/share/doc/ntp/monopt.html +OLD_FILES+=usr/share/doc/ntp/msyslog.html OLD_FILES+=usr/share/doc/ntp/mx4200data.html OLD_FILES+=usr/share/doc/ntp/notes.html +OLD_FILES+=usr/share/doc/ntp/ntp-keygen.html +OLD_FILES+=usr/share/doc/ntp/ntp-wait.html +OLD_FILES+=usr/share/doc/ntp/ntp.conf.html +OLD_FILES+=usr/share/doc/ntp/ntp.keys.html +OLD_FILES+=usr/share/doc/ntp/ntp_conf.html OLD_FILES+=usr/share/doc/ntp/ntpd.html OLD_FILES+=usr/share/doc/ntp/ntpdate.html OLD_FILES+=usr/share/doc/ntp/ntpdc.html +OLD_FILES+=usr/share/doc/ntp/ntpdsim.html +OLD_FILES+=usr/share/doc/ntp/ntpdsim_new.html OLD_FILES+=usr/share/doc/ntp/ntpq.html +OLD_FILES+=usr/share/doc/ntp/ntpsnmpd.html OLD_FILES+=usr/share/doc/ntp/ntptime.html OLD_FILES+=usr/share/doc/ntp/ntptrace.html +OLD_FILES+=usr/share/doc/ntp/orphan.html OLD_FILES+=usr/share/doc/ntp/parsedata.html OLD_FILES+=usr/share/doc/ntp/parsenew.html OLD_FILES+=usr/share/doc/ntp/patches.html +OLD_FILES+=usr/share/doc/ntp/pic/9400n.jpg +OLD_FILES+=usr/share/doc/ntp/pic/alice11.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice13.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice15.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice23.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice31.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice32.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice35.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice38.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice44.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice47.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice51.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice61.gif +OLD_FILES+=usr/share/doc/ntp/pic/barnstable.gif +OLD_FILES+=usr/share/doc/ntp/pic/beaver.gif +OLD_FILES+=usr/share/doc/ntp/pic/boom3.gif +OLD_FILES+=usr/share/doc/ntp/pic/boom3a.gif +OLD_FILES+=usr/share/doc/ntp/pic/boom4.gif +OLD_FILES+=usr/share/doc/ntp/pic/broad.gif +OLD_FILES+=usr/share/doc/ntp/pic/bustardfly.gif +OLD_FILES+=usr/share/doc/ntp/pic/c51.jpg +OLD_FILES+=usr/share/doc/ntp/pic/description.jpg +OLD_FILES+=usr/share/doc/ntp/pic/discipline.gif +OLD_FILES+=usr/share/doc/ntp/pic/dogsnake.gif +OLD_FILES+=usr/share/doc/ntp/pic/driver29.gif +OLD_FILES+=usr/share/doc/ntp/pic/driver43_1.gif +OLD_FILES+=usr/share/doc/ntp/pic/driver43_2.jpg +OLD_FILES+=usr/share/doc/ntp/pic/fg6021.gif +OLD_FILES+=usr/share/doc/ntp/pic/fg6039.jpg +OLD_FILES+=usr/share/doc/ntp/pic/fig_3_1.gif +OLD_FILES+=usr/share/doc/ntp/pic/flatheads.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt1.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt2.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt3.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt4.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt5.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt6.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt7.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt8.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt9.gif +OLD_FILES+=usr/share/doc/ntp/pic/freq1211.gif +OLD_FILES+=usr/share/doc/ntp/pic/gadget.jpg +OLD_FILES+=usr/share/doc/ntp/pic/gps167.jpg +OLD_FILES+=usr/share/doc/ntp/pic/group.gif +OLD_FILES+=usr/share/doc/ntp/pic/hornraba.gif +OLD_FILES+=usr/share/doc/ntp/pic/igclock.gif +OLD_FILES+=usr/share/doc/ntp/pic/neoclock4x.gif +OLD_FILES+=usr/share/doc/ntp/pic/offset1211.gif +OLD_FILES+=usr/share/doc/ntp/pic/oncore_evalbig.gif +OLD_FILES+=usr/share/doc/ntp/pic/oncore_remoteant.jpg +OLD_FILES+=usr/share/doc/ntp/pic/oncore_utplusbig.gif +OLD_FILES+=usr/share/doc/ntp/pic/oz2.gif +OLD_FILES+=usr/share/doc/ntp/pic/panda.gif +OLD_FILES+=usr/share/doc/ntp/pic/pd_om006.gif +OLD_FILES+=usr/share/doc/ntp/pic/pd_om011.gif +OLD_FILES+=usr/share/doc/ntp/pic/peer.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo1a.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo3a.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo4.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo5.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo6.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo7.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo8.gif +OLD_FILES+=usr/share/doc/ntp/pic/pzf509.jpg +OLD_FILES+=usr/share/doc/ntp/pic/pzf511.jpg +OLD_FILES+=usr/share/doc/ntp/pic/rabbit.gif +OLD_FILES+=usr/share/doc/ntp/pic/radio2.jpg +OLD_FILES+=usr/share/doc/ntp/pic/sheepb.jpg +OLD_FILES+=usr/share/doc/ntp/pic/stack1a.jpg +OLD_FILES+=usr/share/doc/ntp/pic/stats.gif +OLD_FILES+=usr/share/doc/ntp/pic/sx5.gif +OLD_FILES+=usr/share/doc/ntp/pic/thunderbolt.jpg +OLD_FILES+=usr/share/doc/ntp/pic/time1.gif +OLD_FILES+=usr/share/doc/ntp/pic/tonea.gif +OLD_FILES+=usr/share/doc/ntp/pic/tribeb.gif +OLD_FILES+=usr/share/doc/ntp/pic/wingdorothy.gif +OLD_FILES+=usr/share/doc/ntp/poll.html OLD_FILES+=usr/share/doc/ntp/porting.html OLD_FILES+=usr/share/doc/ntp/pps.html OLD_FILES+=usr/share/doc/ntp/prefer.html OLD_FILES+=usr/share/doc/ntp/quick.html +OLD_FILES+=usr/share/doc/ntp/rate.html OLD_FILES+=usr/share/doc/ntp/rdebug.html OLD_FILES+=usr/share/doc/ntp/refclock.html OLD_FILES+=usr/share/doc/ntp/release.html +OLD_FILES+=usr/share/doc/ntp/scripts/accopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/audio.txt +OLD_FILES+=usr/share/doc/ntp/scripts/authopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/clockopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/command.txt +OLD_FILES+=usr/share/doc/ntp/scripts/config.txt +OLD_FILES+=usr/share/doc/ntp/scripts/confopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/external.txt +OLD_FILES+=usr/share/doc/ntp/scripts/footer.txt +OLD_FILES+=usr/share/doc/ntp/scripts/hand.txt +OLD_FILES+=usr/share/doc/ntp/scripts/install.txt +OLD_FILES+=usr/share/doc/ntp/scripts/manual.txt +OLD_FILES+=usr/share/doc/ntp/scripts/misc.txt +OLD_FILES+=usr/share/doc/ntp/scripts/miscopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/monopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/refclock.txt +OLD_FILES+=usr/share/doc/ntp/scripts/special.txt +OLD_FILES+=usr/share/doc/ntp/scripts/style.css +OLD_FILES+=usr/share/doc/ntp/select.html +OLD_FILES+=usr/share/doc/ntp/sitemap.html +OLD_FILES+=usr/share/doc/ntp/sntp.html +OLD_FILES+=usr/share/doc/ntp/stats.html OLD_FILES+=usr/share/doc/ntp/tickadj.html +OLD_FILES+=usr/share/doc/ntp/warp.html +OLD_FILES+=usr/share/doc/ntp/xleave.html OLD_DIRS+=usr/share/doc/ntp/drivers OLD_DIRS+=usr/share/doc/ntp/drivers/scripts OLD_DIRS+=usr/share/doc/ntp/drivers/icons From owner-svn-src-all@freebsd.org Fri Sep 15 08:13:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 022EFE067AB; Fri, 15 Sep 2017 08:13:33 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (mp2.macomnet.net [195.128.64.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82F1B815FF; Fri, 15 Sep 2017 08:13:31 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.15.2/8.15.2) with ESMTP id v8F8A3XZ068100; Fri, 15 Sep 2017 11:10:03 +0300 (MSK) (envelope-from maxim.konovalov@gmail.com) Date: Fri, 15 Sep 2017 11:10:03 +0300 (MSK) From: Maxim Konovalov To: Michael Tuexen cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323493 - head/usr.sbin/tcpdrop In-Reply-To: <201709121339.v8CDdiWH036958@repo.freebsd.org> Message-ID: References: <201709121339.v8CDdiWH036958@repo.freebsd.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 08:13:33 -0000 Hi Michael, On Tue, 12 Sep 2017, 13:39-0000, Michael Tuexen wrote: > Author: tuexen > Date: Tue Sep 12 13:39:44 2017 > New Revision: 323493 > URL: https://svnweb.freebsd.org/changeset/base/323493 > > Log: > Allow TCP connections to be filtered by stack and state. > > Choose the command line options to be consistent with the ones of > sockstat. > Makes sense? Index: tcpdrop.8 =================================================================== --- tcpdrop.8 (revision 323607) +++ tcpdrop.8 (working copy) @@ -172,7 +172,8 @@ LAST_ACK state use: .Ed .Sh SEE ALSO .Xr netstat 1 , -.Xr sockstat 1 +.Xr sockstat 1 , +.Xr tcp_functions 9 .Sh AUTHORS .An Markus Friedl Aq Mt markus@openbsd.org .An Juli Mallett Aq Mt jmallett@FreeBSD.org -- Maxim Konovalov From owner-svn-src-all@freebsd.org Fri Sep 15 09:00:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CB81E086B5; Fri, 15 Sep 2017 09:00:46 +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 4B9AC82C72; Fri, 15 Sep 2017 09:00:46 +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 v8F90jnC070165; Fri, 15 Sep 2017 09:00:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F90jmB070164; Fri, 15 Sep 2017 09:00:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709150900.v8F90jmB070164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 15 Sep 2017 09:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323608 - stable/11/sys/x86/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/x86/include X-SVN-Commit-Revision: 323608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 09:00:46 -0000 Author: kib Date: Fri Sep 15 09:00:45 2017 New Revision: 323608 URL: https://svnweb.freebsd.org/changeset/base/323608 Log: MFC r323324: Add a constant specifying the min size of the IOAPIC registers window. Modified: stable/11/sys/x86/include/apicreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/apicreg.h ============================================================================== --- stable/11/sys/x86/include/apicreg.h Fri Sep 15 00:54:37 2017 (r323607) +++ stable/11/sys/x86/include/apicreg.h Fri Sep 15 09:00:45 2017 (r323608) @@ -469,6 +469,8 @@ typedef struct IOAPIC ioapic_t; #define IOAPIC_WINDOW 0x10 #define IOAPIC_EOIR 0x40 +#define IOAPIC_WND_SIZE 0x50 + /* indexes into IO APIC */ #define IOAPIC_ID 0x00 #define IOAPIC_VER 0x01 From owner-svn-src-all@freebsd.org Fri Sep 15 09:03:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B084E08934; Fri, 15 Sep 2017 09:03:03 +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 DA959831DA; Fri, 15 Sep 2017 09:03:02 +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 v8F932e8074186; Fri, 15 Sep 2017 09:03:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8F932Ai074185; Fri, 15 Sep 2017 09:03:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709150903.v8F932Ai074185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 15 Sep 2017 09:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323609 - stable/11/sys/x86/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/x86/pci X-SVN-Commit-Revision: 323609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 09:03:03 -0000 Author: kib Date: Fri Sep 15 09:03:01 2017 New Revision: 323609 URL: https://svnweb.freebsd.org/changeset/base/323609 Log: MFC r323327: Enhance qpi.c to make it usable on all Core-microarchitecture Xeons. Modified: stable/11/sys/x86/pci/qpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/pci/qpi.c ============================================================================== --- stable/11/sys/x86/pci/qpi.c Fri Sep 15 09:00:45 2017 (r323608) +++ stable/11/sys/x86/pci/qpi.c Fri Sep 15 09:03:01 2017 (r323609) @@ -63,13 +63,19 @@ static MALLOC_DEFINE(M_QPI, "qpidrv", "qpi system devi static void qpi_identify(driver_t *driver, device_t parent) { + int do_qpi; /* Check CPUID to ensure this is an i7 CPU of some sort. */ - if (!(cpu_vendor_id == CPU_VENDOR_INTEL && - CPUID_TO_FAMILY(cpu_id) == 0x6 && - (CPUID_TO_MODEL(cpu_id) == 0x1a || CPUID_TO_MODEL(cpu_id) == 0x2c))) + if (cpu_vendor_id != CPU_VENDOR_INTEL || + CPUID_TO_FAMILY(cpu_id) != 0x6) return; + /* Only discover buses with configuration devices if allowed by user */ + do_qpi = 0; + TUNABLE_INT_FETCH("hw.attach_intel_csr_pci", &do_qpi); + if (!do_qpi) + return; + /* PCI config register access is required. */ if (pci_cfgregopen() == 0) return; @@ -97,6 +103,7 @@ qpi_probe_pcib(device_t dev, int bus) struct qpi_device *qdev; device_t child; uint32_t devid; + int s; /* * If a PCI bus already exists for this bus number, then @@ -106,18 +113,23 @@ qpi_probe_pcib(device_t dev, int bus) return (EEXIST); /* - * Attempt to read the device id for device 0, function 0 on - * the bus. A value of 0xffffffff means that the bus is not - * present. + * Attempt to read the device id for every slot, function 0 on + * the bus. If all read values are 0xffffffff this means that + * the bus is not present. */ - devid = pci_cfgregread(bus, 0, 0, PCIR_DEVVENDOR, 4); + for (s = 0; s <= PCI_SLOTMAX; s++) { + devid = pci_cfgregread(bus, s, 0, PCIR_DEVVENDOR, 4); + if (devid != 0xffffffff) + break; + } if (devid == 0xffffffff) return (ENOENT); if ((devid & 0xffff) != 0x8086) { - device_printf(dev, - "Device at pci%d.0.0 has non-Intel vendor 0x%x\n", bus, - devid & 0xffff); + if (bootverbose) + device_printf(dev, + "Device at pci%d.%d.0 has non-Intel vendor 0x%x\n", + bus, s, devid & 0xffff); return (ENXIO); } @@ -137,12 +149,12 @@ qpi_attach(device_t dev) int bus; /* - * Each processor socket has a dedicated PCI bus counting down from - * 255. We keep probing buses until one fails. + * Each processor socket has a dedicated PCI bus, sometimes + * not enumerated by ACPI. Probe all unattached buses from 0 + * to 255. */ - for (bus = 255;; bus--) - if (qpi_probe_pcib(dev, bus) != 0) - break; + for (bus = PCI_BUSMAX; bus >= 0; bus--) + qpi_probe_pcib(dev, bus); return (bus_generic_attach(dev)); } From owner-svn-src-all@freebsd.org Fri Sep 15 11:58:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ED85E10FFE; Fri, 15 Sep 2017 11:58:22 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CE7F864277; Fri, 15 Sep 2017 11:58:21 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from toad2.stack.nl (toad2.stack.nl [IPv6:2001:610:1108:5010::161]) by mailout.stack.nl (Postfix) with ESMTP id 3AC7941; Fri, 15 Sep 2017 13:58:19 +0200 (CEST) Received: by toad2.stack.nl (Postfix, from userid 1677) id 33E5D89294; Fri, 15 Sep 2017 13:58:19 +0200 (CEST) Date: Fri, 15 Sep 2017 13:58:19 +0200 From: Jilles Tjoelker To: Ed Schouten Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323177 - in head: sys/compat/cloudabi sys/contrib/cloudabi usr.bin/truss Message-ID: <20170915115819.GA22099@stack.nl> References: <201709050746.v857kjX9032212@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709050746.v857kjX9032212@repo.freebsd.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 11:58:22 -0000 On Tue, Sep 05, 2017 at 07:46:45AM +0000, Ed Schouten wrote: > Author: ed > Date: Tue Sep 5 07:46:45 2017 > New Revision: 323177 > URL: https://svnweb.freebsd.org/changeset/base/323177 > Log: > Merge pipes and socket pairs. > Now that CloudABI's sockets API has been changed to be addressless and > only connected socket instances are used (e.g., socket pairs), they have > become fairly similar to pipes. The only differences on CloudABI is that > socket pairs additionally support shutdown(), send() and recv(). > To simplify the ABI, we've therefore decided to remove pipes as a > separate file descriptor type and just let pipe() return a socket pair > of type SOCK_STREAM. S_ISFIFO() and S_ISSOCK() are now defined > identically. Although this is correct from a functionality point of view (S_IFIFO and S_IFSOCK are probably expected to be different in a POSIX context, but this is unlikely to break anything that is not already broken), it is a partial reversal of previous changes to FreeBSD that created separate implementations for pipes (first unnamed pipes in 1996, later fifos in 2012 r232055). The main reason for these changes was performance. Unfortunately, I do not have concrete benchmarks in the CloudABI context. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Fri Sep 15 12:57:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89199E149AB; Fri, 15 Sep 2017 12:57:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3C766533; Fri, 15 Sep 2017 12:57:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FCvYXd067868; Fri, 15 Sep 2017 12:57:34 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FCvYSM067866; Fri, 15 Sep 2017 12:57:34 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201709151257.v8FCvYSM067866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 15 Sep 2017 12:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323610 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 323610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 12:57:35 -0000 Author: andrew Date: Fri Sep 15 12:57:34 2017 New Revision: 323610 URL: https://svnweb.freebsd.org/changeset/base/323610 Log: Add the ARMv8.3 ID register fields. These were found in the A-Profile exploration tools documentation: https://developer.arm.com/products/architecture/a-profile/exploration-tools Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/include/armreg.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Fri Sep 15 09:03:01 2017 (r323609) +++ head/sys/arm64/arm64/identcpu.c Fri Sep 15 12:57:34 2017 (r323610) @@ -282,6 +282,9 @@ print_cpu_features(u_int cpu) case ID_AA64ISAR0_SHA2_BASE: printf("%sSHA2", SEP_STR); break; + case ID_AA64ISAR0_SHA2_512: + printf("%sSHA2+SHA512", SEP_STR); + break; default: printf("%sUnknown SHA2", SEP_STR); break; @@ -298,6 +301,50 @@ print_cpu_features(u_int cpu) break; } + switch (ID_AA64ISAR0_SHA3(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_SHA3_NONE: + break; + case ID_AA64ISAR0_SHA3_IMPL: + printf("%sSHA3", SEP_STR); + break; + default: + printf("%sUnknown SHA3", SEP_STR); + break; + } + + switch (ID_AA64ISAR0_SM3(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_SM3_NONE: + break; + case ID_AA64ISAR0_SM3_IMPL: + printf("%sSM3", SEP_STR); + break; + default: + printf("%sUnknown SM3", SEP_STR); + break; + } + + switch (ID_AA64ISAR0_SM4(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_SM4_NONE: + break; + case ID_AA64ISAR0_SM4_IMPL: + printf("%sSM4", SEP_STR); + break; + default: + printf("%sUnknown SM4", SEP_STR); + break; + } + + switch (ID_AA64ISAR0_DP(cpu_desc[cpu].id_aa64isar0)) { + case ID_AA64ISAR0_DP_NONE: + break; + case ID_AA64ISAR0_DP_IMPL: + printf("%sDotProd", SEP_STR); + break; + default: + printf("%sUnknown DP", SEP_STR); + break; + } + if ((cpu_desc[cpu].id_aa64isar0 & ~ID_AA64ISAR0_MASK) != 0) printf("%s%#lx", SEP_STR, cpu_desc[cpu].id_aa64isar0 & ~ID_AA64ISAR0_MASK); @@ -310,6 +357,83 @@ print_cpu_features(u_int cpu) printed = 0; printf(" Instruction Set Attributes 1 = <"); + switch (ID_AA64ISAR1_GPI(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_GPI_NONE: + break; + case ID_AA64ISAR1_GPI_IMPL: + printf("%sImpl GenericAuth", SEP_STR); + break; + default: + printf("%sUnknown GenericAuth", SEP_STR); + break; + } + + switch (ID_AA64ISAR1_GPA(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_GPA_NONE: + break; + case ID_AA64ISAR1_GPA_IMPL: + printf("%sPrince GenericAuth", SEP_STR); + break; + default: + printf("%sUnknown GenericAuth", SEP_STR); + break; + } + + switch (ID_AA64ISAR1_LRCPC(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_LRCPC_NONE: + break; + case ID_AA64ISAR1_LRCPC_IMPL: + printf("%sRCpc", SEP_STR); + break; + default: + printf("%sUnknown RCpc", SEP_STR); + break; + } + + switch (ID_AA64ISAR1_FCMA(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_FCMA_NONE: + break; + case ID_AA64ISAR1_FCMA_IMPL: + printf("%sFCMA", SEP_STR); + break; + default: + printf("%sUnknown FCMA", SEP_STR); + break; + } + + switch (ID_AA64ISAR1_JSCVT(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_JSCVT_NONE: + break; + case ID_AA64ISAR1_JSCVT_IMPL: + printf("%sJS Conv", SEP_STR); + break; + default: + printf("%sUnknown JS Conv", SEP_STR); + break; + } + + switch (ID_AA64ISAR1_API(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_API_NONE: + break; + case ID_AA64ISAR1_API_IMPL: + printf("%sImpl AddrAuth", SEP_STR); + break; + default: + printf("%sUnknown Impl AddrAuth", SEP_STR); + break; + } + + switch (ID_AA64ISAR1_APA(cpu_desc[cpu].id_aa64isar1)) { + case ID_AA64ISAR1_APA_NONE: + break; + case ID_AA64ISAR1_APA_IMPL: + printf("%sPrince AddrAuth", SEP_STR); + break; + default: + printf("%sUnknown Prince AddrAuth", SEP_STR); + break; + } + switch (ID_AA64ISAR1_DPB(cpu_desc[cpu].id_aa64isar1)) { case ID_AA64ISAR1_DPB_NONE: break; @@ -687,6 +811,29 @@ print_cpu_features(u_int cpu) if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_MMFR2) != 0) { printed = 0; printf(" Memory Model Features 2 = <"); + + switch (ID_AA64MMFR2_NV(cpu_desc[cpu].id_aa64mmfr2)) { + case ID_AA64MMFR2_NV_NONE: + break; + case ID_AA64MMFR2_NV_IMPL: + printf("%sNestedVirt", SEP_STR); + break; + default: + printf("%sUnknown NestedVirt", SEP_STR); + break; + } + + switch (ID_AA64MMFR2_CCIDX(cpu_desc[cpu].id_aa64mmfr2)) { + case ID_AA64MMFR2_CCIDX_32: + printf("%s32b CCIDX", SEP_STR); + break; + case ID_AA64MMFR2_CCIDX_64: + printf("%s64b CCIDX", SEP_STR); + break; + default: + printf("%sUnknown CCIDX", SEP_STR); + break; + } switch (ID_AA64MMFR2_VA_RANGE(cpu_desc[cpu].id_aa64mmfr2)) { case ID_AA64MMFR2_VA_RANGE_48: Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Fri Sep 15 09:03:01 2017 (r323609) +++ head/sys/arm64/include/armreg.h Fri Sep 15 12:57:34 2017 (r323610) @@ -205,7 +205,7 @@ #define ID_AA64DFR0_PMS_VER_V1 (0x1ul << ID_AA64DFR0_PMS_VER_SHIFT) /* ID_AA64ISAR0_EL1 */ -#define ID_AA64ISAR0_MASK 0xf0fffff0 +#define ID_AA64ISAR0_MASK 0x0000fffff0fffff0ul #define ID_AA64ISAR0_AES_SHIFT 4 #define ID_AA64ISAR0_AES_MASK (0xf << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES(x) ((x) & ID_AA64ISAR0_AES_MASK) @@ -222,6 +222,7 @@ #define ID_AA64ISAR0_SHA2(x) ((x) & ID_AA64ISAR0_SHA2_MASK) #define ID_AA64ISAR0_SHA2_NONE (0x0 << ID_AA64ISAR0_SHA2_SHIFT) #define ID_AA64ISAR0_SHA2_BASE (0x1 << ID_AA64ISAR0_SHA2_SHIFT) +#define ID_AA64ISAR0_SHA2_512 (0x2 << ID_AA64ISAR0_SHA2_SHIFT) #define ID_AA64ISAR0_CRC32_SHIFT 16 #define ID_AA64ISAR0_CRC32_MASK (0xf << ID_AA64ISAR0_CRC32_SHIFT) #define ID_AA64ISAR0_CRC32(x) ((x) & ID_AA64ISAR0_CRC32_MASK) @@ -237,14 +238,69 @@ #define ID_AA64ISAR0_RDM(x) ((x) & ID_AA64ISAR0_RDM_MASK) #define ID_AA64ISAR0_RDM_NONE (0x0 << ID_AA64ISAR0_RDM_SHIFT) #define ID_AA64ISAR0_RDM_IMPL (0x1 << ID_AA64ISAR0_RDM_SHIFT) +#define ID_AA64ISAR0_SHA3_SHIFT 32 +#define ID_AA64ISAR0_SHA3_MASK (0xful << ID_AA64ISAR0_SHA3_SHIFT) +#define ID_AA64ISAR0_SHA3(x) ((x) & ID_AA64ISAR0_SHA3_MASK) +#define ID_AA64ISAR0_SHA3_NONE (0x0ul << ID_AA64ISAR0_SHA3_SHIFT) +#define ID_AA64ISAR0_SHA3_IMPL (0x1ul << ID_AA64ISAR0_SHA3_SHIFT) +#define ID_AA64ISAR0_SM3_SHIFT 36 +#define ID_AA64ISAR0_SM3_MASK (0xful << ID_AA64ISAR0_SM3_SHIFT) +#define ID_AA64ISAR0_SM3(x) ((x) & ID_AA64ISAR0_SM3_MASK) +#define ID_AA64ISAR0_SM3_NONE (0x0ul << ID_AA64ISAR0_SM3_SHIFT) +#define ID_AA64ISAR0_SM3_IMPL (0x1ul << ID_AA64ISAR0_SM3_SHIFT) +#define ID_AA64ISAR0_SM4_SHIFT 40 +#define ID_AA64ISAR0_SM4_MASK (0xful << ID_AA64ISAR0_SM4_SHIFT) +#define ID_AA64ISAR0_SM4(x) ((x) & ID_AA64ISAR0_SM4_MASK) +#define ID_AA64ISAR0_SM4_NONE (0x0ul << ID_AA64ISAR0_SM4_SHIFT) +#define ID_AA64ISAR0_SM4_IMPL (0x1ul << ID_AA64ISAR0_SM4_SHIFT) +#define ID_AA64ISAR0_DP_SHIFT 48 +#define ID_AA64ISAR0_DP_MASK (0xful << ID_AA64ISAR0_DP_SHIFT) +#define ID_AA64ISAR0_DP(x) ((x) & ID_AA64ISAR0_DP_MASK) +#define ID_AA64ISAR0_DP_NONE (0x0ul << ID_AA64ISAR0_DP_SHIFT) +#define ID_AA64ISAR0_DP_IMPL (0x1ul << ID_AA64ISAR0_DP_SHIFT) /* ID_AA64ISAR1_EL1 */ -#define ID_AA64ISAR1_MASK 0x0000000f +#define ID_AA64ISAR1_MASK 0xffffffff #define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_MASK (0xf << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK) #define ID_AA64ISAR1_DPB_NONE (0x0 << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB_IMPL (0x1 << ID_AA64ISAR1_DPB_SHIFT) +#define ID_AA64ISAR1_APA_SHIFT 4 +#define ID_AA64ISAR1_APA_MASK (0xf << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA(x) ((x) & ID_AA64ISAR1_APA_MASK) +#define ID_AA64ISAR1_APA_NONE (0x0 << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_IMPL (0x1 << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_API_SHIFT 8 +#define ID_AA64ISAR1_API_MASK (0xf << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API(x) ((x) & ID_AA64ISAR1_API_MASK) +#define ID_AA64ISAR1_API_NONE (0x0 << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_IMPL (0x1 << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_JSCVT_SHIFT 12 +#define ID_AA64ISAR1_JSCVT_MASK (0xf << ID_AA64ISAR1_JSCVT_SHIFT) +#define ID_AA64ISAR1_JSCVT(x) ((x) & ID_AA64ISAR1_JSCVT_MASK) +#define ID_AA64ISAR1_JSCVT_NONE (0x0 << ID_AA64ISAR1_JSCVT_SHIFT) +#define ID_AA64ISAR1_JSCVT_IMPL (0x1 << ID_AA64ISAR1_JSCVT_SHIFT) +#define ID_AA64ISAR1_FCMA_SHIFT 16 +#define ID_AA64ISAR1_FCMA_MASK (0xf << ID_AA64ISAR1_FCMA_SHIFT) +#define ID_AA64ISAR1_FCMA(x) ((x) & ID_AA64ISAR1_FCMA_MASK) +#define ID_AA64ISAR1_FCMA_NONE (0x0 << ID_AA64ISAR1_FCMA_SHIFT) +#define ID_AA64ISAR1_FCMA_IMPL (0x1 << ID_AA64ISAR1_FCMA_SHIFT) +#define ID_AA64ISAR1_LRCPC_SHIFT 20 +#define ID_AA64ISAR1_LRCPC_MASK (0xf << ID_AA64ISAR1_LRCPC_SHIFT) +#define ID_AA64ISAR1_LRCPC(x) ((x) & ID_AA64ISAR1_LRCPC_MASK) +#define ID_AA64ISAR1_LRCPC_NONE (0x0 << ID_AA64ISAR1_LRCPC_SHIFT) +#define ID_AA64ISAR1_LRCPC_IMPL (0x1 << ID_AA64ISAR1_LRCPC_SHIFT) +#define ID_AA64ISAR1_GPA_SHIFT 24 +#define ID_AA64ISAR1_GPA_MASK (0xf << ID_AA64ISAR1_GPA_SHIFT) +#define ID_AA64ISAR1_GPA(x) ((x) & ID_AA64ISAR1_GPA_MASK) +#define ID_AA64ISAR1_GPA_NONE (0x0 << ID_AA64ISAR1_GPA_SHIFT) +#define ID_AA64ISAR1_GPA_IMPL (0x1 << ID_AA64ISAR1_GPA_SHIFT) +#define ID_AA64ISAR1_GPI_SHIFT 28 +#define ID_AA64ISAR1_GPI_MASK (0xf << ID_AA64ISAR1_GPI_SHIFT) +#define ID_AA64ISAR1_GPI(x) ((x) & ID_AA64ISAR1_GPI_MASK) +#define ID_AA64ISAR1_GPI_NONE (0x0 << ID_AA64ISAR1_GPI_SHIFT) +#define ID_AA64ISAR1_GPI_IMPL (0x1 << ID_AA64ISAR1_GPI_SHIFT) /* ID_AA64MMFR0_EL1 */ #define ID_AA64MMFR0_MASK 0xffffffff @@ -342,7 +398,7 @@ /* ID_AA64MMFR2_EL1 */ #define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 -#define ID_AA64MMFR2_MASK 0x000fffff +#define ID_AA64MMFR2_MASK 0x0fffffff #define ID_AA64MMFR2_CNP_SHIFT 0 #define ID_AA64MMFR2_CNP_MASK (0xf << ID_AA64MMFR2_CNP_SHIFT) #define ID_AA64MMFR2_CNP(x) ((x) & ID_AA64MMFR2_CNP_MASK) @@ -368,6 +424,16 @@ #define ID_AA64MMFR2_VA_RANGE(x) ((x) & ID_AA64MMFR2_VA_RANGE_MASK) #define ID_AA64MMFR2_VA_RANGE_48 (0x0 << ID_AA64MMFR2_VA_RANGE_SHIFT) #define ID_AA64MMFR2_VA_RANGE_52 (0x1 << ID_AA64MMFR2_VA_RANGE_SHIFT) +#define ID_AA64MMFR2_CCIDX_SHIFT 20 +#define ID_AA64MMFR2_CCIDX_MASK (0xf << ID_AA64MMFR2_CCIDX_SHIFT) +#define ID_AA64MMFR2_CCIDX(x) ((x) & ID_AA64MMFR2_CCIDX_MASK) +#define ID_AA64MMFR2_CCIDX_32 (0x0 << ID_AA64MMFR2_CCIDX_SHIFT) +#define ID_AA64MMFR2_CCIDX_64 (0x1 << ID_AA64MMFR2_CCIDX_SHIFT) +#define ID_AA64MMFR2_NV_SHIFT 24 +#define ID_AA64MMFR2_NV_MASK (0xf << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV(x) ((x) & ID_AA64MMFR2_NV_MASK) +#define ID_AA64MMFR2_NV_NONE (0x0 << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_IMPL (0x1 << ID_AA64MMFR2_NV_SHIFT) /* ID_AA64PFR0_EL1 */ #define ID_AA64PFR0_MASK 0x0000000ffffffffful From owner-svn-src-all@freebsd.org Fri Sep 15 13:34:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14C2FE16CB9; Fri, 15 Sep 2017 13:34:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6A8F67BCA; Fri, 15 Sep 2017 13:34:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FDY1Ya084296; Fri, 15 Sep 2017 13:34:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FDY1Zd084295; Fri, 15 Sep 2017 13:34:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709151334.v8FDY1Zd084295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 15 Sep 2017 13:34:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323611 - head/usr.bin/grep/regex X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/grep/regex X-SVN-Commit-Revision: 323611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 13:34:02 -0000 Author: emaste Date: Fri Sep 15 13:34:00 2017 New Revision: 323611 URL: https://svnweb.freebsd.org/changeset/base/323611 Log: fastmatch.h: remove duplicate #defines Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12375 Modified: head/usr.bin/grep/regex/fastmatch.h Modified: head/usr.bin/grep/regex/fastmatch.h ============================================================================== --- head/usr.bin/grep/regex/fastmatch.h Fri Sep 15 12:57:34 2017 (r323610) +++ head/usr.bin/grep/regex/fastmatch.h Fri Sep 15 13:34:00 2017 (r323611) @@ -92,17 +92,4 @@ tre_fastwnexec(const fastmatch_t *preg, const wchar_t #define fastexec tre_fastexec #define fastwnexec tre_fastwnexec #define fastwexec tre_fastwexec -#define fixcomp tre_fixcomp -#define fastcomp tre_fastcomp -#define fastexec tre_fastexec -#define fastfree tre_fastfree -#define fixwcomp tre_fixwcomp -#define fastwcomp tre_fastwcomp -#define fastwexec tre_fastwexec -#define fixncomp tre_fixncomp -#define fastncomp tre_fastncomp -#define fastnexec tre_fastnexec -#define fixwncomp tre_fixwncomp -#define fastwncomp tre_fastwncomp -#define fastwnexec tre_fastwnexec #endif /* FASTMATCH_H */ From owner-svn-src-all@freebsd.org Fri Sep 15 13:57:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E841E18150; Fri, 15 Sep 2017 13:57: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 57D1F68AA8; Fri, 15 Sep 2017 13:57: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 v8FDv9jE092283; Fri, 15 Sep 2017 13:57:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FDv91x092281; Fri, 15 Sep 2017 13:57:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201709151357.v8FDv91x092281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 15 Sep 2017 13:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323612 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 323612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 13:57:10 -0000 Author: avg Date: Fri Sep 15 13:57:08 2017 New Revision: 323612 URL: https://svnweb.freebsd.org/changeset/base/323612 Log: gmirror: treat ENXIO as disk disconnect, not media error In theory, all data access errors mean that a member is out of sync at most. But they were treated as more serious errors to avoid the situation where a flaky disk gets repeatedly disconnected, re-synchronized, reconnected and then disconnected again. ENXIO is a special error that means that the member disk disappeared, so it should get the same handling as the GEOM orphaning event. There is a better chance that when the disk is reconnected, it will be a good member again. When ENXIO happens on a read we use the exisiting G_MIRROR_BUMP_SYNCID mechanism which means that the mirror's syncid is increased as soon as there is a write to the mirror. That's because no data has got out of sync yet, but the problematic memeber is disconnected, so the future write will make it stale. When ENXIO happens on a write we use a new G_MIRROR_BUMP_SYNCID_NOW mechanism which means that we update the mirror metadata as soon as possible because the problematic memeber is already behind. Reviewed by: markj, imp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D9463 Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Fri Sep 15 13:34:00 2017 (r323611) +++ head/sys/geom/mirror/g_mirror.c Fri Sep 15 13:57:08 2017 (r323612) @@ -982,7 +982,13 @@ g_mirror_regular_request(struct bio *bp) if (g_mirror_disconnect_on_failure && g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 1) { - sc->sc_bump_id |= G_MIRROR_BUMP_GENID; + if (bp->bio_error == ENXIO && + bp->bio_cmd == BIO_READ) + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + else if (bp->bio_error == ENXIO) + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID_NOW; + else + sc->sc_bump_id |= G_MIRROR_BUMP_GENID; g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DISCONNECTED, G_MIRROR_EVENT_DONTWAIT); @@ -2517,6 +2523,10 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool if ((sc->sc_bump_id & G_MIRROR_BUMP_GENID) != 0) { sc->sc_bump_id &= ~G_MIRROR_BUMP_GENID; g_mirror_bump_genid(sc); + } + if ((sc->sc_bump_id & G_MIRROR_BUMP_SYNCID_NOW) != 0) { + sc->sc_bump_id &= ~G_MIRROR_BUMP_SYNCID_NOW; + g_mirror_bump_syncid(sc); } break; default: Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Fri Sep 15 13:34:00 2017 (r323611) +++ head/sys/geom/mirror/g_mirror.h Fri Sep 15 13:57:08 2017 (r323612) @@ -169,9 +169,11 @@ struct g_mirror_event { #define G_MIRROR_TYPE_AUTOMATIC 1 /* Bump syncid on first write. */ -#define G_MIRROR_BUMP_SYNCID 0x1 +#define G_MIRROR_BUMP_SYNCID 0x1 /* Bump genid immediately. */ -#define G_MIRROR_BUMP_GENID 0x2 +#define G_MIRROR_BUMP_GENID 0x2 +/* Bump syncid immediately. */ +#define G_MIRROR_BUMP_SYNCID_NOW 0x4 struct g_mirror_softc { u_int sc_type; /* Device type (manual/automatic). */ u_int sc_state; /* Device state. */ From owner-svn-src-all@freebsd.org Fri Sep 15 14:59:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BDBAE1B8ED; Fri, 15 Sep 2017 14:59:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48FAC6ADF1; Fri, 15 Sep 2017 14:59:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FExaLV017181; Fri, 15 Sep 2017 14:59:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FExaeC017180; Fri, 15 Sep 2017 14:59:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201709151459.v8FExaeC017180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 15 Sep 2017 14:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323613 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 14:59:37 -0000 Author: markj Date: Fri Sep 15 14:59:35 2017 New Revision: 323613 URL: https://svnweb.freebsd.org/changeset/base/323613 Log: Include _bitset.h to get BITSET_DEFINE, used to define struct slabbits. MFC after: 1 week Modified: head/sys/vm/uma_int.h Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Fri Sep 15 13:57:08 2017 (r323612) +++ head/sys/vm/uma_int.h Fri Sep 15 14:59:35 2017 (r323613) @@ -28,6 +28,7 @@ * */ +#include #include /* From owner-svn-src-all@freebsd.org Fri Sep 15 15:41:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 417EDE1E33D; Fri, 15 Sep 2017 15:41:09 +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 1BEEB6C9A8; Fri, 15 Sep 2017 15:41:09 +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 v8FFf893033484; Fri, 15 Sep 2017 15:41:08 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FFf8Y5033480; Fri, 15 Sep 2017 15:41:08 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709151541.v8FFf8Y5033480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 15 Sep 2017 15:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323614 - head/usr.sbin/acpi/acpidump X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 323614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 15:41:09 -0000 Author: scottl Date: Fri Sep 15 15:41:07 2017 New Revision: 323614 URL: https://svnweb.freebsd.org/changeset/base/323614 Log: Add support for parsing the Watchdog Descriptor Table (WDDT) Sponsored by: Netflix Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.8 Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Fri Sep 15 14:59:35 2017 (r323613) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Sep 15 15:41:07 2017 (r323614) @@ -65,6 +65,7 @@ static void acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp); static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp); static void acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp); static void acpi_handle_slit(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_wddt(ACPI_TABLE_HEADER *sdp); static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, uint32_t flags); static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp); @@ -679,6 +680,40 @@ acpi_handle_slit(ACPI_TABLE_HEADER *sdp) } static void +acpi_handle_wddt(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_WDDT *wddt; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + wddt = (ACPI_TABLE_WDDT *)sdp; + printf("\tSpecVersion=0x%04x, TableVersion=0x%04x\n", + wddt->SpecVersion, wddt->TableVersion); + printf("\tPciVendorId=0x%04x, Address=", wddt->PciVendorId); + acpi_print_gas(&wddt->Address); + printf("\n\tMaxCount=%u, MinCount=%u, Period=%ums\n", + wddt->MaxCount, wddt->MinCount, wddt->Period); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_WDDT_## flag, #flag) + printf("\tStatus="); + PRINTFLAG(wddt->Status, AVAILABLE); + PRINTFLAG(wddt->Status, ACTIVE); + PRINTFLAG(wddt->Status, TCO_OS_OWNED); + PRINTFLAG(wddt->Status, USER_RESET); + PRINTFLAG(wddt->Status, WDT_RESET); + PRINTFLAG(wddt->Status, POWER_FAIL); + PRINTFLAG(wddt->Status, UNKNOWN_RESET); + PRINTFLAG_END(); + printf("\tCapability="); + PRINTFLAG(wddt->Capability, AUTO_RESET); + PRINTFLAG(wddt->Capability, ALERT_SUPPORT); + PRINTFLAG_END(); +#undef PRINTFLAG + + printf(END_COMMENT); +} + +static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, uint32_t flags) { @@ -1654,6 +1689,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) acpi_handle_dmar(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_NFIT, 4)) acpi_handle_nfit(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_WDDT, 4)) + acpi_handle_wddt(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); Modified: head/usr.sbin/acpi/acpidump/acpidump.8 ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.8 Fri Sep 15 14:59:35 2017 (r323613) +++ head/usr.sbin/acpi/acpidump/acpidump.8 Fri Sep 15 15:41:07 2017 (r323614) @@ -107,6 +107,7 @@ utility dumps contents of the following tables: .It MCFG .It RSD PTR .It RSDT +.It WDDT .El .Pp The RSDT contains a pointer to the physical memory address of the FACP From owner-svn-src-all@freebsd.org Fri Sep 15 15:57:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1E94E1F04A; Fri, 15 Sep 2017 15:57:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF8AD6D223; Fri, 15 Sep 2017 15:57:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FFvFNm041594; Fri, 15 Sep 2017 15:57:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FFvFKK041593; Fri, 15 Sep 2017 15:57:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201709151557.v8FFvFKK041593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 15 Sep 2017 15:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323615 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 323615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 15:57:17 -0000 Author: kevans Date: Fri Sep 15 15:57:15 2017 New Revision: 323615 URL: https://svnweb.freebsd.org/changeset/base/323615 Log: bsdgrep: disable TRE implementation by default Start the phasing out of TRE by disabling it by default. r317254 introduced a BSD_GREP_FASTMATCH knob (defaulting to on) for testing of bsdgrep with and without TRE enabled. More bugs have cropped up since then, and WITHOUT_BSD_GREP_FASTMATCH has shown in testing to be more stable than its counterpart. Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D12381 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Sep 15 15:41:07 2017 (r323614) +++ head/share/mk/src.opts.mk Fri Sep 15 15:57:15 2017 (r323615) @@ -62,7 +62,6 @@ __DEFAULT_YES_OPTIONS = \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ - BSD_GREP_FASTMATCH \ BSDINSTALL \ BSNMP \ BZIP2 \ @@ -175,6 +174,7 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BSD_GREP \ + BSD_GREP_FASTMATCH \ CLANG_EXTRAS \ DTRACE_TESTS \ GNU_GREP_COMPAT \ From owner-svn-src-all@freebsd.org Fri Sep 15 16:07:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3607E1FB36; Fri, 15 Sep 2017 16:07:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 813696DAB0; Fri, 15 Sep 2017 16:07:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FG79c7045732; Fri, 15 Sep 2017 16:07:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FG79E1045731; Fri, 15 Sep 2017 16:07:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709151607.v8FG79E1045731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 15 Sep 2017 16:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323616 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 16:07:10 -0000 Author: kib Date: Fri Sep 15 16:07:09 2017 New Revision: 323616 URL: https://svnweb.freebsd.org/changeset/base/323616 Log: Batch freeing of the pages in vm_object_page_remove() under the same free queue mutex lock owning session, same as it was done for the object termination in r323561. Reported and tested by: mjg Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Fri Sep 15 15:57:15 2017 (r323615) +++ head/sys/vm/vm_object.c Fri Sep 15 16:07:09 2017 (r323616) @@ -1953,6 +1953,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t { vm_page_t p, next; struct mtx *mtx; + struct pglist pgl; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & OBJ_UNMANAGED) == 0 || @@ -1961,6 +1962,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t if (object->resident_page_count == 0) return; vm_object_pip_add(object, 1); + TAILQ_INIT(&pgl); again: p = vm_page_find_least(object, start); mtx = NULL; @@ -2012,10 +2014,13 @@ again: } if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_all(p); - vm_page_free(p); + p->flags &= ~PG_ZERO; + if (vm_page_free_prep(p, false)) + TAILQ_INSERT_TAIL(&pgl, p, listq); } if (mtx != NULL) mtx_unlock(mtx); + vm_page_free_phys_pglist(&pgl); vm_object_pip_wakeup(object); } From owner-svn-src-all@freebsd.org Fri Sep 15 19:16:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17BD5E03BC0; Fri, 15 Sep 2017 19:16:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E775374342; Fri, 15 Sep 2017 19:16:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FJGXM6024847; Fri, 15 Sep 2017 19:16:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FJGWFs024845; Fri, 15 Sep 2017 19:16:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709151916.v8FJGWFs024845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 15 Sep 2017 19:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r323617 - releng/10.4/release/doc/en_US.ISO8859-1/installation X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/10.4/release/doc/en_US.ISO8859-1/installation X-SVN-Commit-Revision: 323617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 19:16:34 -0000 Author: gjb Date: Fri Sep 15 19:16:32 2017 New Revision: 323617 URL: https://svnweb.freebsd.org/changeset/base/323617 Log: Add the installation page for 10.4-RELEASE. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Added: releng/10.4/release/doc/en_US.ISO8859-1/installation/ releng/10.4/release/doc/en_US.ISO8859-1/installation/Makefile (contents, props changed) releng/10.4/release/doc/en_US.ISO8859-1/installation/article.xml (contents, props changed) Added: releng/10.4/release/doc/en_US.ISO8859-1/installation/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.4/release/doc/en_US.ISO8859-1/installation/Makefile Fri Sep 15 19:16:32 2017 (r323617) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +RELN_ROOT?= ${.CURDIR}/../.. +.ifdef NO_LANGCODE_IN_DESTDIR +DESTDIR?= ${DOCDIR}/installation +.else +DESTDIR?= ${DOCDIR}/en_US.ISO8859-1/installation +.endif + +DOC?= article +FORMATS?= html +INSTALL_COMPRESSED?= gz +INSTALL_ONLY_COMPRESSED?= + +# SGML content +SRCS+= article.xml + +.include "${RELN_ROOT}/share/mk/doc.relnotes.mk" +.include "${DOC_PREFIX}/share/mk/doc.project.mk" Added: releng/10.4/release/doc/en_US.ISO8859-1/installation/article.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.4/release/doc/en_US.ISO8859-1/installation/article.xml Fri Sep 15 19:16:32 2017 (r323617) @@ -0,0 +1,122 @@ + + +%release; + +]> + +

+ &os; &release.current; Installation Instructions + + The &os; Project + + $FreeBSD$ + + + 2017 + The &os; Documentation Project + + + + &tm-attrib.freebsd; + &tm-attrib.intel; + &tm-attrib.sparc; + &tm-attrib.general; + + + + This article gives some brief instructions on installing + &os; &release.current; and upgrading the systems running earlier + releases. + + + + + Installing &os; + + The Installing + &os; + chapter of the &os; + Handbook provides more in-depth information about the + installation program itself, including a guided walk-through with + screenshots. + + + + Upgrading &os; + + If you are upgrading from a previous release of &os;, please + read upgrading + section in the Release Notes for notable + incompatibilities carefully. + + + Upgrading from Source + + The procedure for doing a source code based update is + described in + and + . + + For SVN use the releng/&local.rel; branch + which will be where any upcoming Security Advisories or Errata + Notices will be applied. + + + + Upgrading Using <quote>&os; Update</quote> + + The &man.freebsd-update.8; utility supports binary + upgrades of &arch.i386; and &arch.amd64; systems running + earlier FreeBSD releases. Systems running + 10.3-RELEASE, + 10.4-RC[12] can upgrade as follows: + + &prompt.root; freebsd-update fetch +&prompt.root; freebsd-update install + + Now the &man.freebsd-update.8; utility can fetch bits + belonging to &release.current;. During this process + &man.freebsd-update.8; will ask for help in merging + configuration files. + + &prompt.root; freebsd-update upgrade -r &local.rel;-RELEASE + + &prompt.root; freebsd-update install + + The system must now be rebooted with the newly installed + kernel before the non-kernel components are updated. + + &prompt.root; shutdown -r now + + After rebooting, &man.freebsd-update.8; needs to be run + again to install the new userland components: + + &prompt.root; freebsd-update install + + At this point, users of systems being upgraded from &os; + 10.3-RELEASE or earlier will be prompted by + &man.freebsd-update.8; to rebuild all third-party applications + (e.g., ports installed from the ports tree) due to updates in + system libraries. + + After updating installed third-party applications (and + again, only if &man.freebsd-update.8; printed a message + indicating that this was necessary), run + &man.freebsd-update.8; again so that it can delete the old (no + longer used) system libraries: + + &prompt.root; freebsd-update install + + Finally, reboot into &release.current; + + &prompt.root; shutdown -r now + + +
From owner-svn-src-all@freebsd.org Fri Sep 15 19:17:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8337BE03D02; Fri, 15 Sep 2017 19:17:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42C3A7451A; Fri, 15 Sep 2017 19:17:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FJHVhl025368; Fri, 15 Sep 2017 19:17:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FJHViO025365; Fri, 15 Sep 2017 19:17:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201709151917.v8FJHViO025365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 15 Sep 2017 19:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r323618 - in releng/10.4/release/doc: en_US.ISO8859-1 en_US.ISO8859-1/readme share/xml X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/10.4/release/doc: en_US.ISO8859-1 en_US.ISO8859-1/readme share/xml X-SVN-Commit-Revision: 323618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 19:17:32 -0000 Author: gjb Date: Fri Sep 15 19:17:30 2017 New Revision: 323618 URL: https://svnweb.freebsd.org/changeset/base/323618 Log: - Disconnect the errata document from the build. - Connect the installation page to the build. - Fix a malformed URL. - Update versions, and switch from 'snapshot' to 'release.' Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.4/release/doc/en_US.ISO8859-1/Makefile releng/10.4/release/doc/en_US.ISO8859-1/readme/article.xml releng/10.4/release/doc/share/xml/release.ent Modified: releng/10.4/release/doc/en_US.ISO8859-1/Makefile ============================================================================== --- releng/10.4/release/doc/en_US.ISO8859-1/Makefile Fri Sep 15 19:16:32 2017 (r323617) +++ releng/10.4/release/doc/en_US.ISO8859-1/Makefile Fri Sep 15 19:17:30 2017 (r323618) @@ -4,8 +4,8 @@ RELN_ROOT?= ${.CURDIR}/.. SUBDIR = relnotes SUBDIR+= hardware +SUBDIR+= installation SUBDIR+= readme -SUBDIR+= errata COMPAT_SYMLINK = en Modified: releng/10.4/release/doc/en_US.ISO8859-1/readme/article.xml ============================================================================== --- releng/10.4/release/doc/en_US.ISO8859-1/readme/article.xml Fri Sep 15 19:16:32 2017 (r323617) +++ releng/10.4/release/doc/en_US.ISO8859-1/readme/article.xml Fri Sep 15 19:17:30 2017 (r323618) @@ -352,8 +352,9 @@ other copies are kept updated on the Internet and should be consulted as the current errata for this release. These other copies of the errata are located at - &url.base;/releases/ + the &os; &release.current; + page (as well as any sites which keep up-to-date mirrors of this location). Modified: releng/10.4/release/doc/share/xml/release.ent ============================================================================== --- releng/10.4/release/doc/share/xml/release.ent Fri Sep 15 19:16:32 2017 (r323617) +++ releng/10.4/release/doc/share/xml/release.ent Fri Sep 15 19:17:30 2017 (r323618) @@ -6,7 +6,7 @@ - + - + - + - + - + @@ -38,9 +38,9 @@ - + - + From owner-svn-src-all@freebsd.org Fri Sep 15 19:47:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E666BE0598C; Fri, 15 Sep 2017 19:47:45 +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 C1DD575CEB; Fri, 15 Sep 2017 19:47:45 +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 v8FJliMj038392; Fri, 15 Sep 2017 19:47:44 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FJliJ4038386; Fri, 15 Sep 2017 19:47:44 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201709151947.v8FJliJ4038386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Fri, 15 Sep 2017 19:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323619 - in head/sys: arm/broadcom/bcm2835 cam/mmc conf dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 cam/mmc conf dev/mmc/host X-SVN-Commit-Revision: 323619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 19:47:46 -0000 Author: kibab Date: Fri Sep 15 19:47:44 2017 New Revision: 323619 URL: https://svnweb.freebsd.org/changeset/base/323619 Log: Miscellaneous fixes and improvements to MMCCAM stack * Demote the level of several debug messages to CAM_DEBUG_TRACE * Add detection for SDHC cards that can do 1.8V. No voltage switch sequence is issued yet; * Don't create a separate LUN for each SDIO function. We need just one to make pass(4) attach; * Remove obsolete mmc_sdio* files. SDIO functionality will be moved into the separate device that will manage a new sdio(4) bus; * Terminate probing if got no reply to CMD0; * Make bcm2835 SDHCI host controller driver compile with 'option MMCCAM'. Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D12109 Deleted: head/sys/cam/mmc/mmc_sdio.c head/sys/cam/mmc/mmc_sdio.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c head/sys/cam/mmc/mmc.h head/sys/cam/mmc/mmc_da.c head/sys/cam/mmc/mmc_xpt.c head/sys/conf/files head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Sep 15 19:17:30 2017 (r323618) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Sep 15 19:47:44 2017 (r323619) @@ -685,4 +685,6 @@ static driver_t bcm_sdhci_driver = { DRIVER_MODULE(sdhci_bcm, simplebus, bcm_sdhci_driver, bcm_sdhci_devclass, NULL, NULL); MODULE_DEPEND(sdhci_bcm, sdhci, 1, 1, 1); +#ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_bcm); +#endif Modified: head/sys/cam/mmc/mmc.h ============================================================================== --- head/sys/cam/mmc/mmc.h Fri Sep 15 19:17:30 2017 (r323618) +++ head/sys/cam/mmc/mmc.h Fri Sep 15 19:47:44 2017 (r323619) @@ -87,6 +87,7 @@ struct mmc_params { #define CARD_FEATURE_SDIO 0x1 << 2 #define CARD_FEATURE_SD20 0x1 << 3 #define CARD_FEATURE_MMC 0x1 << 4 +#define CARD_FEATURE_18V 0x1 << 5 uint8_t sdio_func_count; } __packed; Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Fri Sep 15 19:17:30 2017 (r323618) +++ head/sys/cam/mmc/mmc_da.c Fri Sep 15 19:47:44 2017 (r323619) @@ -378,8 +378,7 @@ sddaopen(struct disk *dp) return (error); } - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, - ("sddaopen\n")); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("sddaopen\n")); softc = (struct sdda_softc *)periph->softc; softc->flags |= SDDA_FLAG_OPEN; @@ -403,8 +402,7 @@ sddaclose(struct disk *dp) cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, - ("sddaclose\n")); + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("sddaclose\n")); while (softc->refcount != 0) cam_periph_sleep(periph, &softc->refcount, PRIBIO, "sddaclose", 1); Modified: head/sys/cam/mmc/mmc_xpt.c ============================================================================== --- head/sys/cam/mmc/mmc_xpt.c Fri Sep 15 19:17:30 2017 (r323618) +++ head/sys/cam/mmc/mmc_xpt.c Fri Sep 15 19:47:44 2017 (r323619) @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include /* for xpt_print below */ #include /* for PRIu64 */ @@ -162,6 +161,7 @@ typedef struct { union ccb saved_ccb; uint32_t flags; #define PROBE_FLAG_ACMD_SENT 0x1 /* CMD55 is sent, card expects ACMD */ + uint8_t acmd41_count; /* how many times ACMD41 has been issued */ struct cam_periph *periph; } mmcprobe_softc; @@ -219,6 +219,8 @@ mmc_dev_async(u_int32_t async_code, struct cam_eb *bus printf("Got AC_PATH_REGISTERED -- whatever...\n"); } else if (async_code == AC_PATH_DEREGISTERED ) { printf("Got AC_PATH_DEREGISTERED -- whatever...\n"); + } else if (async_code == AC_UNIT_ATTENTION) { + printf("Got interrupt generated by the card and ignored it\n"); } else panic("Unknown async code\n"); } @@ -299,9 +301,9 @@ mmc_scan_lun(struct cam_periph *periph, struct cam_pat static void mmc_action(union ccb *start_ccb) { - CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mmc_action! func_code=%x, action %s\n", start_ccb->ccb_h.func_code, - xpt_action_name(start_ccb->ccb_h.func_code))); + xpt_action_name(start_ccb->ccb_h.func_code))); switch (start_ccb->ccb_h.func_code) { case XPT_SCAN_BUS: @@ -486,6 +488,7 @@ mmcprobe_register(struct cam_periph *periph, void *arg } softc->flags = 0; + softc->acmd41_count = 0; periph->softc = softc; softc->periph = periph; softc->action = PROBE_INVALID; @@ -672,8 +675,12 @@ mmcprobe_start(struct cam_periph *periph, union ccb *s * We set CCS bit because we do support SDHC cards. * XXX: Don't set CCS if no response to CMD8. */ - mmcio->cmd.arg = MMC_OCR_CCS | mmcp->card_ocr; /* CCS + ocr */ + uint32_t cmd_arg = MMC_OCR_CCS | mmcp->card_ocr; /* CCS + ocr */ + if (softc->acmd41_count < 10 && mmcp->card_ocr != 0 ) + cmd_arg |= MMC_OCR_S18R; + mmcio->cmd.arg = cmd_arg; mmcio->cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR; + softc->acmd41_count++; } else { mmcio->cmd.opcode = MMC_APP_CMD; /* CMD 55 */ mmcio->cmd.arg = 0; /* rca << 16 */ @@ -769,8 +776,9 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do /* There was a device there, but now it's gone... */ if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { xpt_async(AC_LOST_DEVICE, path, NULL); - PROBE_SET_ACTION(softc, PROBE_INVALID); } + PROBE_SET_ACTION(softc, PROBE_INVALID); + break; } path->device->protocol = PROTO_MMCSD; PROBE_SET_ACTION(softc, PROBE_SEND_IF_COND); @@ -936,12 +944,18 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do mmcp->card_features |= CARD_FEATURE_SDHC; } - } else { - CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, - ("Card not ready: %08x\n", mmcio->cmd.resp[0])); - /* Send CMD55+ACMD41 once again */ - PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND); - } + /* Whether the card supports 1.8V signaling */ + if (mmcio->cmd.resp[0] & MMC_OCR_S18A) { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, + ("Card supports 1.8V signaling\n")); + mmcp->card_features |= CARD_FEATURE_18V; + } + } else { + CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, + ("Card not ready: %08x\n", mmcio->cmd.resp[0])); + /* Send CMD55+ACMD41 once again */ + PROBE_SET_ACTION(softc, PROBE_SEND_APP_OP_COND); + } break; } @@ -1053,21 +1067,6 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, path, done_ccb); - } - - /* Also announce each SDIO function */ - struct mmc_params *mmcp = &path->device->mmc_ident_data; - - for (int i = 0; i < mmcp->sdio_func_count; i++) { - struct cam_path *newpath; - cam_status status; - status = xpt_create_path(&newpath, NULL, - done_ccb->ccb_h.path_id, 0, i + 1); - if (status != CAM_REQ_CMP) - printf("xpt_create_path failed" - " with status %#x\n", - status); - xpt_async(AC_FOUND_DEVICE, newpath, done_ccb); } } if (softc->action == PROBE_DONE || softc->action == PROBE_INVALID) { Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Sep 15 19:17:30 2017 (r323618) +++ head/sys/conf/files Fri Sep 15 19:47:44 2017 (r323619) @@ -112,7 +112,6 @@ cam/ctl/ctl_util.c optional ctl cam/ctl/scsi_ctl.c optional ctl cam/mmc/mmc_xpt.c optional scbus mmccam cam/mmc/mmc_da.c optional scbus mmccam da -cam/mmc/mmc_sdio.c optional scbus mmccam cam/scsi/scsi_da.c optional da cam/scsi/scsi_low.c optional ncv | nsp | stg cam/scsi/scsi_pass.c optional pass Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Fri Sep 15 19:17:30 2017 (r323618) +++ head/sys/dev/mmc/host/dwmmc.c Fri Sep 15 19:47:44 2017 (r323619) @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_mmccam.h" + #include "mmcbr_if.h" #define dprintf(x, arg...) @@ -1181,4 +1183,6 @@ static devclass_t dwmmc_devclass; DRIVER_MODULE(dwmmc, simplebus, dwmmc_driver, dwmmc_devclass, NULL, NULL); DRIVER_MODULE(dwmmc, ofwbus, dwmmc_driver, dwmmc_devclass, NULL, NULL); +#ifndef MMCCAM MMC_DECLARE_BRIDGE(dwmmc); +#endif From owner-svn-src-all@freebsd.org Fri Sep 15 19:48:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0350FE05AF5; Fri, 15 Sep 2017 19:48:50 +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 D2EF175EA9; Fri, 15 Sep 2017 19:48:49 +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 v8FJmmhd038472; Fri, 15 Sep 2017 19:48:48 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FJmm27038466; Fri, 15 Sep 2017 19:48:48 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201709151948.v8FJmm27038466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 15 Sep 2017 19:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323620 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise X-SVN-Commit-Revision: 323620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 19:48:50 -0000 Author: bdrewery Date: Fri Sep 15 19:48:48 2017 New Revision: 323620 URL: https://svnweb.freebsd.org/changeset/base/323620 Log: Fix the raise tests. - The exit probe was not appropriately filtered to only the known pid so it was firing on any random process that would exit rather the only the one we cared about. - The dtest script executes the tst.raise*.exe in the background from POSIX sh without jobs control. POSIX mandates that SIGINT be set to SIG_IGN in this case. The test executable never actually tested that SIGINT could be caught despite trying to block and delay the signal. So the SIGINT sent from raise() is never actually received since it is ignored. This could be fixed by calling 'trap - INT' from dtest before running the executable but I've opted to just use SIGUSR1 instead in these specific tests rather than adding more logic to test that SIGINT is not ignored at startup. These 2 issues meant that the tests would randomly work but only if a process coincidentally exited during the test. Reviewed by: markj MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c Fri Sep 15 19:47:44 2017 (r323619) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c Fri Sep 15 19:48:48 2017 (r323620) @@ -35,13 +35,13 @@ main(int argc, char **argv) sigset_t ss; (void) sigemptyset(&ss); - (void) sigaddset(&ss, SIGINT); + (void) sigaddset(&ss, SIGUSR1); (void) sigprocmask(SIG_BLOCK, &ss, NULL); do { (void) getpid(); (void) sigpending(&ss); - } while (!sigismember(&ss, SIGINT)); + } while (!sigismember(&ss, SIGUSR1)); return (0); } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d Fri Sep 15 19:47:44 2017 (r323619) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d Fri Sep 15 19:48:48 2017 (r323620) @@ -47,7 +47,7 @@ syscall::getpid:entry /pid == $1/ { trace("raised"); - raise(SIGINT); + raise(SIGUSR1); /* * Wait no more than half a second for the process to die. */ @@ -55,6 +55,7 @@ syscall::getpid:entry } syscall::exit:entry +/pid == $1/ { exit(0); } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c Fri Sep 15 19:47:44 2017 (r323619) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c Fri Sep 15 19:48:48 2017 (r323620) @@ -45,7 +45,7 @@ main(int argc, char **argv) sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - (void) sigaction(SIGINT, &sa, NULL); + (void) sigaction(SIGUSR1, &sa, NULL); for (;;) { (void) getpid(); Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d Fri Sep 15 19:47:44 2017 (r323619) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d Fri Sep 15 19:48:48 2017 (r323620) @@ -47,7 +47,7 @@ syscall::getpid:return /pid == $1/ { trace("raised"); - raise(SIGINT); + raise(SIGUSR1); /* * Wait no more than half a second for the process to die. */ @@ -55,6 +55,7 @@ syscall::getpid:return } syscall::exit:entry +/pid == $1/ { exit(0); } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c Fri Sep 15 19:47:44 2017 (r323619) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c Fri Sep 15 19:48:48 2017 (r323620) @@ -45,7 +45,7 @@ main(int argc, char **argv) sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - (void) sigaction(SIGINT, &sa, NULL); + (void) sigaction(SIGUSR1, &sa, NULL); for (;;) { (void) getpid(); Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d Fri Sep 15 19:47:44 2017 (r323619) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d Fri Sep 15 19:48:48 2017 (r323620) @@ -47,7 +47,7 @@ syscall::getpid:entry /pid == $1/ { trace("raised"); - raise(SIGINT); + raise(SIGUSR1); /* * Wait no more than half a second for the process to die. */ @@ -55,6 +55,7 @@ syscall::getpid:entry } syscall::exit:entry +/pid == $1/ { exit(0); } From owner-svn-src-all@freebsd.org Fri Sep 15 19:56:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B6B9E061D8; Fri, 15 Sep 2017 19:56:23 +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 06F67763A6; Fri, 15 Sep 2017 19:56:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FJuMER042646; Fri, 15 Sep 2017 19:56:22 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FJuMQl042644; Fri, 15 Sep 2017 19:56:22 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201709151956.v8FJuMQl042644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Fri, 15 Sep 2017 19:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323621 - head/sys/mips/include X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: head/sys/mips/include X-SVN-Commit-Revision: 323621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 19:56:23 -0000 Author: landonf Date: Fri Sep 15 19:56:21 2017 New Revision: 323621 URL: https://svnweb.freebsd.org/changeset/base/323621 Log: Add MIPS32/64 Rev2 CP0 intctl register definitions. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D12300 Modified: head/sys/mips/include/cpufunc.h head/sys/mips/include/cpuregs.h Modified: head/sys/mips/include/cpufunc.h ============================================================================== --- head/sys/mips/include/cpufunc.h Fri Sep 15 19:48:48 2017 (r323620) +++ head/sys/mips/include/cpufunc.h Fri Sep 15 19:56:21 2017 (r323621) @@ -279,6 +279,15 @@ MIPS_RW32_COP0(entrylo1, MIPS_COP_0_TLB_LO1); MIPS_RW32_COP0(prid, MIPS_COP_0_PRID); /* XXX 64-bit? */ MIPS_RW32_COP0_SEL(ebase, MIPS_COP_0_PRID, 1); + +#if defined(CPU_MIPS24K) || defined(CPU_MIPS34K) || \ + defined(CPU_MIPS74K) || defined(CPU_MIPS1004K) || \ + defined(CPU_MIPS1074K) || defined(CPU_INTERAPTIV) || \ + defined(CPU_PROAPTIV) +/* MIPS32/64 r2 intctl */ +MIPS_RW32_COP0_SEL(intctl, MIPS_COP_0_INTCTL, 1); +#endif + #ifdef CPU_XBURST MIPS_RW32_COP0_SEL(xburst_mbox0, MIPS_COP_0_XBURST_MBOX, 0); MIPS_RW32_COP0_SEL(xburst_mbox1, MIPS_COP_0_XBURST_MBOX, 1); Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Fri Sep 15 19:48:48 2017 (r323620) +++ head/sys/mips/include/cpuregs.h Fri Sep 15 19:56:21 2017 (r323621) @@ -468,6 +468,7 @@ * 10 MIPS_COP_0_TLB_HI 3636 TLB entry high. * 11 MIPS_COP_0_COMPARE .333 Compare (against Count). * 12 MIPS_COP_0_STATUS 3333 Status register. + * 12/1 MIPS_COP_0_INTCTL ..33 Interrupt setup (MIPS32/64 r2). * 13 MIPS_COP_0_CAUSE 3333 Exception cause register. * 14 MIPS_COP_0_EXC_PC 3636 Exception PC. * 15 MIPS_COP_0_PRID 3333 Processor revision identifier. @@ -548,6 +549,7 @@ /* MIPS32/64 */ #define MIPS_COP_0_USERLOCAL _(4) /* sel 2 is userlevel register */ #define MIPS_COP_0_HWRENA _(7) +#define MIPS_COP_0_INTCTL _(12) #define MIPS_COP_0_DEBUG _(23) #define MIPS_COP_0_DEPC _(24) #define MIPS_COP_0_PERFCNT _(25) @@ -560,6 +562,16 @@ #define MIPS_MMU_TLB 0x01 /* Standard TLB */ #define MIPS_MMU_BAT 0x02 /* Standard BAT */ #define MIPS_MMU_FIXED 0x03 /* Standard fixed mapping */ + +/* + * IntCtl Register Fields + */ +#define MIPS_INTCTL_IPTI_MASK 0xE0000000 /* bits 31..29 timer intr # */ +#define MIPS_INTCTL_IPTI_SHIFT 29 +#define MIPS_INTCTL_IPPCI_MASK 0x1C000000 /* bits 26..29 perf counter intr # */ +#define MIPS_INTCTL_IPPCI_SHIFT 26 +#define MIPS_INTCTL_VS_MASK 0x000001F0 /* bits 5..9 vector spacing */ +#define MIPS_INTCTL_VS_SHIFT 4 /* * Config Register Fields From owner-svn-src-all@freebsd.org Fri Sep 15 20:05:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2739E069FB; Fri, 15 Sep 2017 20:05:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC683768E2; Fri, 15 Sep 2017 20:05:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FK5tvO046867; Fri, 15 Sep 2017 20:05:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FK5tT1046866; Fri, 15 Sep 2017 20:05:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709152005.v8FK5tT1046866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 15 Sep 2017 20:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323622 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 323622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:05:57 -0000 Author: emaste Date: Fri Sep 15 20:05:55 2017 New Revision: 323622 URL: https://svnweb.freebsd.org/changeset/base/323622 Log: open(2): update ENOTCAPABLE description for .. lookups After r308212 Capsicum permits .. lookups in capability mode, as long as path component traversal does not escape the directory corresponding to the provided file descriptor. We should add a description of the vfs.lookup_cap_dotdot and vfs.lookup_cap_dotdot_nonlocal sysctls, perhaps as a cross-reference to capsicum(4). I intend to look at that soon. Reviewed by: bjk, cem, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12343 Modified: head/lib/libc/sys/open.2 Modified: head/lib/libc/sys/open.2 ============================================================================== --- head/lib/libc/sys/open.2 Fri Sep 15 19:56:21 2017 (r323621) +++ head/lib/libc/sys/open.2 Fri Sep 15 20:05:55 2017 (r323622) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd November 22, 2016 +.Dd September 15, 2017 .Dt OPEN 2 .Os .Sh NAME @@ -487,7 +487,9 @@ is specified and the process is in capability mode. was called and the process is in capability mode. .It Bq Er ENOTCAPABLE .Fa path -is an absolute path or contained "..". +is an absolute path or contained a ".." component leading to a +directory outside of the directory hierarchy specified by +.Fa fd . .El .Sh SEE ALSO .Xr chmod 2 , From owner-svn-src-all@freebsd.org Fri Sep 15 20:12:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19F94E07036; Fri, 15 Sep 2017 20:12:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB57976E2A; Fri, 15 Sep 2017 20:12:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FKCd8D050686; Fri, 15 Sep 2017 20:12:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKCdDA050685; Fri, 15 Sep 2017 20:12:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709152012.v8FKCdDA050685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 15 Sep 2017 20:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323623 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 323623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:12:40 -0000 Author: emaste Date: Fri Sep 15 20:12:38 2017 New Revision: 323623 URL: https://svnweb.freebsd.org/changeset/base/323623 Log: rename(2): document capability mode errors Reviewed by: allanjude MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12339 Modified: head/lib/libc/sys/rename.2 Modified: head/lib/libc/sys/rename.2 ============================================================================== --- head/lib/libc/sys/rename.2 Fri Sep 15 20:05:55 2017 (r323622) +++ head/lib/libc/sys/rename.2 Fri Sep 15 20:12:38 2017 (r323623) @@ -28,7 +28,7 @@ .\" @(#)rename.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd September 15, 2017 .Dt RENAME 2 .Os .Sh NAME @@ -252,6 +252,9 @@ The .Fa to argument is a directory and is not empty. +.It Bq Er ECAPMODE +.Fn rename +was called and the process is in capability mode. .El .Pp In addition to the errors returned by the @@ -288,6 +291,26 @@ argument is not an absolute path and is neither .Dv AT_FDCWD nor a file descriptor associated with a directory. +.It Bq Er ECAPMODE +.Dv AT_FDCWD +is specified and the process is in capability mode. +.It Bq Er ENOTCAPABLE +.Fa path +is an absolute path or contained a ".." component leading to a directory +outside of the directory hierarchy specified by +.Fa fromfd +or +.Fa tofd . +.It Bq Er ENOTCAPABLE +The +.Fa fromfd +file descriptor lacks the +.Dv CAP_RENAMEAT_SOURCE +right, or the +.Fa tofd +file descriptor lacks the +.Dv CAP_RENAMEAT_TARGET +right. .El .Sh SEE ALSO .Xr chflags 2 , From owner-svn-src-all@freebsd.org Fri Sep 15 20:15:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEC1BE072B8; Fri, 15 Sep 2017 20:15:56 +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 9C92177021; Fri, 15 Sep 2017 20:15:56 +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 v8FKFtx4050863; Fri, 15 Sep 2017 20:15:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKFtn3050862; Fri, 15 Sep 2017 20:15:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709152015.v8FKFtn3050862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 15 Sep 2017 20:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323624 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 323624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:15:56 -0000 Author: imp Date: Fri Sep 15 20:15:55 2017 New Revision: 323624 URL: https://svnweb.freebsd.org/changeset/base/323624 Log: Update comments on what the CAM_IOSCHED_FLAG_TRIM_ACTIVE means. It's intended only for those situations where the periph driver ones to limit the number of trims active to one and only one. Also update comments on associated functions. Sponsored by: Netflix Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Fri Sep 15 20:12:38 2017 (r323623) +++ head/sys/cam/cam_iosched.c Fri Sep 15 20:15:55 2017 (r323624) @@ -673,7 +673,10 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) } #endif - /* Trim or similar currently pending completion */ +/* + * Trim or similar currently pending completion. Should only be set for + * those drivers wishing only one Trim active at a time. + */ #define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) /* Callout active, and needs to be torn down */ #define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) @@ -1387,7 +1390,7 @@ cam_iosched_schedule(struct cam_iosched_softc *isc, st } /* - * Complete a trim request + * Complete a trim request. Mark that we no longer have one in flight. */ void cam_iosched_trim_done(struct cam_iosched_softc *isc) @@ -1437,7 +1440,8 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc /* * Tell the io scheduler that you've pushed a trim down into the sim. - * xxx better place for this? + * This also tells the I/O scheduler not to push any more trims down, so + * some periphs do not call it if they can cope with multiple trims in flight. */ void cam_iosched_submit_trim(struct cam_iosched_softc *isc) From owner-svn-src-all@freebsd.org Fri Sep 15 20:16:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 582FFE072FF; Fri, 15 Sep 2017 20:16:07 +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 235ED770BC; Fri, 15 Sep 2017 20:16: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 v8FKG6Gb050923; Fri, 15 Sep 2017 20:16:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKG675050922; Fri, 15 Sep 2017 20:16:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709152016.v8FKG675050922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 15 Sep 2017 20:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323625 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 323625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:16:07 -0000 Author: imp Date: Fri Sep 15 20:16:06 2017 New Revision: 323625 URL: https://svnweb.freebsd.org/changeset/base/323625 Log: Allow multiple TRIMs to be done for nda Don't call cam_iosched_trim_done or cam_iosched_submit_trim for nda since its hardware can handle almost an arbitrary number of TRIMs and we don't have to be careful to only ever do one. Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Fri Sep 15 20:15:55 2017 (r323624) +++ head/sys/cam/nvme/nvme_da.c Fri Sep 15 20:16:06 2017 (r323625) @@ -920,7 +920,12 @@ ndastart(struct cam_periph *periph, union ccb *start_c nda_nvme_trim(softc, &start_ccb->nvmeio, dsm_range, 1); start_ccb->ccb_h.ccb_state = NDA_CCB_TRIM; start_ccb->ccb_h.flags |= CAM_UNLOCKED; - cam_iosched_submit_trim(softc->cam_iosched); /* XXX */ + /* + * Note: We can have multiple TRIMs in flight, so we don't call + * cam_iosched_submit_trim(softc->cam_iosched); + * since that forces the I/O scheduler to only schedule one at a time. + * On NVMe drives, this is a performance disaster. + */ goto out; } case BIO_FLUSH: @@ -1013,7 +1018,11 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb TAILQ_INIT(&queue); TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue); #endif - cam_iosched_trim_done(softc->cam_iosched); + /* + * Since we can have multiple trims in flight, we don't + * need to call this here. + * cam_iosched_trim_done(softc->cam_iosched); + */ ndaschedule(periph); cam_periph_unlock(periph); #ifdef notyet From owner-svn-src-all@freebsd.org Fri Sep 15 20:34:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E482CE085BC; Fri, 15 Sep 2017 20:34:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B21A17C19A; Fri, 15 Sep 2017 20:34:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FKYqo1059614; Fri, 15 Sep 2017 20:34:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKYqKh059613; Fri, 15 Sep 2017 20:34:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709152034.v8FKYqKh059613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 15 Sep 2017 20:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323626 - head/usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/tcpdrop X-SVN-Commit-Revision: 323626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:34:54 -0000 Author: tuexen Date: Fri Sep 15 20:34:52 2017 New Revision: 323626 URL: https://svnweb.freebsd.org/changeset/base/323626 Log: Add references. Suggested by Maxim Konovalov. Sponsored by: Netflix, Inc. Modified: head/usr.sbin/tcpdrop/tcpdrop.8 Modified: head/usr.sbin/tcpdrop/tcpdrop.8 ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.8 Fri Sep 15 20:16:06 2017 (r323625) +++ head/usr.sbin/tcpdrop/tcpdrop.8 Fri Sep 15 20:34:52 2017 (r323626) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2017 +.Dd September 15, 2017 .Dt TCPDROP 8 .Os .Sh NAME @@ -172,7 +172,10 @@ LAST_ACK state use: .Ed .Sh SEE ALSO .Xr netstat 1 , -.Xr sockstat 1 +.Xr sockstat 1 , +.Xr tcp 4 , +.Xr tcp_functions 9 + .Sh AUTHORS .An Markus Friedl Aq Mt markus@openbsd.org .An Juli Mallett Aq Mt jmallett@FreeBSD.org From owner-svn-src-all@freebsd.org Fri Sep 15 20:35:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D44DE08659; Fri, 15 Sep 2017 20:35:36 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 224CB7C2F3; Fri, 15 Sep 2017 20:35:36 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [IPv6:2003:cd:6be7:6700:88e4:d136:c842:ed69] (p200300CD6BE7670088E4D136C842ED69.dip0.t-ipconnect.de [IPv6:2003:cd:6be7:6700:88e4:d136:c842:ed69]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id BB6D9721E281A; Fri, 15 Sep 2017 22:35:22 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r323493 - head/usr.sbin/tcpdrop From: Michael Tuexen In-Reply-To: Date: Fri, 15 Sep 2017 22:35:21 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <90B04FAA-C92B-45E2-A917-7AD8160F9720@freebsd.org> References: <201709121339.v8CDdiWH036958@repo.freebsd.org> To: Maxim Konovalov X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:35:36 -0000 > On 15. Sep 2017, at 10:10, Maxim Konovalov = wrote: >=20 > Hi Michael, >=20 > On Tue, 12 Sep 2017, 13:39-0000, Michael Tuexen wrote: >=20 >> Author: tuexen >> Date: Tue Sep 12 13:39:44 2017 >> New Revision: 323493 >> URL: https://svnweb.freebsd.org/changeset/base/323493 >>=20 >> Log: >> Allow TCP connections to be filtered by stack and state. >>=20 >> Choose the command line options to be consistent with the ones of >> sockstat. >>=20 > Makes sense? Yes. Also added a reference to TCP in r323626. Thanks for the suggestion. Best regards Michael >=20 > Index: tcpdrop.8 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tcpdrop.8 (revision 323607) > +++ tcpdrop.8 (working copy) > @@ -172,7 +172,8 @@ LAST_ACK state use: > .Ed > .Sh SEE ALSO > .Xr netstat 1 , > -.Xr sockstat 1 > +.Xr sockstat 1 , > +.Xr tcp_functions 9 > .Sh AUTHORS > .An Markus Friedl Aq Mt markus@openbsd.org > .An Juli Mallett Aq Mt jmallett@FreeBSD.org >=20 > --=20 > Maxim Konovalov From owner-svn-src-all@freebsd.org Fri Sep 15 20:41:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA286E08B76; Fri, 15 Sep 2017 20:41:13 +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 87E617C6FE; Fri, 15 Sep 2017 20:41:13 +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 v8FKfCQB059907; Fri, 15 Sep 2017 20:41:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKfCgg059906; Fri, 15 Sep 2017 20:41:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709152041.v8FKfCgg059906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 15 Sep 2017 20:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323627 - head/usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.sbin/tcpdrop X-SVN-Commit-Revision: 323627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:41:13 -0000 Author: tuexen Date: Fri Sep 15 20:41:12 2017 New Revision: 323627 URL: https://svnweb.freebsd.org/changeset/base/323627 Log: Remove empty line accidently introduced in r323626. Modified: head/usr.sbin/tcpdrop/tcpdrop.8 Modified: head/usr.sbin/tcpdrop/tcpdrop.8 ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.8 Fri Sep 15 20:34:52 2017 (r323626) +++ head/usr.sbin/tcpdrop/tcpdrop.8 Fri Sep 15 20:41:12 2017 (r323627) @@ -175,7 +175,6 @@ LAST_ACK state use: .Xr sockstat 1 , .Xr tcp 4 , .Xr tcp_functions 9 - .Sh AUTHORS .An Markus Friedl Aq Mt markus@openbsd.org .An Juli Mallett Aq Mt jmallett@FreeBSD.org From owner-svn-src-all@freebsd.org Fri Sep 15 20:46:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19D22E08FB3; Fri, 15 Sep 2017 20:46:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDB507CC94; Fri, 15 Sep 2017 20:46:52 +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 v8FKkqPq063665; Fri, 15 Sep 2017 20:46:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKkqi7063664; Fri, 15 Sep 2017 20:46:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709152046.v8FKkqi7063664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 15 Sep 2017 20:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323628 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 323628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:46:53 -0000 Author: tuexen Date: Fri Sep 15 20:46:51 2017 New Revision: 323628 URL: https://svnweb.freebsd.org/changeset/base/323628 Log: Remove tailing whitespace. Modified: head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Fri Sep 15 20:41:12 2017 (r323627) +++ head/usr.bin/sockstat/sockstat.c Fri Sep 15 20:46:51 2017 (r323628) @@ -535,7 +535,7 @@ gather_sctp(void) "address family %d not supported", xraddr->address.sa.sa_family); } - faddr->encaps_port = xraddr->encaps_port; + faddr->encaps_port = xraddr->encaps_port; faddr->state = xraddr->state; faddr->next = NULL; if (prev_faddr == NULL) From owner-svn-src-all@freebsd.org Fri Sep 15 20:58:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A57AE09AB4; Fri, 15 Sep 2017 20:58:53 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A0F47D4FB; Fri, 15 Sep 2017 20:58:53 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8FKwqgG067801; Fri, 15 Sep 2017 20:58:52 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FKwqes067799; Fri, 15 Sep 2017 20:58:52 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201709152058.v8FKwqes067799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 15 Sep 2017 20:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323629 - 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: 323629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 20:58:53 -0000 Author: scottl Date: Fri Sep 15 20:58:52 2017 New Revision: 323629 URL: https://svnweb.freebsd.org/changeset/base/323629 Log: Fix line wrap issues. Sponsored by: Netflix Modified: head/sys/dev/mpr/mpr_pci.c head/sys/dev/mps/mps_pci.c Modified: head/sys/dev/mpr/mpr_pci.c ============================================================================== --- head/sys/dev/mpr/mpr_pci.c Fri Sep 15 20:46:51 2017 (r323628) +++ head/sys/dev/mpr/mpr_pci.c Fri Sep 15 20:58:52 2017 (r323629) @@ -269,8 +269,8 @@ mpr_pci_alloc_interrupts(struct mpr_softc *sc) msgs = min(msgs, MPR_MSIX_MAX); msgs = min(msgs, 1); /* XXX */ if (msgs != 0) { - mpr_dprint(sc, MPR_INIT, "Attempting to allocate %d MSI-X " - "messages\n", msgs); + mpr_dprint(sc, MPR_INIT, "Attempting to allocate %d " + "MSI-X messages\n", msgs); error = mpr_alloc_msix(sc, msgs); } } @@ -279,8 +279,8 @@ mpr_pci_alloc_interrupts(struct mpr_softc *sc) mpr_dprint(sc, MPR_INIT, "Counted %d MSI messages\n", msgs); msgs = min(msgs, MPR_MSI_MAX); if (msgs != 0) { - mpr_dprint(sc, MPR_INIT, "Attempting to allocated %d MSI " - "messages\n", MPR_MSI_MAX); + mpr_dprint(sc, MPR_INIT, "Attempting to allocated %d " + "MSI messages\n", MPR_MSI_MAX); error = mpr_alloc_msi(sc, MPR_MSI_MAX); } } Modified: head/sys/dev/mps/mps_pci.c ============================================================================== --- head/sys/dev/mps/mps_pci.c Fri Sep 15 20:46:51 2017 (r323628) +++ head/sys/dev/mps/mps_pci.c Fri Sep 15 20:58:52 2017 (r323629) @@ -254,8 +254,8 @@ mps_pci_alloc_interrupts(struct mps_softc *sc) msgs = min(msgs, MPS_MSIX_MAX); msgs = min(msgs, 1); /* XXX */ if (msgs != 0) { - mps_dprint(sc, MPS_INIT, "Attempting to allocate %d MSI-X " - "messages\n", msgs); + mps_dprint(sc, MPS_INIT, "Attempting to allocate %d " + "MSI-X messages\n", msgs); error = mps_alloc_msix(sc, msgs); } } @@ -264,8 +264,8 @@ mps_pci_alloc_interrupts(struct mps_softc *sc) mps_dprint(sc, MPS_INIT, "Counted %d MSI messages\n", msgs); msgs = min(msgs, MPS_MSI_MAX); if (msgs != 0) { - mps_dprint(sc, MPS_INIT, "Attempting to allocate %d MSI " - "messages\n", MPS_MSI_MAX); + mps_dprint(sc, MPS_INIT, "Attempting to allocate %d " + "MSI messages\n", MPS_MSI_MAX); error = mps_alloc_msi(sc, MPS_MSI_MAX); } } From owner-svn-src-all@freebsd.org Fri Sep 15 21:31:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36C31E0B778; Fri, 15 Sep 2017 21:31:13 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA1307E69B; Fri, 15 Sep 2017 21:31:12 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 89B2F20BD8; Fri, 15 Sep 2017 17:31:10 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 15 Sep 2017 17:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=qnN3F6dL9F7Ac4IS4D TZeR2XG3/V1RBHmV2hQYvg67w=; b=Ky4nwUcFk6tm1wFVUwk1rPJniord9q+Z+A mfzp2wo2DVw0G1jX8cwf82UI5E3aAnglfNM0eyLARuv10uOQVOvMpdSqjh6RVXJ6 7qEEj245cm8mfi+xHeBjBGzlssUebQB5ZzjSD0GaXtDt6hXYvDGVkpTgaPObhKXl P0WP2+mL6x9z33lag89bDJngvxAtdnnTZk2qiET46hVg0QRFTx0imf/4KVBFObIi il5HGxHMJrvnzvVBBbbjj5D+mrZZSm8dQe19Ylm0+t7wqxaRBpzVI2hT9g4fkK2o 20HqJCzKAW76myhQT4r/XIkHIu16p9r4MP2jTi0fD/l+GKWSySMg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=qnN3F6dL9F7Ac4IS4DTZeR2XG3/V1RBHmV2hQYvg67w=; b=mJAiOVdJ sqkXJcxeWKjB10lcqbLozczQHCw56vx/tEfswHqE8BkFikdAR6hka4PxDOgG/8Nf DQhqKRdXy7Vh8DsQlGoXFeEXcqQ/lfY4BIm0HElJYGFZTQGaFwL8DO637zlgLmW4 DZXYRwUvc4wpAFUm/dMvJovLvDfzM9dHnJSUWQOeHM7jk6lO2o3kdZQ51qsTiqL5 yeWIlzq408q58+Hdcy6+WC+I5it46EpTWqguM9dkbkZWIliWIRyovV0JeWwzl4hf YgjYQtkF7tUmdKe0RpdPmm/7Us6O2dzyQSzowCOrL7tf6OGEMoGZHe/vH72CXT05 hoV6nqhOHR3A5w== X-ME-Sender: X-Sasl-enc: 3jOBROD6xFXshRT2t6nZjho11bgZysd9Ixj65o93PwP2 1505511070 Received: from [192.168.0.117] (unknown [161.97.249.191]) by mail.messagingengine.com (Postfix) with ESMTPA id BBCDF7F955; Fri, 15 Sep 2017 17:31:09 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys From: Scott Long In-Reply-To: <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> Date: Fri, 15 Sep 2017 15:31:07 -0600 Cc: Cy Schubert , Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1EBD0641-002D-409C-B18E-AAB5FCDECEBA@samsco.org> References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> To: Sean Bruno , Stephen Hurd X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 21:31:13 -0000 > On Sep 13, 2017, at 9:12 AM, Sean Bruno wrote: >=20 >>>> #blamebruno >>>>=20 >>>> Reviewed by: sbruno >>>> Approved by: sbruno (mentor) >>>> Sponsored by: Limelight Networks >>>> Differential Revision: https://reviews.freebsd.org/D12235 >>>=20 >>> *gasps at the LoC count and number of changed drivers* >>>=20 >>> Could someone please better break this up in the future..? >>=20 >> Agreed. Down the road parsing out individual commits in this jumbo = commit=20 >> will be difficult to parse. IMO this may as well have simply been, = import=20 >> from https://github.com/mattmacy/networking/, just like Mr. Torvalds = does=20 >> at kernel.org. I expect to see a commit like this there but not here. = Can=20 >> we break this down to its functional commits? >>=20 >>=20 >=20 >=20 > This ridiculous loc was due to the amount of restructuring needed to = get > us back to being in sync with our development. The future will not = have > this big of a commit/change and should be more bite/fun sized. >=20 > The #blamebruno tag in the commit log was to indicate that this was = not > something Stephen was doing on his own, but was something that I had > induced over the last few months during testing. >=20 This breaks my system. I prior to this commit, I had igb0 and igb1. = Now I only have igb0, and it=E2=80=99s like igb1 isn=E2=80=99t even trying to = attach. Unfortunately, this breaks my nfsroot setup, so I need to roll back my tree. Please = let me know if there=E2=80=99s anything I can provide to help debugging. Scott From owner-svn-src-all@freebsd.org Fri Sep 15 22:40:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94291E0EC9E; Fri, 15 Sep 2017 22:40:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63406805F1; Fri, 15 Sep 2017 22:40: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 v8FMev38009108; Fri, 15 Sep 2017 22:40:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FMevvt009106; Fri, 15 Sep 2017 22:40:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709152240.v8FMevvt009106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Sep 2017 22:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323630 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 323630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 22:40:58 -0000 Author: jhb Date: Fri Sep 15 22:40:57 2017 New Revision: 323630 URL: https://svnweb.freebsd.org/changeset/base/323630 Log: Avoid reusing the wrong buffer for a DDP AIO request. To optimize the case of ping-ponging between two buffers, the DDP code caches the last two buffers used keeping the pages wired and page pods stored in the NIC's RAM. If a new aio_read() request uses one of the same buffers, then the work of holding pages, etc. can be avoided. However, the starting virtual address of an aio buffer was not saved, only the page count, length, and initial page offset. Thus, an aio_read() request could match a different buffer in the address space. (Earlier during development vm_fault_hold_quick_pages() was always called and the vm_page_t values were compared, but that was eventually removed without being adequately replaced.) Fix by storing the starting virtual address and comparing that (along with other fields) to determine if a buffer can be reused. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Fri Sep 15 20:58:52 2017 (r323629) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Fri Sep 15 22:40:57 2017 (r323630) @@ -1277,7 +1277,8 @@ pscmp(struct pageset *ps, struct vmspace *vm, vm_offse int pgoff, int len) { - if (ps->npages != npages || ps->offset != pgoff || ps->len != len) + if (ps->start != start || ps->npages != npages || + ps->offset != pgoff || ps->len != len) return (1); return (ps->vm != vm || ps->vm_timestamp != vm->vm_map.timestamp); @@ -1378,6 +1379,7 @@ hold_aio(struct toepcb *toep, struct kaiocb *job, stru ps->len = job->uaiocb.aio_nbytes; atomic_add_int(&vm->vm_refcnt, 1); ps->vm = vm; + ps->start = start; CTR5(KTR_CXGBE, "%s: tid %d, new pageset %p for job %p, npages %d", __func__, toep->tid, ps, job, ps->npages); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Sep 15 20:58:52 2017 (r323629) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Sep 15 22:40:57 2017 (r323630) @@ -112,6 +112,7 @@ struct pageset { int len; struct ppod_reservation prsv; struct vmspace *vm; + vm_offset_t start; u_int vm_timestamp; }; From owner-svn-src-all@freebsd.org Fri Sep 15 22:55:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EE1CE0F9DE; Fri, 15 Sep 2017 22:55: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 EC97780D60; Fri, 15 Sep 2017 22:55: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 v8FMtFm4016823; Fri, 15 Sep 2017 22:55:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FMtFJv016817; Fri, 15 Sep 2017 22:55:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709152255.v8FMtFJv016817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Sep 2017 22:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323631 - head/usr.bin/getconf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.bin/getconf X-SVN-Commit-Revision: 323631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 22:55:17 -0000 Author: jhb Date: Fri Sep 15 22:55:15 2017 New Revision: 323631 URL: https://svnweb.freebsd.org/changeset/base/323631 Log: Add an -a flag to getconf. When -a is specified, the name and value of all system or path configuration values is reported to standard output. Reviewed by: kib (earlier version) MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D12373 Modified: head/usr.bin/getconf/confstr.gperf head/usr.bin/getconf/getconf.1 head/usr.bin/getconf/getconf.c head/usr.bin/getconf/getconf.h head/usr.bin/getconf/pathconf.gperf head/usr.bin/getconf/sysconf.gperf Modified: head/usr.bin/getconf/confstr.gperf ============================================================================== --- head/usr.bin/getconf/confstr.gperf Fri Sep 15 22:40:57 2017 (r323630) +++ head/usr.bin/getconf/confstr.gperf Fri Sep 15 22:55:15 2017 (r323631) @@ -68,3 +68,14 @@ find_confstr(const char *name, int *key) } return 0; } + +void +foreach_confstr(void (*func)(const char *, int)) +{ + const struct map *mp; + + for (mp = wordlist; mp->name != NULL; mp++) { + if (mp->valid) + func(mp->name, mp->key); + } +} Modified: head/usr.bin/getconf/getconf.1 ============================================================================== --- head/usr.bin/getconf/getconf.1 Fri Sep 15 22:40:57 2017 (r323630) +++ head/usr.bin/getconf/getconf.1 Fri Sep 15 22:55:15 2017 (r323631) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 8, 2016 +.Dd September 15, 2017 .Dt GETCONF 1 .Os .Sh NAME @@ -36,6 +36,9 @@ .Nd retrieve standard configuration variables .Sh SYNOPSIS .Nm +.Fl a +.Op Ar file +.Nm .Op Fl v Ar environment .Ar path_var .Ar file @@ -45,20 +48,35 @@ .Sh DESCRIPTION The .Nm -utility prints the value of a +utility prints the values of .Tn POSIX or .Tn X/Open -path or system configuration variable to the standard output. -If the specified variable is undefined, the string +path or system configuration variables to the standard output. +If a variable is undefined, the string .Dq Li undefined is output. .Pp -The first form of the command, with two mandatory +The first form of the command displays all of the path or system configuration +variables to standard output. +If +.Ar file +is provided, +all path configuration variables are reported for +.Ar file +using +.Xr pathconf 2 . +Otherwise, +all system configuration variables are reported using +.Xr confstr 3 +and +.Xr sysconf 3. +.Pp +The second form of the command, with two mandatory arguments, retrieves file- and file system-specific configuration variables using .Xr pathconf 2 . -The second form, with a single argument, retrieves system +The third form, with a single argument, retrieves system configuration variables using .Xr confstr 3 and Modified: head/usr.bin/getconf/getconf.c ============================================================================== --- head/usr.bin/getconf/getconf.c Fri Sep 15 22:40:57 2017 (r323630) +++ head/usr.bin/getconf/getconf.c Fri Sep 15 22:55:15 2017 (r323631) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -41,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include "getconf.h" +static void do_allsys(void); +static void do_allpath(const char *path); static void do_confstr(const char *name, int key); static void do_sysconf(const char *name, int key); static void do_pathconf(const char *name, int key, const char *path); @@ -49,7 +52,8 @@ static void usage(void) { fprintf(stderr, -"usage: getconf [-v prog_env] system_var\n" +"usage: getconf -a [pathname]\n" +" getconf [-v prog_env] system_var\n" " getconf [-v prog_env] path_var pathname\n"); exit(EX_USAGE); } @@ -57,13 +61,18 @@ usage(void) int main(int argc, char **argv) { + bool aflag; int c, key, valid; const char *name, *vflag, *alt_path; intmax_t limitval; + aflag = false; vflag = NULL; - while ((c = getopt(argc, argv, "v:")) != -1) { + while ((c = getopt(argc, argv, "av:")) != -1) { switch (c) { + case 'a': + aflag = true; + break; case 'v': vflag = optarg; break; @@ -73,6 +82,16 @@ main(int argc, char **argv) } } + if (aflag) { + if (vflag != NULL) + usage(); + if (argv[optind] == NULL) + do_allsys(); + else + do_allpath(argv[optind]); + return (0); + } + if ((name = argv[optind]) == NULL) usage(); @@ -133,6 +152,77 @@ main(int argc, char **argv) name); } return 0; +} + +static void +do_onestr(const char *name, int key) +{ + size_t len; + + errno = 0; + len = confstr(key, 0, 0); + if (len == 0 && errno != 0) { + warn("confstr: %s", name); + return; + } + printf("%s: ", name); + if (len == 0) + printf("undefined\n"); + else { + char buf[len + 1]; + + confstr(key, buf, len); + printf("%s\n", buf); + } +} + +static void +do_onesys(const char *name, int key) +{ + long value; + + errno = 0; + value = sysconf(key); + if (value == -1 && errno != 0) { + warn("sysconf: %s", name); + return; + } + printf("%s: ", name); + if (value == -1) + printf("undefined\n"); + else + printf("%ld\n", value); +} + +static void +do_allsys(void) +{ + + foreach_confstr(do_onestr); + foreach_sysconf(do_onesys); +} + +static void +do_onepath(const char *name, int key, const char *path) +{ + long value; + + errno = 0; + value = pathconf(path, key); + if (value == -1 && errno != EINVAL && errno != 0) + warn("pathconf: %s", name); + printf("%s: ", name); + if (value == -1) + printf("undefined\n"); + else + printf("%ld\n", value); +} + +static void +do_allpath(const char *path) +{ + + foreach_pathconf(do_onepath, path); } static void Modified: head/usr.bin/getconf/getconf.h ============================================================================== --- head/usr.bin/getconf/getconf.h Fri Sep 15 22:40:57 2017 (r323630) +++ head/usr.bin/getconf/getconf.h Fri Sep 15 22:55:15 2017 (r323631) @@ -41,3 +41,7 @@ int find_limit(const char *name, intmax_t *value); int find_pathconf(const char *name, int *key); int find_progenv(const char *name, const char **alt_path); int find_sysconf(const char *name, int *key); +void foreach_confstr(void (*func)(const char *, int)); +void foreach_pathconf(void (*func)(const char *, int, const char *), + const char *path); +void foreach_sysconf(void (*func)(const char *, int)); Modified: head/usr.bin/getconf/pathconf.gperf ============================================================================== --- head/usr.bin/getconf/pathconf.gperf Fri Sep 15 22:40:57 2017 (r323630) +++ head/usr.bin/getconf/pathconf.gperf Fri Sep 15 22:55:15 2017 (r323631) @@ -68,3 +68,15 @@ find_pathconf(const char *name, int *key) } return 0; } + +void +foreach_pathconf(void (*func)(const char *, int, const char *), + const char *path) +{ + const struct map *mp; + + for (mp = wordlist; mp->name != NULL; mp++) { + if (mp->valid) + func(mp->name, mp->key, path); + } +} Modified: head/usr.bin/getconf/sysconf.gperf ============================================================================== --- head/usr.bin/getconf/sysconf.gperf Fri Sep 15 22:40:57 2017 (r323630) +++ head/usr.bin/getconf/sysconf.gperf Fri Sep 15 22:55:15 2017 (r323631) @@ -147,3 +147,14 @@ find_sysconf(const char *name, int *key) } return 0; } + +void +foreach_sysconf(void (*func)(const char *, int)) +{ + const struct map *mp; + + for (mp = wordlist; mp->name != NULL; mp++) { + if (mp->valid) + func(mp->name, mp->key); + } +} From owner-svn-src-all@freebsd.org Fri Sep 15 22:56:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE226E0FB10; Fri, 15 Sep 2017 22:56:40 +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 8BFD480ED9; Fri, 15 Sep 2017 22:56:40 +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 v8FMudVg016907; Fri, 15 Sep 2017 22:56:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8FMudhu016906; Fri, 15 Sep 2017 22:56:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201709152256.v8FMudhu016906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Sep 2017 22:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323632 - head/contrib/elftoolchain/readelf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 323632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 22:56:40 -0000 Author: jhb Date: Fri Sep 15 22:56:39 2017 New Revision: 323632 URL: https://svnweb.freebsd.org/changeset/base/323632 Log: Add missing newline after unknown MIPS-specific dynamic entries. Reviewed by: emaste Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D12384 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Fri Sep 15 22:55:15 2017 (r323631) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Sep 15 22:56:39 2017 (r323632) @@ -2695,6 +2695,9 @@ dump_arch_dyn_val(struct readelf *re, GElf_Dyn *dyn) case DT_MIPS_TIME_STAMP: printf(" %s\n", timestamp(dyn->d_un.d_val)); break; + default: + printf("\n"); + break; } break; default: From owner-svn-src-all@freebsd.org Sat Sep 16 02:10:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E168CE1BA8E; Sat, 16 Sep 2017 02:10:37 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B09522024; Sat, 16 Sep 2017 02:10:37 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8G2AaFu094062; Sat, 16 Sep 2017 02:10:36 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8G2Aagv094061; Sat, 16 Sep 2017 02:10:36 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201709160210.v8G2Aagv094061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Sat, 16 Sep 2017 02:10:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323633 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 323633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 02:10:38 -0000 Author: mjoras Date: Sat Sep 16 02:10:36 2017 New Revision: 323633 URL: https://svnweb.freebsd.org/changeset/base/323633 Log: MFC r323513: Allow vlan interfaces to rx through netmap(4). Modified: stable/11/sys/net/if_vlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_vlan.c ============================================================================== --- stable/11/sys/net/if_vlan.c Fri Sep 15 22:56:39 2017 (r323632) +++ stable/11/sys/net/if_vlan.c Sat Sep 16 02:10:36 2017 (r323633) @@ -1376,7 +1376,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) VLAN_RUNLOCK(); /* Pass it back through the parent's input routine. */ - (*ifp->if_input)(ifv->ifv_ifp, m); + (*ifv->ifv_ifp->if_input)(ifv->ifv_ifp, m); } static void From owner-svn-src-all@freebsd.org Sat Sep 16 02:32:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4B60E1D9C4; Sat, 16 Sep 2017 02:32:01 +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 93FDF3382; Sat, 16 Sep 2017 02:32:01 +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 v8G2W0O8006038; Sat, 16 Sep 2017 02:32:00 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8G2W0PW006037; Sat, 16 Sep 2017 02:32:00 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201709160232.v8G2W0PW006037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 16 Sep 2017 02:32:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323634 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 323634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 02:32:01 -0000 Author: glebius Date: Sat Sep 16 02:32:00 2017 New Revision: 323634 URL: https://svnweb.freebsd.org/changeset/base/323634 Log: Merge r323552: Fix two issues with not ready data in sockets (read: sendfile) in UNIX sockets. o Check that socket is still connected in uipc_ready(). If not we are responsible to free mbufs. o In uipc_send() if socket appears to be disconnected, but we are sending data with pending I/Os, don't free mbufs. PR: 222259 Modified: stable/11/sys/kern/uipc_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/uipc_usrreq.c ============================================================================== --- stable/11/sys/kern/uipc_usrreq.c Sat Sep 16 02:10:36 2017 (r323633) +++ stable/11/sys/kern/uipc_usrreq.c Sat Sep 16 02:32:00 2017 (r323634) @@ -1056,7 +1056,11 @@ uipc_send(struct socket *so, int flags, struct mbuf *m release: if (control != NULL) m_freem(control); - if (m != NULL) + /* + * In case of PRUS_NOTREADY, uipc_ready() is responsible + * for freeing memory. + */ + if (m != NULL && (flags & PRUS_NOTREADY) == 0) m_freem(m); return (error); } @@ -1071,7 +1075,12 @@ uipc_ready(struct socket *so, struct mbuf *m, int coun unp = sotounpcb(so); UNP_LINK_RLOCK(); - unp2 = unp->unp_conn; + if ((unp2 = unp->unp_conn) == NULL) { + UNP_LINK_RUNLOCK(); + for (int i = 0; i < count; i++) + m = m_free(m); + return (ECONNRESET); + } UNP_PCB_LOCK(unp2); so2 = unp2->unp_socket; From owner-svn-src-all@freebsd.org Sat Sep 16 02:41:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 344D9E1E404; Sat, 16 Sep 2017 02:41:41 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E30CD3954; Sat, 16 Sep 2017 02:41:40 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8G2feiQ008808; Sat, 16 Sep 2017 02:41:40 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8G2fdGN008798; Sat, 16 Sep 2017 02:41:39 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201709160241.v8G2fdGN008798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Sat, 16 Sep 2017 02:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323635 - in head/sys: dev/bnxt dev/e1000 kern net sys X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in head/sys: dev/bnxt dev/e1000 kern net sys X-SVN-Commit-Revision: 323635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 02:41:41 -0000 Author: shurd Date: Sat Sep 16 02:41:38 2017 New Revision: 323635 URL: https://svnweb.freebsd.org/changeset/base/323635 Log: Revert r323516 (iflib rollup) This was really too big of a commit even if everything worked, but there are multiple new issues introduced in the one huge commit, so it's not worth keeping this until it's fixed. I'll work on splitting this up into logical chunks and introduce them one at a time over the next week or two. Approved by: sbruno (mentor) Sponsored by: Limelight Networks Modified: head/sys/dev/bnxt/if_bnxt.c head/sys/dev/e1000/e1000_80003es2lan.c head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/e1000_82575.c head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_i210.c head/sys/dev/e1000/e1000_i210.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_mac.h head/sys/dev/e1000/e1000_osdep.h head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/net/iflib.h head/sys/net/mp_ring.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/bnxt/if_bnxt.c Sat Sep 16 02:41:38 2017 (r323635) @@ -1640,8 +1640,7 @@ bnxt_msix_intr_assign(if_ctx_t ctx, int msix) } for (i=0; iscctx->isc_ntxqsets; i++) - /* TODO: Benchmark and see if tying to the RX irqs helps */ - iflib_softirq_alloc_generic(ctx, -1, IFLIB_INTR_TX, NULL, i, + iflib_softirq_alloc_generic(ctx, i + 1, IFLIB_INTR_TX, NULL, i, "tx_cp"); return rc; Modified: head/sys/dev/e1000/e1000_80003es2lan.c ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_80003es2lan.c Sat Sep 16 02:41:38 2017 (r323635) @@ -59,6 +59,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw); +static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); @@ -67,6 +68,7 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e10 static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); +static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw); static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw); @@ -297,7 +299,7 @@ static s32 e1000_acquire_phy_80003es2lan(struct e1000_ DEBUGFUNC("e1000_acquire_phy_80003es2lan"); mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; - return e1000_acquire_swfw_sync(hw, mask); + return e1000_acquire_swfw_sync_80003es2lan(hw, mask); } /** @@ -313,7 +315,7 @@ static void e1000_release_phy_80003es2lan(struct e1000 DEBUGFUNC("e1000_release_phy_80003es2lan"); mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; - e1000_release_swfw_sync(hw, mask); + e1000_release_swfw_sync_80003es2lan(hw, mask); } /** @@ -331,7 +333,7 @@ static s32 e1000_acquire_mac_csr_80003es2lan(struct e1 mask = E1000_SWFW_CSR_SM; - return e1000_acquire_swfw_sync(hw, mask); + return e1000_acquire_swfw_sync_80003es2lan(hw, mask); } /** @@ -348,7 +350,7 @@ static void e1000_release_mac_csr_80003es2lan(struct e mask = E1000_SWFW_CSR_SM; - e1000_release_swfw_sync(hw, mask); + e1000_release_swfw_sync_80003es2lan(hw, mask); } /** @@ -363,14 +365,14 @@ static s32 e1000_acquire_nvm_80003es2lan(struct e1000_ DEBUGFUNC("e1000_acquire_nvm_80003es2lan"); - ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); + ret_val = e1000_acquire_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); if (ret_val) return ret_val; ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) - e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); return ret_val; } @@ -386,7 +388,78 @@ static void e1000_release_nvm_80003es2lan(struct e1000 DEBUGFUNC("e1000_release_nvm_80003es2lan"); e1000_release_nvm_generic(hw); - e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); +} + +/** + * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Acquire the SW/FW semaphore to access the PHY or NVM. The mask + * will also specify which port we're acquiring the lock for. + **/ +static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + u32 fwmask = mask << 16; + s32 i = 0; + s32 timeout = 50; + + DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); + + while (i < timeout) { + if (e1000_get_hw_semaphore_generic(hw)) + return -E1000_ERR_SWFW_SYNC; + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + if (!(swfw_sync & (fwmask | swmask))) + break; + + /* Firmware currently using resource (fwmask) + * or other software thread using resource (swmask) + */ + e1000_put_hw_semaphore_generic(hw); + msec_delay_irq(5); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); + return -E1000_ERR_SWFW_SYNC; + } + + swfw_sync |= swmask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); + + return E1000_SUCCESS; +} + +/** + * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Release the SW/FW semaphore used to access the PHY or NVM. The mask + * will also specify which port we're releasing the lock for. + **/ +static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + + DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); + + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) + ; /* Empty */ + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + swfw_sync &= ~mask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); } /** Modified: head/sys/dev/e1000/e1000_82571.c ============================================================================== --- head/sys/dev/e1000/e1000_82571.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_82571.c Sat Sep 16 02:41:38 2017 (r323635) @@ -70,8 +70,11 @@ static s32 e1000_check_for_serdes_link_82571(struct e static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data); static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw); static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, @@ -122,8 +125,8 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw phy->ops.get_cable_length = e1000_get_cable_length_igp_2; phy->ops.read_reg = e1000_read_phy_reg_igp; phy->ops.write_reg = e1000_write_phy_reg_igp; - phy->ops.acquire = e1000_get_hw_semaphore; - phy->ops.release = e1000_put_hw_semaphore; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; break; case e1000_82573: phy->type = e1000_phy_m88; @@ -135,11 +138,12 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.read_reg = e1000_read_phy_reg_m88; phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.acquire = e1000_get_hw_semaphore; - phy->ops.release = e1000_put_hw_semaphore; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; break; case e1000_82574: case e1000_82583: + E1000_MUTEX_INIT(&hw->dev_spec._82571.swflag_mutex); phy->type = e1000_phy_bm; phy->ops.get_cfg_done = e1000_get_cfg_done_generic; @@ -502,21 +506,99 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) } /** - * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore + * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore * @hw: pointer to the HW structure * + * Acquire the HW semaphore to access the PHY or NVM + **/ +static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) +{ + u32 swsm; + s32 sw_timeout = hw->nvm.word_size + 1; + s32 fw_timeout = hw->nvm.word_size + 1; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_82571"); + + /* If we have timedout 3 times on trying to acquire + * the inter-port SMBI semaphore, there is old code + * operating on the other port, and it is not + * releasing SMBI. Modify the number of times that + * we try for the semaphore to interwork with this + * older code. + */ + if (hw->dev_spec._82571.smb_counter > 2) + sw_timeout = 1; + + /* Get the SW semaphore */ + while (i < sw_timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == sw_timeout) { + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + hw->dev_spec._82571.smb_counter++; + } + /* Get the FW semaphore. */ + for (i = 0; i < fw_timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); + + /* Semaphore acquired if bit latched */ + if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) + break; + + usec_delay(50); + } + + if (i == fw_timeout) { + /* Release semaphores */ + e1000_put_hw_semaphore_82571(hw); + DEBUGOUT("Driver can't access the NVM\n"); + return -E1000_ERR_NVM; + } + + return E1000_SUCCESS; +} + +/** + * e1000_put_hw_semaphore_82571 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + **/ +static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) +{ + u32 swsm; + + DEBUGFUNC("e1000_put_hw_semaphore_generic"); + + swsm = E1000_READ_REG(hw, E1000_SWSM); + + swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); + + E1000_WRITE_REG(hw, E1000_SWSM, swsm); +} + +/** + * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * * Acquire the HW semaphore during reset. * **/ -static s32 -e1000_get_hw_semaphore_82574(struct e1000_hw *hw) +static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw) { u32 extcnf_ctrl; s32 i = 0; - /* XXX assert that mutex is held */ + DEBUGFUNC("e1000_get_hw_semaphore_82573"); - ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); do { extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; @@ -532,7 +614,7 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) if (i == MDIO_OWNERSHIP_TIMEOUT) { /* Release semaphores */ - e1000_put_hw_semaphore_82574(hw); + e1000_put_hw_semaphore_82573(hw); DEBUGOUT("Driver can't access the PHY\n"); return -E1000_ERR_PHY; } @@ -541,18 +623,17 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) } /** - * e1000_put_hw_semaphore_82574 - Release hardware semaphore + * e1000_put_hw_semaphore_82573 - Release hardware semaphore * @hw: pointer to the HW structure * * Release hardware semaphore used during reset. * **/ -static void -e1000_put_hw_semaphore_82574(struct e1000_hw *hw) +static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw) { u32 extcnf_ctrl; - DEBUGFUNC("e1000_put_hw_semaphore_82574"); + DEBUGFUNC("e1000_put_hw_semaphore_82573"); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); extcnf_ctrl &= ~E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; @@ -560,6 +641,41 @@ e1000_put_hw_semaphore_82574(struct e1000_hw *hw) } /** + * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM. + * + **/ +static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) +{ + s32 ret_val; + + DEBUGFUNC("e1000_get_hw_semaphore_82574"); + + E1000_MUTEX_LOCK(&hw->dev_spec._82571.swflag_mutex); + ret_val = e1000_get_hw_semaphore_82573(hw); + if (ret_val) + E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); + return ret_val; +} + +/** + * e1000_put_hw_semaphore_82574 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + * + **/ +static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_put_hw_semaphore_82574"); + + e1000_put_hw_semaphore_82573(hw); + E1000_MUTEX_UNLOCK(&hw->dev_spec._82571.swflag_mutex); +} + +/** * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure * @active: TRUE to enable LPLU, FALSE to disable @@ -630,7 +746,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw DEBUGFUNC("e1000_acquire_nvm_82571"); - ret_val = e1000_get_hw_semaphore(hw); + ret_val = e1000_get_hw_semaphore_82571(hw); if (ret_val) return ret_val; @@ -643,7 +759,7 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw } if (ret_val) - e1000_put_hw_semaphore(hw); + e1000_put_hw_semaphore_82571(hw); return ret_val; } @@ -659,7 +775,7 @@ static void e1000_release_nvm_82571(struct e1000_hw *h DEBUGFUNC("e1000_release_nvm_82571"); e1000_release_nvm_generic(hw); - e1000_put_hw_semaphore(hw); + e1000_put_hw_semaphore_82571(hw); } /** @@ -976,6 +1092,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) */ switch (hw->mac.type) { case e1000_82573: + ret_val = e1000_get_hw_semaphore_82573(hw); + break; case e1000_82574: case e1000_82583: ret_val = e1000_get_hw_semaphore_82574(hw); @@ -992,6 +1110,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) /* Must release MDIO ownership and mutex after MAC reset. */ switch (hw->mac.type) { case e1000_82573: + /* Release mutex only if the hw semaphore is acquired */ + if (!ret_val) + e1000_put_hw_semaphore_82573(hw); + break; case e1000_82574: case e1000_82583: /* Release mutex only if the hw semaphore is acquired */ @@ -999,7 +1121,6 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) e1000_put_hw_semaphore_82574(hw); break; default: - panic("unknown mac type %x\n", hw->mac.type); break; } Modified: head/sys/dev/e1000/e1000_82575.c ============================================================================== --- head/sys/dev/e1000/e1000_82575.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_82575.c Sat Sep 16 02:41:38 2017 (r323635) @@ -79,9 +79,11 @@ static s32 e1000_valid_led_default_82575(struct e1000 static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 data); static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); +static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); +static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); @@ -509,8 +511,12 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw /* link info */ mac->ops.get_link_up_info = e1000_get_link_up_info_82575; /* acquire SW_FW sync */ - mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync; - mac->ops.release_swfw_sync = e1000_release_swfw_sync; + mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_82575; + mac->ops.release_swfw_sync = e1000_release_swfw_sync_82575; + if (mac->type >= e1000_i210) { + mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_i210; + mac->ops.release_swfw_sync = e1000_release_swfw_sync_i210; + } /* set lan id for port to determine which phy lock to use */ hw->mac.ops.set_lan_id(hw); @@ -982,7 +988,7 @@ static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw DEBUGFUNC("e1000_acquire_nvm_82575"); - ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); + ret_val = e1000_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); if (ret_val) goto out; @@ -1013,7 +1019,7 @@ static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) - e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); out: return ret_val; @@ -1032,7 +1038,83 @@ static void e1000_release_nvm_82575(struct e1000_hw *h e1000_release_nvm_generic(hw); - e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); +} + +/** + * e1000_acquire_swfw_sync_82575 - Acquire SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Acquire the SW/FW semaphore to access the PHY or NVM. The mask + * will also specify which port we're acquiring the lock for. + **/ +static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + u32 fwmask = mask << 16; + s32 ret_val = E1000_SUCCESS; + s32 i = 0, timeout = 200; + + DEBUGFUNC("e1000_acquire_swfw_sync_82575"); + + while (i < timeout) { + if (e1000_get_hw_semaphore_generic(hw)) { + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + if (!(swfw_sync & (fwmask | swmask))) + break; + + /* + * Firmware currently using resource (fwmask) + * or other software thread using resource (swmask) + */ + e1000_put_hw_semaphore_generic(hw); + msec_delay_irq(5); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync |= swmask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); + +out: + return ret_val; +} + +/** + * e1000_release_swfw_sync_82575 - Release SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Release the SW/FW semaphore used to access the PHY or NVM. The mask + * will also specify which port we're releasing the lock for. + **/ +static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + + DEBUGFUNC("e1000_release_swfw_sync_82575"); + + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) + ; /* Empty */ + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + swfw_sync &= ~mask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); } /** Modified: head/sys/dev/e1000/e1000_hw.h ============================================================================== --- head/sys/dev/e1000/e1000_hw.h Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_hw.h Sat Sep 16 02:41:38 2017 (r323635) @@ -934,6 +934,7 @@ struct e1000_dev_spec_82543 { struct e1000_dev_spec_82571 { bool laa_is_present; u32 smb_counter; + E1000_MUTEX swflag_mutex; }; struct e1000_dev_spec_80003es2lan { @@ -957,6 +958,8 @@ enum e1000_ulp_state { struct e1000_dev_spec_ich8lan { bool kmrn_lock_loss_workaround_enabled; struct e1000_shadow_ram shadow_ram[E1000_SHADOW_RAM_WORDS]; + E1000_MUTEX nvm_mutex; + E1000_MUTEX swflag_mutex; bool nvm_k1_enabled; bool disable_k1_off; bool eee_disable; Modified: head/sys/dev/e1000/e1000_i210.c ============================================================================== --- head/sys/dev/e1000/e1000_i210.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_i210.c Sat Sep 16 02:41:38 2017 (r323635) @@ -37,6 +37,7 @@ static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw); static void e1000_release_nvm_i210(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw); static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); static s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw); @@ -57,7 +58,7 @@ static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw) DEBUGFUNC("e1000_acquire_nvm_i210"); - ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); + ret_val = e1000_acquire_swfw_sync_i210(hw, E1000_SWFW_EEP_SM); return ret_val; } @@ -73,7 +74,152 @@ static void e1000_release_nvm_i210(struct e1000_hw *hw { DEBUGFUNC("e1000_release_nvm_i210"); - e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); + e1000_release_swfw_sync_i210(hw, E1000_SWFW_EEP_SM); +} + +/** + * e1000_acquire_swfw_sync_i210 - Acquire SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Acquire the SW/FW semaphore to access the PHY or NVM. The mask + * will also specify which port we're acquiring the lock for. + **/ +s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + u32 fwmask = mask << 16; + s32 ret_val = E1000_SUCCESS; + s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ + + DEBUGFUNC("e1000_acquire_swfw_sync_i210"); + + while (i < timeout) { + if (e1000_get_hw_semaphore_i210(hw)) { + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + if (!(swfw_sync & (fwmask | swmask))) + break; + + /* + * Firmware currently using resource (fwmask) + * or other software thread using resource (swmask) + */ + e1000_put_hw_semaphore_generic(hw); + msec_delay_irq(5); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync |= swmask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); + +out: + return ret_val; +} + +/** + * e1000_release_swfw_sync_i210 - Release SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Release the SW/FW semaphore used to access the PHY or NVM. The mask + * will also specify which port we're releasing the lock for. + **/ +void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + + DEBUGFUNC("e1000_release_swfw_sync_i210"); + + while (e1000_get_hw_semaphore_i210(hw) != E1000_SUCCESS) + ; /* Empty */ + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + swfw_sync &= ~mask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); +} + +/** + * e1000_get_hw_semaphore_i210 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM + **/ +static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw) +{ + u32 swsm; + s32 timeout = hw->nvm.word_size + 1; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_i210"); + + /* Get the SW semaphore */ + while (i < timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == timeout) { + /* In rare circumstances, the SW semaphore may already be held + * unintentionally. Clear the semaphore once before giving up. + */ + if (hw->dev_spec._82575.clear_semaphore_once) { + hw->dev_spec._82575.clear_semaphore_once = FALSE; + e1000_put_hw_semaphore_generic(hw); + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + } + } + + /* If we do not have the semaphore here, we have to give up. */ + if (i == timeout) { + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + return -E1000_ERR_NVM; + } + } + + /* Get the FW semaphore. */ + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); + + /* Semaphore acquired if bit latched */ + if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) + break; + + usec_delay(50); + } + + if (i == timeout) { + /* Release semaphores */ + e1000_put_hw_semaphore_generic(hw); + DEBUGOUT("Driver can't access the NVM\n"); + return -E1000_ERR_NVM; + } + + return E1000_SUCCESS; } /** Modified: head/sys/dev/e1000/e1000_i210.h ============================================================================== --- head/sys/dev/e1000/e1000_i210.h Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_i210.h Sat Sep 16 02:41:38 2017 (r323635) @@ -43,6 +43,8 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); +s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask); +void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask); s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data); s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, Modified: head/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- head/sys/dev/e1000/e1000_ich8lan.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_ich8lan.c Sat Sep 16 02:41:38 2017 (r323635) @@ -694,6 +694,9 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_ dev_spec->shadow_ram[i].value = 0xFFFF; } + E1000_MUTEX_INIT(&dev_spec->nvm_mutex); + E1000_MUTEX_INIT(&dev_spec->swflag_mutex); + /* Function Pointers */ nvm->ops.acquire = e1000_acquire_nvm_ich8lan; nvm->ops.release = e1000_release_nvm_ich8lan; @@ -1844,7 +1847,7 @@ static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw * { DEBUGFUNC("e1000_acquire_nvm_ich8lan"); - ASSERT_CTX_LOCK_HELD(hw); + E1000_MUTEX_LOCK(&hw->dev_spec.ich8lan.nvm_mutex); return E1000_SUCCESS; } @@ -1859,7 +1862,9 @@ static void e1000_release_nvm_ich8lan(struct e1000_hw { DEBUGFUNC("e1000_release_nvm_ich8lan"); - ASSERT_CTX_LOCK_HELD(hw); + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.nvm_mutex); + + return; } /** @@ -1876,7 +1881,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_h DEBUGFUNC("e1000_acquire_swflag_ich8lan"); - ASSERT_CTX_LOCK_HELD(hw); + E1000_MUTEX_LOCK(&hw->dev_spec.ich8lan.swflag_mutex); while (timeout) { extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); @@ -1917,6 +1922,9 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_h } out: + if (ret_val) + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); + return ret_val; } @@ -1941,6 +1949,10 @@ static void e1000_release_swflag_ich8lan(struct e1000_ } else { DEBUGOUT("Semaphore unexpectedly released by sw/fw/hw\n"); } + + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); + + return; } /** @@ -5010,6 +5022,8 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_FEXTNVM3, reg); } + if (!ret_val) + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); if (ctrl & E1000_CTRL_PHY_RST) { ret_val = hw->phy.ops.get_cfg_done(hw); Modified: head/sys/dev/e1000/e1000_mac.c ============================================================================== --- head/sys/dev/e1000/e1000_mac.c Sat Sep 16 02:32:00 2017 (r323634) +++ head/sys/dev/e1000/e1000_mac.c Sat Sep 16 02:41:38 2017 (r323635) @@ -1707,6 +1707,76 @@ s32 e1000_get_speed_and_duplex_fiber_serdes_generic(st } /** + * e1000_get_hw_semaphore_generic - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM + **/ +s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw) +{ + u32 swsm; + s32 timeout = hw->nvm.word_size + 1; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_generic"); + + /* Get the SW semaphore */ + while (i < timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + return -E1000_ERR_NVM; + } + + /* Get the FW semaphore. */ + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); + + /* Semaphore acquired if bit latched */ + if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) + break; + + usec_delay(50); + } + + if (i == timeout) { + /* Release semaphores */ + e1000_put_hw_semaphore_generic(hw); + DEBUGOUT("Driver can't access the NVM\n"); + return -E1000_ERR_NVM; + } + + return E1000_SUCCESS; +} + +/** + * e1000_put_hw_semaphore_generic - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + **/ +void e1000_put_hw_semaphore_generic(struct e1000_hw *hw) +{ + u32 swsm; + + DEBUGFUNC("e1000_put_hw_semaphore_generic"); + + swsm = E1000_READ_REG(hw, E1000_SWSM); + + swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); + + E1000_WRITE_REG(hw, E1000_SWSM, swsm); +} + +/** * e1000_get_auto_rd_done_generic - Check for auto read completion * @hw: pointer to the HW structure * @@ -2181,186 +2251,3 @@ s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw return E1000_SUCCESS; } - -/** - * e1000_get_hw_semaphore - Acquire hardware semaphore - * @hw: pointer to the HW structure - * - * Acquire the HW semaphore to access the PHY or NVM - **/ -s32 e1000_get_hw_semaphore(struct e1000_hw *hw) -{ - u32 swsm; - s32 timeout = hw->nvm.word_size + 1; - s32 i = 0; - - DEBUGFUNC("e1000_get_hw_semaphore"); -#ifdef notyet - /* _82571 */ - /* If we have timedout 3 times on trying to acquire - * the inter-port SMBI semaphore, there is old code - * operating on the other port, and it is not - * releasing SMBI. Modify the number of times that - * we try for the semaphore to interwork with this - * older code. - */ - if (hw->dev_spec._82571.smb_counter > 2) - sw_timeout = 1; - -#endif - /* Get the SW semaphore */ - while (i < timeout) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - i++; - } - - if (i == timeout) { -#ifdef notyet - /* - * XXX This sounds more like a driver bug whereby we either - * recursed accidentally or missed clearing it previously - */ - /* In rare circumstances, the SW semaphore may already be held - * unintentionally. Clear the semaphore once before giving up. - */ - if (hw->dev_spec._82575.clear_semaphore_once) { - hw->dev_spec._82575.clear_semaphore_once = FALSE; - e1000_put_hw_semaphore_generic(hw); - for (i = 0; i < timeout; i++) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - } - } -#endif - - DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); - return -E1000_ERR_NVM; - } - - /* Get the FW semaphore. */ - for (i = 0; i < timeout; i++) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); - - /* Semaphore acquired if bit latched */ - if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) - break; - - usec_delay(50); - } - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Sep 16 03:46:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 504A0E22654; Sat, 16 Sep 2017 03:46:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 8361A65309; Sat, 16 Sep 2017 03:46:48 +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 mail110.syd.optusnet.com.au (Postfix) with ESMTPS id F04FC10408E; Sat, 16 Sep 2017 13:46:38 +1000 (AEST) Date: Sat, 16 Sep 2017 13:46:37 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Scott Long cc: Sean Bruno , Stephen Hurd , Cy Schubert , Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys In-Reply-To: <1EBD0641-002D-409C-B18E-AAB5FCDECEBA@samsco.org> Message-ID: <20170916124826.P1107@besplex.bde.org> References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> <1EBD0641-002D-409C-B18E-AAB5FCDECEBA@samsco.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=bc8baKHB c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=NZlVo5omRyg7tE8A30gA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 03:46:49 -0000 On Fri, 15 Sep 2017, Scott Long wrote: >> On Sep 13, 2017, at 9:12 AM, Sean Bruno wrote: >> >>>>> #blamebruno A large burden. >>>>> Reviewed by: sbruno >>>>> Approved by: sbruno (mentor) >>>>> Sponsored by: Limelight Networks >>>>> Differential Revision: https://reviews.freebsd.org/D12235 >>>> >>>> *gasps at the LoC count and number of changed drivers* >>>> >>>> Could someone please better break this up in the future..? >> >> This ridiculous loc was due to the amount of restructuring needed to get >> us back to being in sync with our development. The future will not have >> this big of a commit/change and should be more bite/fun sized. >> >> The #blamebruno tag in the commit log was to indicate that this was not >> something Stephen was doing on his own, but was something that I had >> induced over the last few months during testing. > > This breaks my system. I prior to this commit, I had igb0 and igb1. Now I > only have igb0, and it\xe2]x80\x99s like igb1 isn\xe2\x80\x99tt even trying to attach. Unfortunately, > this breaks my nfsroot setup, so I need to roll back my tree. Please let me > know if there\xe2\x80\x99ss anything I can provide to help debugging. It gives lesser breakage here: - with an old PCI em, an error that occur every few makeworlds over nfs now hang the hardware. It used to be recovered from afger about 10 seconds. This only happened once. I then applied my old fix which ignores the error better so as to recover from it immediately. This seems to work as before. - with a newer PCI-e em, throughput as measured by netblast is down by more that a factor of 2 since last month. Bruce From owner-svn-src-all@freebsd.org Sat Sep 16 03:53:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C201AE22DEB; Sat, 16 Sep 2017 03:53:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 840886580D; Sat, 16 Sep 2017 03:53:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-it0-x231.google.com with SMTP id w204so4341628itc.4; Fri, 15 Sep 2017 20:53:34 -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=xnMBt/KHKqPjLh9bBLC+XP+QOMfVcU4VuyP85Avppek=; b=gYD6j0sbXbvoDpxpnMaSAY/kHuCNjZlMIyxhRYFugJgL00fasekUvy/0b7+D/OUnle cShtQ6mSGYGscLpIi9/kuBTIPAj4I+uSJ1cIQeSPhU+nvj5V1y6AgvmEGX4RzIu7U56g InXQ3OlaXfO1W/SaGztPwj3+0MBtD7KUsLKiE1ZAmVbYBb+xwb6tUiLZyxphLIzZBsK9 Kyr8z/Nt+atOdi6W3LN7TRmY396QkYPUhfkovpXon7pEz7Tg+sH6nGgOvo/8CQ2IWSQI ckL3seDPwTo3FBSZJspC954IIhobWOMvOcaNV4QVcFjo3dZ/ADZ37u/M/57hQRg9Uvfc Bw8Q== 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=xnMBt/KHKqPjLh9bBLC+XP+QOMfVcU4VuyP85Avppek=; b=Bj8oyLa4bSEPXzijOptThlt7Bav3salT/gH67XtajHa+sAQ+MrJ4PXIbK2/Zl+WqoW 7szzMiaTdtvCNjl9ec7wTFnni1fXyNxjf9nTDT6Lnfl3a8U0UirHeucxVAUW1FAtMgCY yDgk70YT1HPRcHhfVJabiCZTc78LLfw9s4VtkAtqOh7w5DKn5bCsIdOh8ofVnFG/r3uk aL0og5Dl68F83qL1bOpyhgspLlnNNhXTavCYWRppUx6aZcYpUrvVe+teQBWLn4yv94cm o7nhIz1mffPz1EC0IpwZ45tDNcSTqet+Pi/8ugQaITIaIjN0HZuEoJMQtvRi10tZSvaa Vedw== X-Gm-Message-State: AHPjjUiKSX3uE8zsxsYIcqQ/fWGdD4VTCr/Nhum4Z7B1Y92plDNT+IOY Pxzql6Gtc7NnaQOY9JYFhlVoQnmW X-Google-Smtp-Source: AOwi7QBakEK8BgoXThbV3EKWXRAULETAhRAeujIk89npErxVKBgbCPBNMEVik+IxNxOxH84WIrBC/g== X-Received: by 10.36.253.130 with SMTP id m124mr8607832ith.105.1505534013540; Fri, 15 Sep 2017 20:53:33 -0700 (PDT) Received: from [172.20.1.25] (50-207-206-10-static.hfc.comcastbusiness.net. [50.207.206.10]) by smtp.gmail.com with ESMTPSA id m15sm1238724iod.85.2017.09.15.20.53.32 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Sep 2017 20:53:32 -0700 (PDT) Subject: Re: svn commit: r323635 - in head/sys: dev/bnxt dev/e1000 kern net sys Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_116A50DD-9916-471B-A567-939ECE4934BF"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201709160241.v8G2fdGN008798@repo.freebsd.org> Date: Fri, 15 Sep 2017 20:53:30 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <4C93AF31-E16D-42E5-9C6E-79695EB95302@gmail.com> References: <201709160241.v8G2fdGN008798@repo.freebsd.org> To: Stephen Hurd X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 03:53:34 -0000 --Apple-Mail=_116A50DD-9916-471B-A567-939ECE4934BF Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Sep 15, 2017, at 19:41, Stephen Hurd wrote: > > Author: shurd > Date: Sat Sep 16 02:41:38 2017 > New Revision: 323635 > URL: https://svnweb.freebsd.org/changeset/base/323635 > > Log: > Revert r323516 (iflib rollup) > > This was really too big of a commit even if everything worked, but there > are multiple new issues introduced in the one huge commit, so it's not > worth keeping this until it's fixed. > > I'll work on splitting this up into logical chunks and introduce them one > at a time over the next week or two. Thank you, -Ngie --Apple-Mail=_116A50DD-9916-471B-A567-939ECE4934BF 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 iQIcBAEBCgAGBQJZvKA7AAoJEPWDqSZpMIYVOmMP/RBDv/fX2zDDTKE1Uu6Zss6B S13Le+Zy4zYsHgtTpV7oWRITuwQcSeQ8WBAzJoFypd/+z3X33LvWweg/oduzsJXg WrrfM22vbeSw1klcg9X3R5mqrd6EhxHZD2eMeM+KnDhKiC02c5qcoG0IQYH37+QM MmRK3cZ+nZhYpOcljFYIoMNrX4k8lwlXTJ/fHSQAHbUJ1utP1pceBYkKcuTMHp9l +X7LmrRxRk+Aj2GkJOMR63DEqDQqYmfkv1I+bkAgJIyiazYdW59L3gLQalFOUShp wy1jqDsbhoK6T1K+EzW397grK+88Ek/x5U4tpRYuUS631WU6tJd+n4aE2s6Qf6uK DKAkIznPyR5AlZXyGdObwXE0xzs73gvKo4A513Lc+Gw/BFCgGn50aVFLcrjVcOMf RKjLrrvswyRRSzhBokF90hG/CbqjkpthsE542WQn7K46Hq4KTbiIIFGfUDgifTSz 3rtccXuRUfeyUMZHkvOeIkmRXR4gOYP1fVuOVM5c/hNGk6+Wl4e1rMW4lCCmJuW0 2795jCcto+fvxqE9bkBWog8EfdAv+l+tbQ2q8K7UCiv2XFZnwXCGi/NAGubnaR6L QdUMUbtO8Or7YONj25RAoUVrvlyz7QSl7ACpHNZuu9F+eGtUcLjzM0SqMcmc7Yr6 992HGQYFqxK54I1nSAh1 =eMxH -----END PGP SIGNATURE----- --Apple-Mail=_116A50DD-9916-471B-A567-939ECE4934BF-- From owner-svn-src-all@freebsd.org Sat Sep 16 05:42:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01F9AE01DCD; Sat, 16 Sep 2017 05:42:29 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6BAD697EB; Sat, 16 Sep 2017 05:42:28 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8G5gRt3084557; Sat, 16 Sep 2017 05:42:27 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8G5gROb084552; Sat, 16 Sep 2017 05:42:27 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201709160542.v8G5gROb084552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sat, 16 Sep 2017 05:42:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323637 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 323637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 05:42:29 -0000 Author: sjg Date: Sat Sep 16 05:42:27 2017 New Revision: 323637 URL: https://svnweb.freebsd.org/changeset/base/323637 Log: Use OBJS_SRCS_FILTER to control setting OBJS from SRCS Some makefiles do reachover builds. In some cases it is convenient to list subdirs of the distribution in SRCS. It is not very convenient, or always even desirable to have corresponding subdirs in .OBJDIR, so OBJS_SRCS_FILTER allows the makefile to choose. The default value 'R' matches existing practice. But a makefile can set OBJS_SRCS_FILTER= T (the R gets added by bsd.init.mk) to avoid the need for subdirs in .OBJDIR Differential Revision: https://reviews.freebsd.org/D12218 Reviewed by: bdrewery Modified: head/share/mk/bsd.dep.mk head/share/mk/bsd.init.mk head/share/mk/bsd.lib.mk head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Sat Sep 16 03:54:20 2017 (r323636) +++ head/share/mk/bsd.dep.mk Sat Sep 16 05:42:27 2017 (r323637) @@ -101,7 +101,7 @@ _SKIP_DEPEND= 1 CLEANFILES?= .for _S in ${SRCS:N*.[dhly]} -OBJS_DEPEND_GUESS.${_S:R}.o+= ${_S} +OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.o+= ${_S} .endfor # Lexical analyzers @@ -180,7 +180,7 @@ DEPEND_MP?= -MP DEPEND_FILTER= C,/,_,g DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} .if !empty(DEPENDSRCS) -DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,} +DEPENDOBJS+= ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,} .endif DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./} .if defined(_SKIP_DEPEND) Modified: head/share/mk/bsd.init.mk ============================================================================== --- head/share/mk/bsd.init.mk Sat Sep 16 03:54:20 2017 (r323636) +++ head/share/mk/bsd.init.mk Sat Sep 16 05:42:27 2017 (r323637) @@ -16,6 +16,10 @@ ____: .include .MAIN: all +# This is used in bsd.{dep,lib,prog}.mk as ${OBJS_SRCS_FILTER:ts:} +# Some makefiles may want T as well to avoid nested objdirs. +OBJS_SRCS_FILTER+= R + # Handle INSTALL_AS_USER here to maximize the chance that # it has final authority over fooOWN and fooGRP. .if ${MK_INSTALL_AS_USER} != "no" Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Sat Sep 16 03:54:20 2017 (r323636) +++ head/share/mk/bsd.lib.mk Sat Sep 16 05:42:27 2017 (r323637) @@ -168,7 +168,7 @@ LDFLAGS+= -Wl,--version-script=${VERSION_MAP} .endif .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) -OBJS+= ${SRCS:N*.h:R:S/$/.o/} +OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/} CLEANFILES+= ${OBJS} ${STATICOBJS} .endif @@ -437,13 +437,13 @@ lint: ${SRCS:M*.c} .if defined(LIB) && !empty(LIB) OBJS_DEPEND_GUESS+= ${SRCS:M*.h} .for _S in ${SRCS:N*.[hly]} -OBJS_DEPEND_GUESS.${_S:R}.po+= ${_S} +OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S} .endfor .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) .for _S in ${SRCS:N*.[hly]} -OBJS_DEPEND_GUESS.${_S:R}.pico+= ${_S} +OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S} .endfor .endif Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Sat Sep 16 03:54:20 2017 (r323636) +++ head/share/mk/bsd.prog.mk Sat Sep 16 05:42:27 2017 (r323637) @@ -85,7 +85,7 @@ PROGNAME?= ${PROG} .if defined(SRCS) -OBJS+= ${SRCS:N*.h:R:S/$/.o/g} +OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g} .if target(beforelinking) beforelinking: ${OBJS} From owner-svn-src-all@freebsd.org Sat Sep 16 09:02:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 676F9E096F5; Sat, 16 Sep 2017 09:02:16 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from mailgate.Leidinger.net (mailgate.leidinger.net [IPv6:2a00:1828:2000:375::1:5]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23EAD6EF2D; Sat, 16 Sep 2017 09:02:16 +0000 (UTC) (envelope-from Alexander@leidinger.net) Date: Sat, 16 Sep 2017 11:01:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=leidinger.net; s=outgoing-alex; t=1505552533; bh=qOQsaBIXZOgHyFpYwGIOcL/mY4If6d/UADEq5Im1NOc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bVIdlpHpgiB3GNQkvr3tU3ncaUTMC56j7bCVrcWOwJDgFyeKs93An//JiyhG99ytg tQ2mAd7Z0Rv5jX3e90e545Pn5wnrH4zxaNeM7JUauQ74AK337Pk2S7NvkCwZX/oUuU tzpCo8vPizi9p/LCl3O0DV+9DJ2yftW18m+Cv26c+ymXAyXLl1QpshHqK6487gUPjZ 4Q+qoXk/Fs0PxX3Mo1kLBmog10ycakYFwd1845ACtwijvMY6g2lE7546kOHpukQ3w6 O1Py0CJwGtYURMgaIX6CMH4If2NU1rPvBbwU8bwtpiuCvr8wQO4iJnZHjPn684dQUF uHrvyhvWt6jwA== Message-ID: <20170916110159.Horde.lN4uQjj9fb7hJ2309eQrexb@webmail.leidinger.net> From: Alexander Leidinger To: Bruce Evans Cc: Scott Long , Sean Bruno , Stephen Hurd , Cy Schubert , Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> <1EBD0641-002D-409C-B18E-AAB5FCDECEBA@samsco.org> <20170916124826.P1107@besplex.bde.org> In-Reply-To: <20170916124826.P1107@besplex.bde.org> User-Agent: Horde Application Framework 5 Content-Type: multipart/signed; boundary="=_nIWceyOrArqQ53GMu70I5Wd"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 09:02:16 -0000 This message is in MIME format and has been PGP signed. --=_nIWceyOrArqQ53GMu70I5Wd Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Quoting Bruce Evans (from Sat, 16 Sep 2017=20=20 13:46:37=20+1000 (EST)): > It gives lesser breakage here: > - with an old PCI em, an error that occur every few makeworlds over nfs n= ow > hang the hardware. It used to be recovered from afger about 10 seconds= . > This only happened once. I then applied my old fix which ignores the > error better so as to recover from it immediately. This seems to work = as > before. As I also have an em device which switches into non-working state:=20=20 what's=20the patch you have for this? I would like to see if your change=20= =20 also=20helps my device to get back into working shape again. Bye, Alexander. --=20 http://www.Leidinger.net=20Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_nIWceyOrArqQ53GMu70I5Wd Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJZvOiHAAoJEKrxQhqFIICEoeIP/3wbaz5uWTSmcEY2UE6IOiRv /Qs3S6xjMvRMTb0h8FUwXPPr1/tPVrXGoD6YoDXFkNI1ad4bTKesP1fUoDrb9gjN 4S+a5JCZcTVKUlMRt5HriVL5R9fcW7AWvvieca+nLz8pSPqJ7h7kcTb+piBsufgG 38ELg01lF2NzXW7ecMW9b0wMtUOx1vfwW13X5TspsVyzsSXZIDgrjoJk2uvigWuq 4N/ytSBScX/W7WO2jgmyqvQ8LYkdBbR9xRjLDU2DwoaPXR8xWmEA8sf9fsLeraa6 0Ox7jCwSKiV2wc6tf2N8WfWOFC7wlnkh6TVzvRn9GY4s+I98tDGdmNtagGFCL41V d3Uvzkw9kkiyZnQthf3qZozIyKs9E3N7/n8YGvtqndOmeGaYpCbu1wtsAfW1tqOE gQbdnexEfkp6mUC7lQl+4eHFAQQQ21/XaEKCTsxArVy8j+rHqiYGv9dnbRQEvnlD ZuyqtsQr5AwjlCslIv11h97jHl7+6oN+CH+8dmOPModwISEuRYuWSYD9ygc3cW0Y VGgTIAcHo1f9v1jCtJJujZVu1V5lFFdrAUWnar8ph6P7b1Lbt/1eaS6msuXxKW6t qpnzzriuAHHOqHBW4zRwlpiynfnKbr2ltMv0umgvvRFVDp+eXmlsayI4AxZbeh1o KKiKUeg/UxlEq+Tjwj26 =RLD2 -----END PGP SIGNATURE----- --=_nIWceyOrArqQ53GMu70I5Wd-- From owner-svn-src-all@freebsd.org Sat Sep 16 09:41:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22EA7E0B251; Sat, 16 Sep 2017 09:41:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id AB56A6FE88; Sat, 16 Sep 2017 09:41:29 +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 mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 0DD8FD44E1C; Sat, 16 Sep 2017 19:41:18 +1000 (AEST) Date: Sat, 16 Sep 2017 19:41:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Leidinger cc: Bruce Evans , Scott Long , Sean Bruno , Stephen Hurd , Cy Schubert , Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323516 - in head/sys: dev/bnxt dev/e1000 kern net sys In-Reply-To: <20170916110159.Horde.lN4uQjj9fb7hJ2309eQrexb@webmail.leidinger.net> Message-ID: <20170916192800.E14782@besplex.bde.org> References: <201709130711.v8D7BlTS003204@slippy.cwsent.com> <48654d1f-4cc7-da05-7a73-ef538b431560@freebsd.org> <1EBD0641-002D-409C-B18E-AAB5FCDECEBA@samsco.org> <20170916124826.P1107@besplex.bde.org> <20170916110159.Horde.lN4uQjj9fb7hJ2309eQrexb@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=MlaUAiCI1E6xVCer72cA:9 a=CjuIK1q_8ugA:10 X-Mailman-Approved-At: Sat, 16 Sep 2017 10:17:04 +0000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 09:41:30 -0000 On Sat, 16 Sep 2017, Alexander Leidinger wrote: > Quoting Bruce Evans (from Sat, 16 Sep 2017 13:46:37 > +1000 (EST)): > >> It gives lesser breakage here: >> - with an old PCI em, an error that occur every few makeworlds over nfs now >> hang the hardware. It used to be recovered from afger about 10 seconds. >> This only happened once. I then applied my old fix which ignores the >> error better so as to recover from it immediately. This seems to work as >> before. > > As I also have an em device which switches into non-working state: what's the > patch you have for this? I would like to see if your change also helps my > device to get back into working shape again. X Index: em_txrx.c X =================================================================== X --- em_txrx.c (revision 323636) X +++ em_txrx.c (working copy) X @@ -640,9 +640,20 @@ X X /* Make sure bad packets are discarded */ X if (errors & E1000_RXD_ERR_FRAME_ERR_MASK) { X +#if 0 X adapter->dropped_pkts++; X - /* XXX fixup if common */ X return (EBADMSG); X +#else X + /* X + * XXX the above error handling is worse than none. X + * First it it drops 'i' packets before the current X + * one and doesn't count them. Then it returns an X + * error. iflib can't really handle this error. X + * It just resets, and this usually drops many more X + * packets (without counting them) and much time. X + */ X + printf("lem: frame error: ignored\n"); X +#endif X } X X ri->iri_frags[i].irf_flid = 0; This is for old em. nfs doesn't seem to notice the dropped packet(s) after this. I think the comment "fixup if common" means "this error should actually be handled if it occurs enough to matter". I removed the increment of the dropped packet count because with the change none are dropped directly here. I think the error is just for this packet but more than 1 packet might be dropped by returning in the old code, but debugging code seem to show no more than 1 packet at a time having an error. I think returning drops good packets after the bad one together with leaving the state inconsistent, and it takes almost a reset to recover. X @@ -703,8 +714,12 @@ X X /* Make sure bad packets are discarded */ X if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { X +#if 0 X adapter->dropped_pkts++; X return EBADMSG; X +#else X + printf("em: frame error: ignored\n"); X +#endif X } X X ri->iri_frags[i].irf_flid = 0; This is for newer em. I haven't noticed any problems with that (except it has 27 usec higher latency). Bruce From owner-svn-src-all@freebsd.org Sat Sep 16 11:51:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 461CFE116B9 for ; Sat, 16 Sep 2017 11:51:59 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com [IPv6:2a00:1450:4010:c07::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA8AB737FA for ; Sat, 16 Sep 2017 11:51:58 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-lf0-x22b.google.com with SMTP id d4so4506610lfj.7 for ; Sat, 16 Sep 2017 04:51:58 -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=EjZwzs9q3qejFXwY07qVCJdlOaaa65yERySyYNIJJi4=; b=EnOc78JOqxXbfz4M7bVfpYW6PzmamcUrvF9VIkva3pM+JzB4JooQUX8rUQuuEhWfNV ZOSSGQxwMUZfVmKEATEXlYqlQmBFWsuhRCFmA3CKHhk9EuDrXaCKaIuuJKTyU2WuWO/P 2DKG6LTFOwSxcNythO/3CsSY+A7zBQvDfivMtUC+DKrtoLrzrgoDzopwzcE1++lgUxFX rL4dKtqR+xsx2P2+PRhIAJNBXKB6IbOIZ/DDHzHWbjf7cJW+hj9SzN5lrHKlBzxmY6QH FDhwcst4I5LOoOKXTPTRy2gYMcUWNofopoXA/vxkD8w84+MWVcZ4po0AHjsT1S/D4E3e 3n8A== 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=EjZwzs9q3qejFXwY07qVCJdlOaaa65yERySyYNIJJi4=; b=KoMeQPNaZojPCzHZQ7vzLsrjQTQNVgtRPngJL/cutJmgJKqo/Z5pUaO+2BuGuPlxw4 3aA5N6DE6EAl8zgq+qRbT09fIVSEg5a2SgDCDSJG85F6ggOB4ZvbefvV17yhVeuO8NDs CRNKpjW3RjrfzMZO1innapSvdYbqWiVoz+htliynpxmmOA75sg26zw2ERWhwYHA8w/Bu XOgxAVLcUfbjdliu1p+/T/DzK616nrRHPD/SrRKpcrYn4cIZH+SgGkvvecF2ij5LlV1b l8QtTC3EeoGFc8na99tTo52TVLNXLLNvhAmlry47y+RA3wRLo0NoaYwKy3inBuhXwam9 nEwQ== X-Gm-Message-State: AHPjjUjehwbjM8Egqf09sjiz9pQdeFwsWwQGZySC+svtY/o3o1OPwYq/ oOvvBYxqUdCdZ5u8xnwrs0f9LHDS8CQ+XrjnPFPGgA== X-Google-Smtp-Source: AOwi7QDghaPMAKvj1pPtvaOL3R2AU+25iTPq3XeI0vBsvdztRF9cEFdT0YkatM9mV+GKnqcA7O9+ko4lxP8N5qF1S4M= X-Received: by 10.25.92.68 with SMTP id q65mr1517680lfb.206.1505562716897; Sat, 16 Sep 2017 04:51:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.142.68 with HTTP; Sat, 16 Sep 2017 04:51:26 -0700 (PDT) In-Reply-To: <20170915115819.GA22099@stack.nl> References: <201709050746.v857kjX9032212@repo.freebsd.org> <20170915115819.GA22099@stack.nl> From: Ed Schouten Date: Sat, 16 Sep 2017 12:51:26 +0100 Message-ID: Subject: Re: svn commit: r323177 - in head: sys/compat/cloudabi sys/contrib/cloudabi usr.bin/truss To: Jilles Tjoelker Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 11:51:59 -0000 Hi Jilles, 2017-09-15 12:58 GMT+01:00 Jilles Tjoelker : > Although this is correct from a functionality point of view (S_IFIFO and > S_IFSOCK are probably expected to be different in a POSIX context, but > this is unlikely to break anything that is not already broken), it is a > partial reversal of previous changes to FreeBSD that created separate > implementations for pipes (first unnamed pipes in 1996, later fifos in > 2012 r232055). The main reason for these changes was performance. > > Unfortunately, I do not have concrete benchmarks in the CloudABI > context. That is important to keep in mind indeed. Thanks for pointing this out! When I discussed this with some of the other folks working on CloudABI, we came to the conclusion that this (potential) loss of performance is acceptable in the nearby future. If it would really affect us negatively, it should in theory be possible to reimplement our streaming sockets and pipes with something as simple and fast as FreeBSD's pipes, but still support file descriptor passing, etc. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands From owner-svn-src-all@freebsd.org Sat Sep 16 13:49:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20E61E17A82; Sat, 16 Sep 2017 13:49:28 +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 EECBA76A06; Sat, 16 Sep 2017 13:49:27 +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 v8GDnRCR081625; Sat, 16 Sep 2017 13:49:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GDnQo1081622; Sat, 16 Sep 2017 13:49:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201709161349.v8GDnQo1081622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 16 Sep 2017 13:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323638 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 323638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 13:49:28 -0000 Author: kib Date: Sat Sep 16 13:49:26 2017 New Revision: 323638 URL: https://svnweb.freebsd.org/changeset/base/323638 Log: MFC r323368: Add a vm_page_change_lock() helper. Modified: stable/11/sys/vm/vm_object.c stable/11/sys/vm/vm_page.c stable/11/sys/vm/vm_page.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Sat Sep 16 05:42:27 2017 (r323637) +++ stable/11/sys/vm/vm_object.c Sat Sep 16 13:49:26 2017 (r323638) @@ -1910,6 +1910,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t int options) { vm_page_t p, next; + struct mtx *mtx; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & OBJ_UNMANAGED) == 0 || @@ -1920,6 +1921,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t vm_object_pip_add(object, 1); again: p = vm_page_find_least(object, start); + mtx = NULL; /* * Here, the variable "p" is either (1) the page with the least pindex @@ -1936,7 +1938,7 @@ again: * however, be invalidated if the option OBJPR_CLEANONLY is * not specified. */ - vm_page_lock(p); + vm_page_change_lock(p, &mtx); if (vm_page_xbusied(p)) { VM_OBJECT_WUNLOCK(object); vm_page_busy_sleep(p, "vmopax", true); @@ -1950,7 +1952,7 @@ again: p->valid = 0; vm_page_undirty(p); } - goto next; + continue; } if (vm_page_busied(p)) { VM_OBJECT_WUNLOCK(object); @@ -1964,14 +1966,14 @@ again: if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_write(p); if (p->dirty) - goto next; + continue; } if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_all(p); vm_page_free(p); -next: - vm_page_unlock(p); } + if (mtx != NULL) + mtx_unlock(mtx); vm_object_pip_wakeup(object); } @@ -1994,7 +1996,7 @@ next: void vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end) { - struct mtx *mtx, *new_mtx; + struct mtx *mtx; vm_page_t p, next; VM_OBJECT_ASSERT_LOCKED(object); @@ -2011,17 +2013,7 @@ vm_object_page_noreuse(vm_object_t object, vm_pindex_t mtx = NULL; for (; p != NULL && (p->pindex < end || end == 0); p = next) { next = TAILQ_NEXT(p, listq); - - /* - * Avoid releasing and reacquiring the same page lock. - */ - new_mtx = vm_page_lockptr(p); - if (mtx != new_mtx) { - if (mtx != NULL) - mtx_unlock(mtx); - mtx = new_mtx; - mtx_lock(mtx); - } + vm_page_change_lock(p, &mtx); vm_page_deactivate_noreuse(p); } if (mtx != NULL) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Sat Sep 16 05:42:27 2017 (r323637) +++ stable/11/sys/vm/vm_page.c Sat Sep 16 13:49:26 2017 (r323638) @@ -905,6 +905,23 @@ vm_page_flash(vm_page_t m) } /* + * Avoid releasing and reacquiring the same page lock. + */ +void +vm_page_change_lock(vm_page_t m, struct mtx **mtx) +{ + struct mtx *mtx1; + + mtx1 = vm_page_lockptr(m); + if (*mtx == mtx1) + return; + if (*mtx != NULL) + mtx_unlock(*mtx); + *mtx = mtx1; + mtx_lock(mtx1); +} + +/* * Keep page from being freed by the page daemon * much of the same effect as wiring, except much lower * overhead and should be used only for *very* temporary @@ -937,20 +954,11 @@ vm_page_unhold(vm_page_t mem) void vm_page_unhold_pages(vm_page_t *ma, int count) { - struct mtx *mtx, *new_mtx; + struct mtx *mtx; mtx = NULL; for (; count != 0; count--) { - /* - * Avoid releasing and reacquiring the same page lock. - */ - new_mtx = vm_page_lockptr(*ma); - if (mtx != new_mtx) { - if (mtx != NULL) - mtx_unlock(mtx); - mtx = new_mtx; - mtx_lock(mtx); - } + vm_page_change_lock(*ma, &mtx); vm_page_unhold(*ma); ma++; } @@ -1989,7 +1997,7 @@ vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start, vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options) { - struct mtx *m_mtx, *new_mtx; + struct mtx *m_mtx; vm_object_t object; vm_paddr_t pa; vm_page_t m, m_run; @@ -2032,16 +2040,7 @@ vm_page_scan_contig(u_long npages, vm_page_t m_start, } else KASSERT(m_run != NULL, ("m_run == NULL")); - /* - * Avoid releasing and reacquiring the same page lock. - */ - new_mtx = vm_page_lockptr(m); - if (m_mtx != new_mtx) { - if (m_mtx != NULL) - mtx_unlock(m_mtx); - m_mtx = new_mtx; - mtx_lock(m_mtx); - } + vm_page_change_lock(m, &m_mtx); m_inc = 1; retry: if (m->wire_count != 0 || m->hold_count != 0) @@ -2191,7 +2190,7 @@ static int vm_page_reclaim_run(int req_class, u_long npages, vm_page_t m_run, vm_paddr_t high) { - struct mtx *m_mtx, *new_mtx; + struct mtx *m_mtx; struct spglist free; vm_object_t object; vm_paddr_t pa; @@ -2212,13 +2211,7 @@ vm_page_reclaim_run(int req_class, u_long npages, vm_p /* * Avoid releasing and reacquiring the same page lock. */ - new_mtx = vm_page_lockptr(m); - if (m_mtx != new_mtx) { - if (m_mtx != NULL) - mtx_unlock(m_mtx); - m_mtx = new_mtx; - mtx_lock(m_mtx); - } + vm_page_change_lock(m, &m_mtx); retry: if (m->wire_count != 0 || m->hold_count != 0) error = EBUSY; @@ -2331,12 +2324,7 @@ retry: * The new page must be deactivated * before the object is unlocked. */ - new_mtx = vm_page_lockptr(m_new); - if (m_mtx != new_mtx) { - mtx_unlock(m_mtx); - m_mtx = new_mtx; - mtx_lock(m_mtx); - } + vm_page_change_lock(m_new, &m_mtx); vm_page_deactivate(m_new); } else { m->flags &= ~PG_ZERO; Modified: stable/11/sys/vm/vm_page.h ============================================================================== --- stable/11/sys/vm/vm_page.h Sat Sep 16 05:42:27 2017 (r323637) +++ stable/11/sys/vm/vm_page.h Sat Sep 16 13:49:26 2017 (r323638) @@ -448,6 +448,7 @@ vm_page_t vm_page_alloc_contig(vm_object_t object, vm_ u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); +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_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); From owner-svn-src-all@freebsd.org Sat Sep 16 14:08:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63D89E18BAB; Sat, 16 Sep 2017 14:08:21 +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 3DFF17743E; Sat, 16 Sep 2017 14:08:21 +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 v8GE8K14090094; Sat, 16 Sep 2017 14:08:20 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GE8KEX090093; Sat, 16 Sep 2017 14:08:20 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709161408.v8GE8KEX090093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 16 Sep 2017 14:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323639 - 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: 323639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 14:08:21 -0000 Author: manu Date: Sat Sep 16 14:08:20 2017 New Revision: 323639 URL: https://svnweb.freebsd.org/changeset/base/323639 Log: Allwinner: a10_gpio Fix panic on multiple lock r323392 introduce gpio_pin_get/gpio_pin_set for a10_gpio driver. When called via gpio method they must aquire the device lock while when they are called via gpio_pin_configure the lock is already aquire. Introduce a10_gpio_pin_{s,g}et_locked and call them in pin_gpio_configure instead. Tested On: BananaPi (A20) Reported by: Richard Puga richard@puga.net Modified: head/sys/arm/allwinner/a10_gpio.c Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Sat Sep 16 13:49:26 2017 (r323638) +++ head/sys/arm/allwinner/a10_gpio.c Sat Sep 16 14:08:20 2017 (r323639) @@ -197,6 +197,8 @@ struct a10_gpio_softc { static int a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value); static int a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value); +static int a10_gpio_pin_get_locked(struct a10_gpio_softc *sc, uint32_t pin, unsigned int *value); +static int a10_gpio_pin_set_locked(struct a10_gpio_softc *sc, uint32_t pin, unsigned int value); #define A10_GPIO_WRITE(_sc, _off, _val) \ bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) @@ -333,15 +335,15 @@ a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT); } else if (flags & GPIO_PIN_OUTPUT) { if (flags & GPIO_PIN_PRESET_LOW) { - a10_gpio_pin_set(sc->sc_dev, pin, 0); + a10_gpio_pin_set_locked(sc, pin, 0); } else if (flags & GPIO_PIN_PRESET_HIGH) { - a10_gpio_pin_set(sc->sc_dev, pin, 1); + a10_gpio_pin_set_locked(sc, pin, 1); } else { /* Read the pin and preset output to current state. */ err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT); if (err == 0) { - a10_gpio_pin_get(sc->sc_dev, pin, &val); - a10_gpio_pin_set(sc->sc_dev, pin, val); + a10_gpio_pin_get_locked(sc, pin, &val); + a10_gpio_pin_set_locked(sc, pin, val); } } if (err == 0) @@ -473,49 +475,77 @@ a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint } static int -a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +a10_gpio_pin_set_locked(struct a10_gpio_softc *sc, uint32_t pin, + unsigned int value) { - struct a10_gpio_softc *sc; uint32_t bank, data; - sc = device_get_softc(dev); + A10_GPIO_LOCK_ASSERT(sc); + if (pin > sc->padconf->npins) return (EINVAL); bank = sc->padconf->pins[pin].port; pin = sc->padconf->pins[pin].pin; - A10_GPIO_LOCK(sc); data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank)); if (value) data |= (1 << pin); else data &= ~(1 << pin); A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data); - A10_GPIO_UNLOCK(sc); return (0); } static int -a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) { struct a10_gpio_softc *sc; - uint32_t bank, reg_data; + int ret; sc = device_get_softc(dev); + + A10_GPIO_LOCK(sc); + ret = a10_gpio_pin_set_locked(sc, pin, value); + A10_GPIO_UNLOCK(sc); + + return (ret); +} + +static int +a10_gpio_pin_get_locked(struct a10_gpio_softc *sc,uint32_t pin, + unsigned int *val) +{ + uint32_t bank, reg_data; + + A10_GPIO_LOCK_ASSERT(sc); + if (pin > sc->padconf->npins) return (EINVAL); bank = sc->padconf->pins[pin].port; pin = sc->padconf->pins[pin].pin; - A10_GPIO_LOCK(sc); reg_data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank)); - A10_GPIO_UNLOCK(sc); *val = (reg_data & (1 << pin)) ? 1 : 0; return (0); +} + +static int +a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct a10_gpio_softc *sc; + int ret; + + sc = device_get_softc(dev); + + A10_GPIO_LOCK(sc); + ret = a10_gpio_pin_get_locked(sc, pin, val); + A10_GPIO_UNLOCK(sc); + + return (ret); } static int From owner-svn-src-all@freebsd.org Sat Sep 16 15:50:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54FB7E1E1A2; Sat, 16 Sep 2017 15:50:33 +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 2400C7E107; Sat, 16 Sep 2017 15:50:33 +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 v8GFoW85030754; Sat, 16 Sep 2017 15:50:32 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GFoWfv030753; Sat, 16 Sep 2017 15:50:32 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709161550.v8GFoWfv030753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 16 Sep 2017 15:50:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323640 - head/sys/arm/allwinner/clkng X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 323640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 15:50:33 -0000 Author: manu Date: Sat Sep 16 15:50:31 2017 New Revision: 323640 URL: https://svnweb.freebsd.org/changeset/base/323640 Log: A64 CCUNG: Correct gate and reset for OHCI0/1 Reported by: jmcneill Pointy Hat: manu Modified: head/sys/arm/allwinner/clkng/ccu_a64.c Modified: head/sys/arm/allwinner/clkng/ccu_a64.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a64.c Sat Sep 16 14:08:20 2017 (r323639) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Sat Sep 16 15:50:31 2017 (r323640) @@ -66,8 +66,8 @@ static struct aw_ccung_reset a64_ccu_resets[] = { CCU_RESET(A64_RST_BUS_OTG, 0x2c0, 23) CCU_RESET(A64_RST_BUS_EHCI0, 0x2c0, 24) CCU_RESET(A64_RST_BUS_EHCI1, 0x2c0, 25) - CCU_RESET(A64_RST_BUS_OHCI0, 0x2c0, 26) - CCU_RESET(A64_RST_BUS_OHCI1, 0x2c0, 27) + CCU_RESET(A64_RST_BUS_OHCI0, 0x2c0, 28) + CCU_RESET(A64_RST_BUS_OHCI1, 0x2c0, 29) CCU_RESET(A64_RST_BUS_VE, 0x2c4, 0) CCU_RESET(A64_RST_BUS_TCON0, 0x2c4, 3) @@ -119,8 +119,8 @@ static struct aw_ccung_gate a64_ccu_gates[] = { CCU_GATE(A64_CLK_BUS_OTG, "bus-otg", "ahb1", 0x60, 23) CCU_GATE(A64_CLK_BUS_EHCI0, "bus-ehci0", "ahb1", 0x60, 24) CCU_GATE(A64_CLK_BUS_EHCI1, "bus-ehci1", "ahb2", 0x60, 25) - CCU_GATE(A64_CLK_BUS_OHCI0, "bus-ohci0", "ahb1", 0x60, 26) - CCU_GATE(A64_CLK_BUS_OHCI1, "bus-ohci1", "ahb2", 0x60, 27) + CCU_GATE(A64_CLK_BUS_OHCI0, "bus-ohci0", "ahb1", 0x60, 28) + CCU_GATE(A64_CLK_BUS_OHCI1, "bus-ohci1", "ahb2", 0x60, 29) CCU_GATE(A64_CLK_BUS_VE, "bus-ve", "ahb1", 0x64, 0) CCU_GATE(A64_CLK_BUS_TCON0, "bus-tcon0", "ahb1", 0x64, 3) From owner-svn-src-all@freebsd.org Sat Sep 16 15:58:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 227FBE1E992; Sat, 16 Sep 2017 15:58:22 +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 ED34C7E5BD; Sat, 16 Sep 2017 15:58:21 +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 v8GFwKj1034866; Sat, 16 Sep 2017 15:58:20 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GFwKfj034865; Sat, 16 Sep 2017 15:58:20 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201709161558.v8GFwKfj034865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 16 Sep 2017 15:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323641 - 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: 323641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 15:58:22 -0000 Author: manu Date: Sat Sep 16 15:58:20 2017 New Revision: 323641 URL: https://svnweb.freebsd.org/changeset/base/323641 Log: Allwinner usb phy: Rework resource allocation The usbphy node for allwinner have two kind of resources, one for the phy_ctrl and one per phy. Instead of blindy allocating resources, alloc the phy_ctrl and pmu ones separately. Also add a configuration struct for all different phy that hold the difference between them (number of phys, unknow needed register write etc ...). While here remove A83T code as upstream and FreeBSD dts don't have nodes for USB. This (plus 323640) re-enable OHCI on Pine64 on the bottom USB port. The top USB port is routed to the OHCI0/EHCI0 which is by default in OTG mode. While the phy code can handle the re-route to standard OHCI/EHCI we still need a driver for musb to probe and configure it in host mode. EHCI is still buggy on Pine64 (hang the board) so do not enable it for now. Tested On: Bananapi (A20), BananapiM2 (A31S), OrangePi One (H3) Pine64 (A64) Modified: head/sys/arm/allwinner/aw_usbphy.c Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Sat Sep 16 15:50:31 2017 (r323640) +++ head/sys/arm/allwinner/aw_usbphy.c Sat Sep 16 15:58:20 2017 (r323641) @@ -53,53 +53,90 @@ __FBSDID("$FreeBSD$"); #include "phy_if.h" -#define USBPHY_NPHYS 4 -#define USBPHY_NRES USBPHY_NPHYS - enum awusbphy_type { AWUSBPHY_TYPE_A10 = 1, AWUSBPHY_TYPE_A13, AWUSBPHY_TYPE_A20, AWUSBPHY_TYPE_A31, - AWUSBPHY_TYPE_A83T, AWUSBPHY_TYPE_H3, AWUSBPHY_TYPE_A64 }; +struct aw_usbphy_conf { + int num_phys; + enum awusbphy_type phy_type; + bool pmu_unk1; + bool phy0_route; +}; + +static const struct aw_usbphy_conf a10_usbphy_conf = { + .num_phys = 3, + .phy_type = AWUSBPHY_TYPE_A10, + .pmu_unk1 = false, + .phy0_route = false, +}; + +static const struct aw_usbphy_conf a13_usbphy_conf = { + .num_phys = 2, + .phy_type = AWUSBPHY_TYPE_A13, + .pmu_unk1 = false, + .phy0_route = false, +}; + +static const struct aw_usbphy_conf a20_usbphy_conf = { + .num_phys = 3, + .phy_type = AWUSBPHY_TYPE_A20, + .pmu_unk1 = false, + .phy0_route = false, +}; + +static const struct aw_usbphy_conf a31_usbphy_conf = { + .num_phys = 3, + .phy_type = AWUSBPHY_TYPE_A31, + .pmu_unk1 = false, + .phy0_route = false, +}; + +static const struct aw_usbphy_conf h3_usbphy_conf = { + .num_phys = 4, + .phy_type = AWUSBPHY_TYPE_H3, + .pmu_unk1 = true, + .phy0_route = false, +}; + +static const struct aw_usbphy_conf a64_usbphy_conf = { + .num_phys = 2, + .phy_type = AWUSBPHY_TYPE_A64, + .pmu_unk1 = true, + .phy0_route = true, +}; + static struct ofw_compat_data compat_data[] = { - { "allwinner,sun4i-a10-usb-phy", AWUSBPHY_TYPE_A10 }, - { "allwinner,sun5i-a13-usb-phy", AWUSBPHY_TYPE_A13 }, - { "allwinner,sun6i-a31-usb-phy", AWUSBPHY_TYPE_A31 }, - { "allwinner,sun7i-a20-usb-phy", AWUSBPHY_TYPE_A20 }, - { "allwinner,sun8i-a83t-usb-phy", AWUSBPHY_TYPE_A83T }, - { "allwinner,sun8i-h3-usb-phy", AWUSBPHY_TYPE_H3 }, - { "allwinner,sun50i-a64-usb-phy", AWUSBPHY_TYPE_A64 }, + { "allwinner,sun4i-a10-usb-phy", (uintptr_t)&a10_usbphy_conf }, + { "allwinner,sun5i-a13-usb-phy", (uintptr_t)&a13_usbphy_conf }, + { "allwinner,sun6i-a31-usb-phy", (uintptr_t)&a31_usbphy_conf }, + { "allwinner,sun7i-a20-usb-phy", (uintptr_t)&a20_usbphy_conf }, + { "allwinner,sun8i-h3-usb-phy", (uintptr_t)&h3_usbphy_conf }, + { "allwinner,sun50i-a64-usb-phy", (uintptr_t)&a64_usbphy_conf }, { NULL, 0 } }; struct awusbphy_softc { - struct resource * res[USBPHY_NRES]; - regulator_t reg[USBPHY_NPHYS]; + struct resource * phy_ctrl; + struct resource ** pmu; + regulator_t * reg; gpio_pin_t id_det_pin; int id_det_valid; gpio_pin_t vbus_det_pin; int vbus_det_valid; - enum awusbphy_type phy_type; + struct aw_usbphy_conf *phy_conf; }; -static struct resource_spec awusbphy_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_MEMORY, 1, RF_ACTIVE }, - { SYS_RES_MEMORY, 2, RF_ACTIVE | RF_OPTIONAL }, - { SYS_RES_MEMORY, 3, RF_ACTIVE | RF_OPTIONAL }, - { -1, 0 } -}; +#define RD4(res, o) bus_read_4(res, (o)) +#define WR4(res, o, v) bus_write_4(res, (o), (v)) +#define CLR4(res, o, m) WR4(res, o, RD4(res, o) & ~(m)) +#define SET4(res, o, m) WR4(res, o, RD4(res, o) | (m)) -#define RD4(sc, i, o) bus_read_4((sc)->res[(i)], (o)) -#define WR4(sc, i, o, v) bus_write_4((sc)->res[(i)], (o), (v)) -#define CLR4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) & ~(m)) -#define SET4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) | (m)) - #define OTG_PHY_CFG 0x20 #define OTG_PHY_ROUTE_OTG (1 << 0) #define PMU_IRQ_ENABLE 0x00 @@ -117,24 +154,21 @@ awusbphy_configure(device_t dev, int phyno) sc = device_get_softc(dev); - if (sc->res[phyno] == NULL) + if (sc->pmu[phyno] == NULL) return; - if (sc->phy_type == AWUSBPHY_TYPE_A64) { - CLR4(sc, phyno, PMU_UNK_H3, PMU_UNK_H3_CLR); + if (sc->phy_conf->pmu_unk1 == true) + CLR4(sc->phy_ctrl, PMU_UNK_H3, PMU_UNK_H3_CLR); - /* EHCI0 and OTG share a PHY */ + if (sc->phy_conf->phy0_route == true) { if (phyno == 0) - SET4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG); - else if (phyno == 1) - CLR4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG); + SET4(sc->phy_ctrl, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG); + else + CLR4(sc->phy_ctrl, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG); } - if (phyno > 0) { - /* Enable passby */ - SET4(sc, phyno, PMU_IRQ_ENABLE, PMU_ULPI_BYPASS | - PMU_AHB_INCR8 | PMU_AHB_INCR4 | PMU_AHB_INCRX_ALIGN); - } + SET4(sc->pmu[phyno], PMU_IRQ_ENABLE, PMU_ULPI_BYPASS | + PMU_AHB_INCR8 | PMU_AHB_INCR4 | PMU_AHB_INCRX_ALIGN); } static int @@ -143,7 +177,7 @@ awusbphy_init(device_t dev) struct awusbphy_softc *sc; phandle_t node; char pname[20]; - int error, off; + int error, off, rid; regulator_t reg; hwreset_t rst; clk_t clk; @@ -151,8 +185,20 @@ awusbphy_init(device_t dev) sc = device_get_softc(dev); node = ofw_bus_get_node(dev); - sc->phy_type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + sc->phy_conf = (struct aw_usbphy_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + /* Get phy_ctrl region */ + if (ofw_bus_find_string_index(node, "reg-names", "phy_ctrl", &rid) != 0) { + device_printf(dev, "Cannot locate phy control resource\n"); + return (ENXIO); + } + sc->phy_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->phy_ctrl == NULL) { + device_printf(dev, "Cannot allocate resource\n"); + return (ENXIO); + } + /* Enable clocks */ for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) { error = clk_enable(clk); @@ -173,13 +219,6 @@ awusbphy_init(device_t dev) } } - /* Get regulators */ - for (off = 0; off < USBPHY_NPHYS; off++) { - snprintf(pname, sizeof(pname), "usb%d_vbus-supply", off); - if (regulator_get_by_ofw_property(dev, 0, pname, ®) == 0) - sc->reg[off] = reg; - } - /* Get GPIOs */ error = gpio_pin_get_by_ofw_property(dev, node, "usb0_id_det-gpios", &sc->id_det_pin); @@ -190,10 +229,29 @@ awusbphy_init(device_t dev) if (error == 0) sc->vbus_det_valid = 1; - /* Allocate resources */ - if (bus_alloc_resources(dev, awusbphy_spec, sc->res) != 0) - device_printf(dev, "couldn't allocate resources\n"); + sc->reg = malloc(sizeof(*(sc->reg)) * sc->phy_conf->num_phys, M_DEVBUF, + M_WAITOK | M_ZERO); + sc->pmu = malloc(sizeof(*(sc->pmu)) * sc->phy_conf->num_phys, M_DEVBUF, + M_WAITOK | M_ZERO); + /* Get regulators */ + for (off = 0; off < sc->phy_conf->num_phys; off++) { + snprintf(pname, sizeof(pname), "usb%d_vbus-supply", off); + if (regulator_get_by_ofw_property(dev, 0, pname, ®) == 0) + sc->reg[off] = reg; + snprintf(pname, sizeof(pname), "pmu%d", off); + if (ofw_bus_find_string_index(node, "reg-names", + pname, &rid) != 0) + continue; + + sc->pmu[off] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->pmu[off] == NULL) { + device_printf(dev, "Cannot allocate resource\n"); + return (ENXIO); + } + } + return (0); } @@ -225,10 +283,10 @@ awusbphy_phy_enable(device_t dev, intptr_t phy, bool e regulator_t reg; int error, vbus_det; - if (phy < 0 || phy >= USBPHY_NPHYS) - return (ERANGE); - sc = device_get_softc(dev); + + if (phy < 0 || phy >= sc->phy_conf->num_phys) + return (ERANGE); /* Configure PHY */ awusbphy_configure(dev, phy); From owner-svn-src-all@freebsd.org Sat Sep 16 16:09:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F23FE1F24C; Sat, 16 Sep 2017 16:09:07 +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 EA24C7EB18; Sat, 16 Sep 2017 16:09:06 +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 v8GG96ud038802; Sat, 16 Sep 2017 16:09:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GG95ft038796; Sat, 16 Sep 2017 16:09:05 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201709161609.v8GG95ft038796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 16 Sep 2017 16:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323642 - in head/sys/modules/i2c: ds1307 ds13rtc ds3231 isl12xx nxprtc s35390a X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/modules/i2c: ds1307 ds13rtc ds3231 isl12xx nxprtc s35390a X-SVN-Commit-Revision: 323642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 16:09:07 -0000 Author: ian Date: Sat Sep 16 16:09:05 2017 New Revision: 323642 URL: https://svnweb.freebsd.org/changeset/base/323642 Log: Add a missing header file to SRCS to fix out-of-kernel builds. PR: 222354 Submitted by: eugen@ Pointy hat: ian@ Modified: head/sys/modules/i2c/ds1307/Makefile head/sys/modules/i2c/ds13rtc/Makefile head/sys/modules/i2c/ds3231/Makefile head/sys/modules/i2c/isl12xx/Makefile head/sys/modules/i2c/nxprtc/Makefile head/sys/modules/i2c/s35390a/Makefile Modified: head/sys/modules/i2c/ds1307/Makefile ============================================================================== --- head/sys/modules/i2c/ds1307/Makefile Sat Sep 16 15:58:20 2017 (r323641) +++ head/sys/modules/i2c/ds1307/Makefile Sat Sep 16 16:09:05 2017 (r323642) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = ds1307 -SRCS = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h +SRCS = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h .include Modified: head/sys/modules/i2c/ds13rtc/Makefile ============================================================================== --- head/sys/modules/i2c/ds13rtc/Makefile Sat Sep 16 15:58:20 2017 (r323641) +++ head/sys/modules/i2c/ds13rtc/Makefile Sat Sep 16 16:09:05 2017 (r323642) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = ds13rtc -SRCS = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h +SRCS = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h .include Modified: head/sys/modules/i2c/ds3231/Makefile ============================================================================== --- head/sys/modules/i2c/ds3231/Makefile Sat Sep 16 15:58:20 2017 (r323641) +++ head/sys/modules/i2c/ds3231/Makefile Sat Sep 16 16:09:05 2017 (r323642) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = ds3231 -SRCS = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h +SRCS = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h .include Modified: head/sys/modules/i2c/isl12xx/Makefile ============================================================================== --- head/sys/modules/i2c/isl12xx/Makefile Sat Sep 16 15:58:20 2017 (r323641) +++ head/sys/modules/i2c/isl12xx/Makefile Sat Sep 16 16:09:05 2017 (r323642) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = isl12xx -SRCS = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h +SRCS = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h .include Modified: head/sys/modules/i2c/nxprtc/Makefile ============================================================================== --- head/sys/modules/i2c/nxprtc/Makefile Sat Sep 16 15:58:20 2017 (r323641) +++ head/sys/modules/i2c/nxprtc/Makefile Sat Sep 16 16:09:05 2017 (r323642) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = nxprtc -SRCS = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h +SRCS = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h .include Modified: head/sys/modules/i2c/s35390a/Makefile ============================================================================== --- head/sys/modules/i2c/s35390a/Makefile Sat Sep 16 15:58:20 2017 (r323641) +++ head/sys/modules/i2c/s35390a/Makefile Sat Sep 16 16:09:05 2017 (r323642) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = s35390a -SRCS = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h +SRCS = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h opt_platform.h .include From owner-svn-src-all@freebsd.org Sat Sep 16 16:23:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24675E1FE4B; Sat, 16 Sep 2017 16:23:02 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7A307F574; Sat, 16 Sep 2017 16:23:01 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8GGN1Al047006; Sat, 16 Sep 2017 16:23:01 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GGN1Qb047005; Sat, 16 Sep 2017 16:23:01 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201709161623.v8GGN1Qb047005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sat, 16 Sep 2017 16:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323645 - head/sbin/sysctl X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/sbin/sysctl X-SVN-Commit-Revision: 323645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 16:23:02 -0000 Author: allanjude Date: Sat Sep 16 16:23:00 2017 New Revision: 323645 URL: https://svnweb.freebsd.org/changeset/base/323645 Log: kern.osreldate is an integer, not a string PR: 217501 Submitted by: Yavuz Tanriverdi MFC after: 1 week Modified: head/sbin/sysctl/sysctl.8 Modified: head/sbin/sysctl/sysctl.8 ============================================================================== --- head/sbin/sysctl/sysctl.8 Sat Sep 16 16:17:08 2017 (r323644) +++ head/sbin/sysctl/sysctl.8 Sat Sep 16 16:23:00 2017 (r323645) @@ -214,7 +214,7 @@ String and integer values can be set using .It "kern.filedelay integer yes" .It "kern.dirdelay integer yes" .It "kern.metadelay integer yes" -.It "kern.osreldate string no" +.It "kern.osreldate integer no" .It "kern.bootfile string yes" .It "kern.corefile string yes" .It "kern.logsigexit integer yes" From owner-svn-src-all@freebsd.org Sat Sep 16 17:50:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DEC0E246F8; Sat, 16 Sep 2017 17:50:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D115F82AE7; Sat, 16 Sep 2017 17:50:25 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8GHoOi0082411; Sat, 16 Sep 2017 17:50:24 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GHoOoH082410; Sat, 16 Sep 2017 17:50:24 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201709161750.v8GHoOoH082410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 16 Sep 2017 17:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323654 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 323654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 17:50:26 -0000 Author: oshogbo Date: Sat Sep 16 17:50:24 2017 New Revision: 323654 URL: https://svnweb.freebsd.org/changeset/base/323654 Log: Fix names of the array functions in the nv man page. Submitted by: def@ MFC after: 1 week Modified: head/share/man/man9/nv.9 Modified: head/share/man/man9/nv.9 ============================================================================== --- head/share/man/man9/nv.9 Sat Sep 16 16:37:18 2017 (r323653) +++ head/share/man/man9/nv.9 Sat Sep 16 17:50:24 2017 (r323654) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 15, 2015 +.Dd September 16, 2017 .Dt NV 9 .Os .Sh NAME @@ -201,11 +201,11 @@ .Ft "const bool *" .Fn nvlist_get_bool_array "const nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "const uint64_t *" -.Fn nvlist_get_number "const nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_get_number_array "const nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "const char * const *" -.Fn nvlist_get_string "const nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_get_string_array "const nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "const nvlist_t * const *" -.Fn nvlist_get_nvlist "const nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_get_nvlist_array "const nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "const int *" .Fn nvlist_get_descriptor_array "const nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "const nvlist_t *" @@ -230,13 +230,13 @@ .Ft "bool *" .Fn nvlist_take_bool_array "nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "uint64_t **" -.Fn nvlist_take_number "nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_take_number_array "nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "char **" -.Fn nvlist_take_string "nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_take_string_array "nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "nvlist_t **" -.Fn nvlist_take_nvlist "nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_take_nvlist_array "nvlist_t *nvl" "const char *name" "size_t *nitems" .Ft "int *" -.Fn nvlist_take_descriptor "nvlist_t *nvl" "const char *name" "size_t *nitems" +.Fn nvlist_take_descriptor_array "nvlist_t *nvl" "const char *name" "size_t *nitems" .\" .Ft void .Fn nvlist_free "nvlist_t *nvl" "const char *name" From owner-svn-src-all@freebsd.org Sat Sep 16 17:52:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35DB4E2497F; Sat, 16 Sep 2017 17:52:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 125D182E7D; Sat, 16 Sep 2017 17:52:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8GHqPBT086250; Sat, 16 Sep 2017 17:52:25 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GHqP5V086249; Sat, 16 Sep 2017 17:52:25 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201709161752.v8GHqP5V086249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 16 Sep 2017 17:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323655 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 323655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 17:52:26 -0000 Author: oshogbo Date: Sat Sep 16 17:52:25 2017 New Revision: 323655 URL: https://svnweb.freebsd.org/changeset/base/323655 Log: Add missing links to the nv man page. MFC after: 1 week Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Sep 16 17:50:24 2017 (r323654) +++ head/share/man/man9/Makefile Sat Sep 16 17:52:25 2017 (r323655) @@ -1316,13 +1316,18 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist.9 \ nv.9 nvlist_add_binary.9 \ nv.9 nvlist_add_bool.9 \ + nv.9 nvlist_add_bool_array.9 \ nv.9 nvlist_add_descriptor.9 \ + nv.9 nvlist_add_descriptor_array.9 \ nv.9 nvlist_add_null.9 \ nv.9 nvlist_add_number.9 \ + nv.9 nvlist_add_number_array.9 \ nv.9 nvlist_add_nvlist.9 \ + nv.9 nvlist_add_nvlist_array.9 \ nv.9 nvlist_add_string.9 \ nv.9 nvlist_add_stringf.9 \ nv.9 nvlist_add_stringv.9 \ + nv.9 nvlist_add_string_array.9 \ nv.9 nvlist_clone.9 \ nv.9 nvlist_create.9 \ nv.9 nvlist_destroy.9 \ @@ -1332,10 +1337,14 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist_exists.9 \ nv.9 nvlist_exists_binary.9 \ nv.9 nvlist_exists_bool.9 \ + nv.9 nvlist_exists_bool_array.9 \ nv.9 nvlist_exists_descriptor.9 \ + nv.9 nvlist_exists_descriptor_array.9 \ nv.9 nvlist_exists_null.9 \ nv.9 nvlist_exists_number.9 \ + nv.9 nvlist_exists_number_array.9 \ nv.9 nvlist_exists_nvlist.9 \ + nv.9 nvlist_exists_nvlist_array.9 \ nv.9 nvlist_exists_string.9 \ nv.9 nvlist_exists_type.9 \ nv.9 nvlist_fdump.9 \ @@ -1343,23 +1352,36 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist_free.9 \ nv.9 nvlist_free_binary.9 \ nv.9 nvlist_free_bool.9 \ + nv.9 nvlist_free_bool_array.9 \ nv.9 nvlist_free_descriptor.9 \ + nv.9 nvlist_free_descriptor_array.9 \ nv.9 nvlist_free_null.9 \ nv.9 nvlist_free_number.9 \ + nv.9 nvlist_free_number_array.9 \ nv.9 nvlist_free_nvlist.9 \ + nv.9 nvlist_free_nvlist_array.9 \ nv.9 nvlist_free_string.9 \ + nv.9 nvlist_free_string_array.9 \ nv.9 nvlist_free_type.9 \ nv.9 nvlist_get_binary.9 \ nv.9 nvlist_get_bool.9 \ + nv.9 nvlist_get_bool_array.9 \ nv.9 nvlist_get_descriptor.9 \ + nv.9 nvlist_get_descriptor_array.9 \ nv.9 nvlist_get_number.9 \ + nv.9 nvlist_get_number_array.9 \ nv.9 nvlist_get_nvlist.9 \ + nv.9 nvlist_get_nvlist_array.9 \ nv.9 nvlist_get_parent.9 \ nv.9 nvlist_get_string.9 \ + nv.9 nvlist_get_string_array.9 \ nv.9 nvlist_move_binary.9 \ nv.9 nvlist_move_descriptor.9 \ + nv.9 nvlist_move_descriptor_array.9 \ nv.9 nvlist_move_nvlist.9 \ + nv.9 nvlist_move_nvlist_array.9 \ nv.9 nvlist_move_string.9 \ + nv.9 nvlist_move_string_array.9 \ nv.9 nvlist_next.9 \ nv.9 nvlist_pack.9 \ nv.9 nvlist_recv.9 \ @@ -1368,10 +1390,15 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist_size.9 \ nv.9 nvlist_take_binary.9 \ nv.9 nvlist_take_bool.9 \ + nv.9 nvlist_take_bool_array.9 \ nv.9 nvlist_take_descriptor.9 \ + nv.9 nvlist_take_descriptor_array.9 \ nv.9 nvlist_take_number.9 \ + nv.9 nvlist_take_number_array.9 \ nv.9 nvlist_take_nvlist.9 \ + nv.9 nvlist_take_nvlist_array.9 \ nv.9 nvlist_take_string.9 \ + nv.9 nvlist_take_string_array.9 \ nv.9 nvlist_unpack.9 \ nv.9 nvlist_xfer.9 MLINKS+=osd.9 osd_call.9 \ From owner-svn-src-all@freebsd.org Sat Sep 16 18:12:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38749E2582C; Sat, 16 Sep 2017 18:12:17 +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 0FD61837AE; Sat, 16 Sep 2017 18:12:16 +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 v8GICG1L091257; Sat, 16 Sep 2017 18:12:16 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GICGNp091243; Sat, 16 Sep 2017 18:12:16 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709161812.v8GICGNp091243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 16 Sep 2017 18:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323656 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 18:12:17 -0000 Author: alc Date: Sat Sep 16 18:12:15 2017 New Revision: 323656 URL: https://svnweb.freebsd.org/changeset/base/323656 Log: Modify blst_leaf_alloc to take only the cursor argument. Modify blst_leaf_alloc to find allocations that cross the boundary between one leaf node and the next when those two leaves descend from the same meta node. Update the hint field for leaves so that it represents a bound on how large an allocation can begin in that leaf, where it currently represents a bound on how large an allocation can be found within the boundaries of the leaf. The first phase of blst_leaf_alloc currently shrinks sequences of consecutive 1-bits in mask until each has been shrunken by count-1 bits, so that any bits remaining show where an allocation can begin, or until all the bits have disappeared, in which case the allocation fails. This change amends that so that the high-order bit is copied, as if, when the last block was free, it was followed by an endless stream of free blocks. It also amends the early stopping condition, so that the shrinking of 1-sequences stops early when there are none, or there is only one unbounded one remaining. The search for the first set bit is unchanged, and the code path thereafter is mostly unchanged unless the first set bit is in a position that makes some of those copied sign bits matter. In that case, we look for a next leaf, and at what blocks it can provide, to see if a cross-boundary allocation is possible. The hint is updated on a successful allocation that clears the last bit, but it not updated on a failed allocation that leaves the last bit set. So, as long as the last block is free, the hint value for the leaf is large. As long as the last block is free, and there's a next leaf, a large allocation can begin here, perhaps. A stricter rule than this would mean that allocations and frees in one leaf could require hint updates to the preceding leaf, and this change seeks to leave the freeing code unmodified. Define BLIST_BMAP_MASK, and use it for bit masking in blst_leaf_free and blist_leaf_fill, as well as in blst_leaf_alloc. Correct a panic message in blst_leaf_free. Submitted by: Doug Moore Reviewed by: markj (an earlier version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11819 Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Sat Sep 16 17:52:25 2017 (r323655) +++ head/sys/kern/subr_blist.c Sat Sep 16 18:12:15 2017 (r323656) @@ -32,14 +32,17 @@ * try to interpret the meaning of a 'block' other than to return * SWAPBLK_NONE on an allocation failure. * - * A radix tree is used to maintain the bitmap. Two radix constants are - * involved: One for the bitmaps contained in the leaf nodes (typically - * 64), and one for the meta nodes (typically 16). Both meta and leaf - * nodes have a hint field. This field gives us a hint as to the largest - * free contiguous range of blocks under the node. It may contain a - * value that is too high, but will never contain a value that is too - * low. When the radix tree is searched, allocation failures in subtrees - * update the hint. + * A radix tree controls access to pieces of the bitmap, and includes + * auxiliary information at each interior node about the availabilty of + * contiguous free blocks in the subtree rooted at that node. Two radix + * constants are involved: one for the size of the bitmaps contained in the + * leaf nodes (BLIST_BMAP_RADIX), and one for the number of descendents of + * each of the meta (interior) nodes (BLIST_META_RADIX). Each subtree is + * associated with a range of blocks. The root of any subtree stores a + * hint field that defines an upper bound on the size of the largest + * allocation that can begin in the associated block range. A hint is an + * upper bound on a potential allocation, but not necessarily a tight upper + * bound. * * The radix tree also implements two collapsed states for meta nodes: * the ALL-ALLOCATED state and the ALL-FREE state. If a meta node is @@ -112,7 +115,7 @@ __FBSDID("$FreeBSD$"); #define bitcount64(x) __bitcount64((uint64_t)(x)) #define malloc(a,b,c) calloc(a, 1) #define free(a,b) free(a) -#define CTASSERT(expr) +static __inline int imax(int a, int b) { return (a > b ? a : b); } #include @@ -123,8 +126,7 @@ void panic(const char *ctl, ...); /* * static support functions */ -static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, - daddr_t cursor); +static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count); static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_t count, u_daddr_t radix); static void blst_leaf_free(blmeta_t *scan, daddr_t relblk, int count); @@ -145,7 +147,9 @@ static void blst_radix_print(blmeta_t *scan, daddr_t b static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap space"); #endif -CTASSERT(BLIST_BMAP_RADIX % BLIST_META_RADIX == 0); +_Static_assert(BLIST_BMAP_RADIX % BLIST_META_RADIX == 0, + "radix divisibility error"); +#define BLIST_BMAP_MASK (BLIST_BMAP_RADIX - 1) #define BLIST_META_MASK (BLIST_META_RADIX - 1) /* @@ -575,33 +579,16 @@ blist_stats(blist_t bl, struct sbuf *s) * time is proportional to log2(count) + bitpos time. */ static daddr_t -blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, daddr_t cursor) +blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count) { u_daddr_t mask; - int count1, lo, num_shifts, range1, range_ext; + int count1, hi, lo, num_shifts, range1, range_ext; - if (count == BLIST_BMAP_RADIX) { - /* - * Optimize allocation of BLIST_BMAP_RADIX bits. If this wasn't - * a special case, then forming the final value of 'mask' below - * would require special handling to avoid an invalid left shift - * when count equals the number of bits in mask. - */ - if (~scan->u.bmu_bitmap != 0) { - scan->bm_bighint = BLIST_BMAP_RADIX - 1; - return (SWAPBLK_NONE); - } - if (cursor != blk) - return (SWAPBLK_NONE); - scan->u.bmu_bitmap = 0; - scan->bm_bighint = 0; - return (blk); - } range1 = 0; count1 = count - 1; num_shifts = fls(count1); mask = scan->u.bmu_bitmap; - while (mask != 0 && num_shifts > 0) { + while ((-mask & ~mask) != 0 && num_shifts > 0) { /* * If bit i is set in mask, then bits in [i, i+range1] are set * in scan->u.bmu_bitmap. The value of range1 is equal to @@ -609,27 +596,32 @@ blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count * while preserving these invariants. The updates to mask leave * fewer bits set, but each bit that remains set represents a * longer string of consecutive bits set in scan->u.bmu_bitmap. + * If more updates to mask cannot clear more bits, because mask + * is partitioned with all 0 bits preceding all 1 bits, the loop + * terminates immediately. */ num_shifts--; range_ext = range1 + ((count1 >> num_shifts) & 1); - mask &= mask >> range_ext; + /* + * mask is a signed quantity for the shift because when it is + * shifted right, the sign bit should copied; when the last + * block of the leaf is free, pretend, for a while, that all the + * blocks that follow it are also free. + */ + mask &= (daddr_t)mask >> range_ext; range1 += range_ext; } if (mask == 0) { /* * Update bighint. There is no allocation bigger than range1 - * available in this leaf. + * starting in this leaf. */ scan->bm_bighint = range1; return (SWAPBLK_NONE); } - /* - * Discard any candidates that appear before the cursor. - */ - lo = cursor - blk; - mask &= ~(u_daddr_t)0 << lo; - + /* Discard any candidates that appear before blk. */ + mask &= (u_daddr_t)-1 << (blk & BLIST_BMAP_MASK); if (mask == 0) return (SWAPBLK_NONE); @@ -641,13 +633,58 @@ blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count mask &= -mask; lo = bitpos(mask); - /* - * Set in mask exactly the bits being allocated, and clear them from - * the set of available bits. - */ - mask = (mask << count) - mask; + hi = lo + count; + if (hi > BLIST_BMAP_RADIX) { + /* + * An allocation within this leaf is impossible, so a successful + * allocation depends on the next leaf providing some of the blocks. + */ + if (((blk / BLIST_BMAP_RADIX + 1) & BLIST_META_MASK) == 0) { + /* + * The next leaf has a different meta-node parent, so it + * is not necessarily initialized. Update bighint, + * comparing the range found at the end of mask to the + * largest earlier range that could have been made to + * vanish in the initial processing of mask. + */ + scan->bm_bighint = imax(BLIST_BMAP_RADIX - lo, range1); + return (SWAPBLK_NONE); + } + hi -= BLIST_BMAP_RADIX; + if (((scan[1].u.bmu_bitmap + 1) & ~((u_daddr_t)-1 << hi)) != 0) { + /* + * The next leaf doesn't have enough free blocks at the + * beginning to complete the spanning allocation. The + * hint cannot be updated, because the same allocation + * request could be satisfied later, by this leaf, if + * the state of the next leaf changes, and without any + * changes to this leaf. + */ + return (SWAPBLK_NONE); + } + /* Clear the first 'hi' bits in the next leaf, allocating them. */ + scan[1].u.bmu_bitmap &= (u_daddr_t)-1 << hi; + hi = BLIST_BMAP_RADIX; + } + + /* Set the bits of mask at position 'lo' and higher. */ + mask = -mask; + if (hi == BLIST_BMAP_RADIX) { + /* + * Update bighint. There is no allocation bigger than range1 + * available in this leaf after this allocation completes. + */ + scan->bm_bighint = range1; + } else { + /* Clear the bits of mask at position 'hi' and higher. */ + mask &= (u_daddr_t)-1 >> (BLIST_BMAP_RADIX - hi); + /* If this allocation uses all the bits, clear the hint. */ + if (mask == scan->u.bmu_bitmap) + scan->bm_bighint = 0; + } + /* Clear the allocated bits from this leaf. */ scan->u.bmu_bitmap &= ~mask; - return (blk + lo); + return ((blk & ~BLIST_BMAP_MASK) + lo); } /* @@ -665,9 +702,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_ int child; bool scan_from_start; - blk = cursor & -radix; if (radix == BLIST_BMAP_RADIX) - return (blst_leaf_alloc(scan, blk, count, cursor)); + return (blst_leaf_alloc(scan, cursor, count)); if (scan->u.bmu_avail < count) { /* * The meta node's hint must be too large if the allocation @@ -677,6 +713,7 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_ scan->bm_bighint = scan->u.bmu_avail; return (SWAPBLK_NONE); } + blk = cursor & -radix; skip = radix_to_skip(radix); next_skip = skip / BLIST_META_RADIX; @@ -715,7 +752,7 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_ for (i = 1 + child * next_skip; i < skip; i += next_skip) { if (count <= scan[i].bm_bighint) { /* - * The allocation might fit in the i'th subtree. + * The allocation might fit beginning in the i'th subtree. */ r = blst_meta_alloc(&scan[i], cursor > blk ? cursor : blk, count, radix); @@ -748,22 +785,20 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_ static void blst_leaf_free(blmeta_t *scan, daddr_t blk, int count) { + u_daddr_t mask; + int n; + /* * free some data in this bitmap - * - * e.g. - * 0000111111111110000 + * mask=0000111111111110000 * \_________/\__/ - * v n + * count n */ - int n = blk & (BLIST_BMAP_RADIX - 1); - u_daddr_t mask; - + n = blk & BLIST_BMAP_MASK; mask = ((u_daddr_t)-1 << n) & ((u_daddr_t)-1 >> (BLIST_BMAP_RADIX - count - n)); - if (scan->u.bmu_bitmap & mask) - panic("blst_radix_free: freeing free block"); + panic("freeing free block"); scan->u.bmu_bitmap |= mask; /* @@ -944,10 +979,11 @@ blst_copy(blmeta_t *scan, daddr_t blk, daddr_t radix, static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count) { - int n = blk & (BLIST_BMAP_RADIX - 1); daddr_t nblks; u_daddr_t mask; + int n; + n = blk & BLIST_BMAP_MASK; mask = ((u_daddr_t)-1 << n) & ((u_daddr_t)-1 >> (BLIST_BMAP_RADIX - count - n)); @@ -1097,10 +1133,14 @@ blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t count = 0; } else { /* - * Add terminator and break out + * Add terminator and break out. Make terminator bitmap + * zero to avoid a spanning leaf allocation that + * includes the terminator. */ - if (scan) + if (scan) { scan[i].bm_bighint = (daddr_t)-1; + scan[i].u.bmu_bitmap = 0; + } break; } } From owner-svn-src-all@freebsd.org Sat Sep 16 19:02:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61C35E0202E; Sat, 16 Sep 2017 19:02:02 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.imp.ch (smtp.imp.ch [IPv6:2001:4060:1:1001::13:196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 283B2FB0; Sat, 16 Sep 2017 19:02:02 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from [192.168.225.14] (dhclient-91-190-10-49.flashcable.ch [91.190.10.49]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPSA id 36EF9C06CD; Sat, 16 Sep 2017 21:01:56 +0200 (CEST) Subject: Re: svn commit: r323290 - head/sys/vm To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709072143.v87Lhdsg060310@repo.freebsd.org> <20170914203232.GA72190@bish> From: Andreas Tobler Message-ID: <67bb96f2-da01-8bce-65ba-bf811f51e56d@FreeBSD.org> Date: Sat, 16 Sep 2017 21:01:56 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170914203232.GA72190@bish> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 7bit X-Scanned-By: Obelix Submit on 127.0.1.1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 19:02:02 -0000 On 14.09.17 22:32, Mark Johnston wrote: > On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote: >> Hi Mark, >> >> On 07.09.17 23:43, Mark Johnston wrote: >>> Author: markj >>> Date: Thu Sep 7 21:43:39 2017 >>> New Revision: 323290 >>> URL: https://svnweb.freebsd.org/changeset/base/323290 >>> >>> Log: >>> Speed up vm_page_array initialization. >>> >>> We currently initialize the vm_page array in three passes: one to zero >>> the array, one to initialize the "order" field of each page (necessary >>> when inserting them into the vm_phys buddy allocator one-by-one), and >>> one to initialize the remaining non-zero fields and individually insert >>> each page into the allocator. >>> >>> Merge the three passes into one following a suggestion from alc: >>> initialize vm_page fields in a single pass, and use vm_phys_free_contig() >>> to efficiently insert physical memory segments into the buddy allocator. >>> This reduces the initialization time to a third or a quarter of what it >>> was before on most systems that I tested. >>> >>> Reviewed by: alc, kib >>> MFC after: 3 weeks >>> Differential Revision: https://reviews.freebsd.org/D12248 >>> >>> Modified: >>> head/sys/vm/vm_page.c >>> head/sys/vm/vm_phys.c >>> head/sys/vm/vm_phys.h >> >> I just found out that this commit breaks booting my powerpc64 Quad G5. >> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue]. >> >> Sometimes it hangs earlier when the kbd is not there yet (usb), then I >> can't get the process/task where it hangs. >> >> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD) >> >> Any ideas how to find out what's wrong? > > Are you able to break into DDB when the hang occurs? If so, the output > of "show page" would be helpful. Unfortunately not from the beginning. The keyboard is usb and it gets installed late. Once it survives the loading of the kbd and co, I can enter into ddb. But it is a trial and error. So far I didn't succeed to come that far. > Are you running with INVARIANTS configured? If not, please try that. The above was w/o INVARIANTS. With invariants the kernel panics immediately after boot, see pic. >> The previous revision, r323289 seems stable, at least it survived >> several kernel builds. > > Could you apply the patch below and capture the first page or so of > output from after the kernel starts booting? I applied this diff and you see its output on the pic: https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg I try now to get that far that I have a kbd and capture a 'show page'. Thanks, Andreas From owner-svn-src-all@freebsd.org Sat Sep 16 20:32:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E0D6E0717D; Sat, 16 Sep 2017 20:32:36 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3F1A3E69; Sat, 16 Sep 2017 20:32:35 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x236.google.com with SMTP id q132so5000898lfe.5; Sat, 16 Sep 2017 13:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UUqrDg0+EZIsLXxmt4FSpUUiOjbnwFLWUyFfAkMdnwk=; b=SIVNem8VqoDy2mODtGCATB0Cn6yApngM6NXXpq8BPAt6xX83OUrJCyLwJg45eh8pDJ vzFhlryKaO9kSHbeeDIcXKd8DqLgG8tYJGox3kdmiJzEeic3Qv2QuT3zEVVkwdeDMjgP f7ZFReTSENH9hUlDnSBmoCqDu4ZygLovxguhblyPb3YuxkMPe31FTicEVHaJcOoym5Wl UBxFml5FZBqZq00q5uEHDY3M+GPxV7vaDLZUqUPaKHOTVNHk8BWMeOQjDt5+DbPClJuW /TUqqmbXpNBNhGf4tHna8WDmp7j+6wDBJrhyDKGjtUwi1bMKu+WoaMeRCyKPcIwYaTpk Fcsw== 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=UUqrDg0+EZIsLXxmt4FSpUUiOjbnwFLWUyFfAkMdnwk=; b=lrH3uaOkIyJDQRGdLM9tTujxnv2SB6QxfHhOVzyjdNMyMQgYXE/hlchYi1xM19H/JM 3W55NZhL8gNMsdqIjNTfyzWM5qXX5acY3dMXzRpoKb5ID1G2ZlBQXVkz6pNGe/rAC4jQ Yzz5YJutYqAw8XaunNnzTr6qXzRxGR7l2gi13BCsV4PfA396/xdd8G4c5lQmFGbmwlLt iPybUwSq7wAxu7C/AgnZvMqfLKmVK1eLhQriS60T86GRJ4/RRH+wZ25Yn4UjKYvFPScY IHG2SFqi7WtnJlQhkq/Nvuc81txkT9/EmX+VcBjLIpQacL3G2YB5R2qWuGPiCvys2Tnd oR4A== X-Gm-Message-State: AHPjjUj9mNtiMhNIjXdEGpwubjldl/vuJgBdJmX23XTfqS4+88qBu5/6 +0Pu5Xnd575oWPxmtCHHLBP9uKqkgpkYewUUj9I= X-Google-Smtp-Source: AOwi7QBVIZ+kgXtj9qxfy9N6xZ0s4ppbQzoKdoFBzB2Gn5X/bi7r/HTF462tvTHmnfBUG12+PLKk9PlJab5y4NipsKw= X-Received: by 10.25.212.209 with SMTP id l200mr1675949lfg.13.1505593953795; Sat, 16 Sep 2017 13:32:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.87.65 with HTTP; Sat, 16 Sep 2017 13:32:33 -0700 (PDT) Received: by 10.46.87.65 with HTTP; Sat, 16 Sep 2017 13:32:33 -0700 (PDT) In-Reply-To: <67bb96f2-da01-8bce-65ba-bf811f51e56d@FreeBSD.org> References: <201709072143.v87Lhdsg060310@repo.freebsd.org> <20170914203232.GA72190@bish> <67bb96f2-da01-8bce-65ba-bf811f51e56d@FreeBSD.org> From: Justin Hibbits Date: Sat, 16 Sep 2017 15:32:33 -0500 Message-ID: Subject: Re: svn commit: r323290 - head/sys/vm To: Andreas Tobler Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mark Johnston Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 20:32:36 -0000 On Sep 16, 2017 14:02, "Andreas Tobler" wrote: On 14.09.17 22:32, Mark Johnston wrote: > On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote: > >> Hi Mark, >> >> On 07.09.17 23:43, Mark Johnston wrote: >> >>> Author: markj >>> Date: Thu Sep 7 21:43:39 2017 >>> New Revision: 323290 >>> URL: https://svnweb.freebsd.org/changeset/base/323290 >>> >>> Log: >>> Speed up vm_page_array initialization. >>> We currently initialize the vm_page array in three passes: one >>> to zero >>> the array, one to initialize the "order" field of each page >>> (necessary >>> when inserting them into the vm_phys buddy allocator one-by-one), and >>> one to initialize the remaining non-zero fields and individually >>> insert >>> each page into the allocator. >>> Merge the three passes into one following a suggestion from alc: >>> initialize vm_page fields in a single pass, and use >>> vm_phys_free_contig() >>> to efficiently insert physical memory segments into the buddy >>> allocator. >>> This reduces the initialization time to a third or a quarter of what >>> it >>> was before on most systems that I tested. >>> Reviewed by: alc, kib >>> MFC after: 3 weeks >>> Differential Revision: https://reviews.freebsd.org/D12248 >>> >>> Modified: >>> head/sys/vm/vm_page.c >>> head/sys/vm/vm_phys.c >>> head/sys/vm/vm_phys.h >>> >> >> I just found out that this commit breaks booting my powerpc64 Quad G5. >> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue]. >> >> Sometimes it hangs earlier when the kbd is not there yet (usb), then I >> can't get the process/task where it hangs. >> >> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD) >> >> Any ideas how to find out what's wrong? >> > > Are you able to break into DDB when the hang occurs? If so, the output > of "show page" would be helpful. > Unfortunately not from the beginning. The keyboard is usb and it gets installed late. Once it survives the loading of the kbd and co, I can enter into ddb. But it is a trial and error. So far I didn't succeed to come that far. What about using dcons? That's saved me many times when I couldn't break into ddb from the console. Are you running with INVARIANTS configured? If not, please try that. > The above was w/o INVARIANTS. With invariants the kernel panics immediately after boot, see pic. The previous revision, r323289 seems stable, at least it survived >> several kernel builds. >> > > Could you apply the patch below and capture the first page or so of > output from after the kernel starts booting? > I applied this diff and you see its output on the pic: https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg I try now to get that far that I have a kbd and capture a 'show page'. Thanks, Andreas From owner-svn-src-all@freebsd.org Sat Sep 16 20:52:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4A31E08270; Sat, 16 Sep 2017 20:52:49 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.imp.ch (smtp.imp.ch [157.161.13.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7985363A59; Sat, 16 Sep 2017 20:52:49 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from [192.168.225.14] (dhclient-91-190-10-49.flashcable.ch [91.190.10.49]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPSA id 1FC85C1924; Sat, 16 Sep 2017 22:52:41 +0200 (CEST) Subject: Re: svn commit: r323290 - head/sys/vm To: Justin Hibbits Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mark Johnston References: <201709072143.v87Lhdsg060310@repo.freebsd.org> <20170914203232.GA72190@bish> <67bb96f2-da01-8bce-65ba-bf811f51e56d@FreeBSD.org> From: Andreas Tobler Message-ID: Date: Sat, 16 Sep 2017 22:52:40 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; 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: de-CH Content-Transfer-Encoding: 8bit X-Scanned-By: Asterix Submit on 127.0.1.1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 20:52:49 -0000 On 16.09.17 22:32, Justin Hibbits wrote: > > > On Sep 16, 2017 14:02, "Andreas Tobler" > wrote: > > On 14.09.17 22:32, Mark Johnston wrote: > > On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote: > > Hi Mark, > > On 07.09.17 23:43, Mark Johnston wrote: > > Author: markj > Date: Thu Sep  7 21:43:39 2017 > New Revision: 323290 > URL: https://svnweb.freebsd.org/changeset/base/323290 > > > Log: >     Speed up vm_page_array initialization. >         We currently initialize the vm_page array in > three passes: one to zero >     the array, one to initialize the "order" field of > each page (necessary >     when inserting them into the vm_phys buddy > allocator one-by-one), and >     one to initialize the remaining non-zero fields and > individually insert >     each page into the allocator. >         Merge the three passes into one following a > suggestion from alc: >     initialize vm_page fields in a single pass, and use > vm_phys_free_contig() >     to efficiently insert physical memory segments into > the buddy allocator. >     This reduces the initialization time to a third or > a quarter of what it >     was before on most systems that I tested. >         Reviewed by:    alc, kib >     MFC after:  3 weeks >     Differential Revision: > https://reviews.freebsd.org/D12248 > > > Modified: >     head/sys/vm/vm_page.c >     head/sys/vm/vm_phys.c >     head/sys/vm/vm_phys.h > > > I just found out that this commit breaks booting my > powerpc64 Quad G5. > It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue]. > > Sometimes it hangs earlier when the kbd is not there yet > (usb), then I > can't get the process/task where it hangs. > > Note, this kernel is compiled with the default gcc > (4.2.1-FreeBSD) > > Any ideas how to find out what's wrong? > > > Are you able to break into DDB when the hang occurs? If so, the > output > of "show page" would be helpful. > > > Unfortunately not from the beginning. The keyboard is usb and it > gets installed late. Once it survives the loading of the kbd and co, > I can enter into ddb. But it is a trial and error. So far I didn't > succeed to come that far. > > > What about using dcons? That's saved me many times when I couldn't break > into ddb from the console. Might be worth a try, but as you might have seen on the pic, the panic happens immediately after printing the banner. At that time no driver is available. It might work when I try w/o invariants and have luck and get past the fwohci init. Thx, Andreas From owner-svn-src-all@freebsd.org Sat Sep 16 21:26:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E65DDE09B8E; Sat, 16 Sep 2017 21:26: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 B99BE64623; Sat, 16 Sep 2017 21:26:07 +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 v8GLQ6AR070848; Sat, 16 Sep 2017 21:26:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8GLQ6E2070843; Sat, 16 Sep 2017 21:26:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201709162126.v8GLQ6E2070843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Sep 2017 21:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323657 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 323657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 21:26:08 -0000 Author: tuexen Date: Sat Sep 16 21:26:06 2017 New Revision: 323657 URL: https://svnweb.freebsd.org/changeset/base/323657 Log: Remove code not used on any platform currently supported. MFC after: 1 week Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_pcb.h head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Sep 16 18:12:15 2017 (r323656) +++ head/sys/netinet/sctp.h Sat Sep 16 21:26:06 2017 (r323657) @@ -545,7 +545,6 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x0000000000000010 #define SCTP_PCB_FLAGS_DO_ASCONF 0x0000000000000020 #define SCTP_PCB_FLAGS_AUTO_ASCONF 0x0000000000000040 -#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x0000000000000080 /* socket options */ #define SCTP_PCB_FLAGS_NODELAY 0x0000000000000100 #define SCTP_PCB_FLAGS_AUTOCLOSE 0x0000000000000200 Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Sep 16 18:12:15 2017 (r323656) +++ head/sys/netinet/sctp_constants.h Sat Sep 16 21:26:06 2017 (r323657) @@ -555,11 +555,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_TIMER_TYPE_INPKILL 15 #define SCTP_TIMER_TYPE_ASOCKILL 16 #define SCTP_TIMER_TYPE_ADDR_WQ 17 -#define SCTP_TIMER_TYPE_ZERO_COPY 18 -#define SCTP_TIMER_TYPE_ZCOPY_SENDQ 19 -#define SCTP_TIMER_TYPE_PRIM_DELETED 20 +#define SCTP_TIMER_TYPE_PRIM_DELETED 18 /* add new timers here - and increment LAST */ -#define SCTP_TIMER_TYPE_LAST 21 +#define SCTP_TIMER_TYPE_LAST 19 #define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \ ((t) < SCTP_TIMER_TYPE_LAST)) Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sat Sep 16 18:12:15 2017 (r323656) +++ head/sys/netinet/sctp_os_bsd.h Sat Sep 16 21:26:06 2017 (r323657) @@ -404,11 +404,6 @@ typedef struct rtentry sctp_rtentry_t; #define SCTP_RTALLOC(ro, vrf_id, fibnum) \ rtalloc_ign_fib((struct route *)ro, 0UL, fibnum) -/* Future zero copy wakeup/send function */ -#define SCTP_ZERO_COPY_EVENT(inp, so) -/* This is re-pulse ourselves for sendbuf */ -#define SCTP_ZERO_COPY_SENDQ_EVENT(inp, so) - /* * SCTP protocol specific mbuf flags. */ Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Sat Sep 16 18:12:15 2017 (r323656) +++ head/sys/netinet/sctp_pcb.h Sat Sep 16 21:26:06 2017 (r323657) @@ -314,10 +314,6 @@ struct sctp_pcb { */ struct sctp_timer signature_change; - /* Zero copy full buffer timer */ - struct sctp_timer zero_copy_timer; - /* Zero copy app to transport (sendq) read repulse timer */ - struct sctp_timer zero_copy_sendq_timer; uint32_t def_cookie_life; /* defaults to 0 */ int auto_close_time; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Sep 16 18:12:15 2017 (r323656) +++ head/sys/netinet/sctputil.c Sat Sep 16 21:26:06 2017 (r323657) @@ -1633,22 +1633,6 @@ sctp_timeout_handler(void *t) /* call the handler for the appropriate timer type */ switch (type) { - case SCTP_TIMER_TYPE_ZERO_COPY: - if (inp == NULL) { - break; - } - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { - SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket); - } - break; - case SCTP_TIMER_TYPE_ZCOPY_SENDQ: - if (inp == NULL) { - break; - } - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { - SCTP_ZERO_COPY_SENDQ_EVENT(inp, inp->sctp_socket); - } - break; case SCTP_TIMER_TYPE_ADDR_WQ: sctp_handle_addr_wq(); break; @@ -1962,14 +1946,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s SCTP_TCB_LOCK_ASSERT(stcb); } switch (t_type) { - case SCTP_TIMER_TYPE_ZERO_COPY: - tmr = &inp->sctp_ep.zero_copy_timer; - to_ticks = SCTP_ZERO_COPY_TICK_DELAY; - break; - case SCTP_TIMER_TYPE_ZCOPY_SENDQ: - tmr = &inp->sctp_ep.zero_copy_sendq_timer; - to_ticks = SCTP_ZERO_COPY_SENDQ_TICK_DELAY; - break; case SCTP_TIMER_TYPE_ADDR_WQ: /* Only 1 tick away :-) */ tmr = &SCTP_BASE_INFO(addr_wq_timer); @@ -2251,12 +2227,6 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st SCTP_TCB_LOCK_ASSERT(stcb); } switch (t_type) { - case SCTP_TIMER_TYPE_ZERO_COPY: - tmr = &inp->sctp_ep.zero_copy_timer; - break; - case SCTP_TIMER_TYPE_ZCOPY_SENDQ: - tmr = &inp->sctp_ep.zero_copy_sendq_timer; - break; case SCTP_TIMER_TYPE_ADDR_WQ: tmr = &SCTP_BASE_INFO(addr_wq_timer); break; @@ -4470,36 +4440,32 @@ sctp_wakeup_the_read_socket(struct sctp_inpcb *inp, ) { if ((inp != NULL) && (inp->sctp_socket != NULL)) { - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { - SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket); - } else { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; + struct socket *so; - so = SCTP_INP_SO(inp); - if (!so_locked) { - if (stcb) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - } - SCTP_SOCKET_LOCK(so, 1); - if (stcb) { - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - } - if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } + so = SCTP_INP_SO(inp); + if (!so_locked) { + if (stcb) { + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); } -#endif - sctp_sorwakeup(inp, inp->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if (!so_locked) { + SCTP_SOCKET_LOCK(so, 1); + if (stcb) { + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + } + if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { SCTP_SOCKET_UNLOCK(so, 1); + return; } + } #endif + sctp_sorwakeup(inp, inp->sctp_socket); +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + if (!so_locked) { + SCTP_SOCKET_UNLOCK(so, 1); } +#endif } } From owner-svn-src-all@freebsd.org Sat Sep 16 22:28:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12B30E0CD7A; Sat, 16 Sep 2017 22:28:53 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it0-x232.google.com (mail-it0-x232.google.com [IPv6:2607:f8b0:4001:c0b::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA7AD65EB6; Sat, 16 Sep 2017 22:28:52 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it0-x232.google.com with SMTP id w204so5327560itc.4; Sat, 16 Sep 2017 15:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XV+bYAc1qvFYFktEPDs9gWEPWIw8K9H9PmAWyQfnGjE=; b=c5LoG03P6jxUt2iXR5To6H+i9sPRwHO7SkK6ZhUWW89pExEGKdga8AOl5f9GIy/Sj7 h2UKy0EprfSEFWt48oB5DMBuyMIJcQtY/xQr445EhrQT0CkKrzCf2FPRd9bRGAncvxeE wl/oSuPp3XBCDyGqjyxtX0Ev14MUGlHwX9cONS20PIp8MiurWJXDRAcU8xWgCAS8eted kb7hM+5dJPudROfCK57fjOVk2YyNgjzYHFKwVG0D5PJEkqfk/3p3ZuwEKQHu6g2kwoNz Ofw3/2TjsZWpZA4A8QLrjivEQ1J3m33y60evWRgpwIirhUwmB2fiyA2CxTFkHNs7DwwB xboQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=XV+bYAc1qvFYFktEPDs9gWEPWIw8K9H9PmAWyQfnGjE=; b=PXIS72/7HYJ9hbn6ZMFMgCN/x3+sGIbgURpu983S6c6fcIARb/rnOoSX1ezUM7Ka+w SjocGwS1URR6opi13x+8hHfAWQQeNQ48A3NYU6dXBRDLjuvMBcX24L3LUFq+LfDv4BMn DtK9Z77zb5EngBgPds1YIop2GPbKy3WQLSq2rJ4qlFGd/lGFDnWbrx9ci4cabkxM48SB BQOPQOq044dturJISa+8AA03SAYFyJWagYbrTDWf+4Yh+g9/Me/fzreiKuC5zpkcMpA7 cGnEwwngz1P42e+UXYghB8JnCk7SDszd6/KSA9/10Y+It/8kG1VJBlC+WZzs40JroWso HYMQ== X-Gm-Message-State: AHPjjUg0DqyEvoHMD8x/j2cpVq6076Z3XpCnW9Xug91C8OQtxg32njAg oc329mm1iVv6rDZ9GV4jJjfLaw== X-Google-Smtp-Source: AOwi7QAaoJYheX1+9t0BIsrB/3modXrwgRhVtcKzNvE44TJ3mxA8Rv2mpaifEn6fxE4UbSiKenBZpg== X-Received: by 10.36.202.197 with SMTP id k188mr10459397itg.94.1505600931876; Sat, 16 Sep 2017 15:28:51 -0700 (PDT) Received: from bish (toroon0560w-lp140-01-69-159-37-127.dsl.bell.ca. [69.159.37.127]) by smtp.gmail.com with ESMTPSA id v65sm1205057itf.38.2017.09.16.15.28.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Sep 2017 15:28:50 -0700 (PDT) Sender: Mark Johnston Date: Sat, 16 Sep 2017 18:28:46 -0400 From: Mark Johnston To: Andreas Tobler Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323290 - head/sys/vm Message-ID: <20170916222846.GA88851@bish> References: <201709072143.v87Lhdsg060310@repo.freebsd.org> <20170914203232.GA72190@bish> <67bb96f2-da01-8bce-65ba-bf811f51e56d@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <67bb96f2-da01-8bce-65ba-bf811f51e56d@FreeBSD.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2017 22:28:53 -0000 On Sat, Sep 16, 2017 at 09:01:56PM +0200, Andreas Tobler wrote: > On 14.09.17 22:32, Mark Johnston wrote: > > On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote: > >> Hi Mark, > >> > >> On 07.09.17 23:43, Mark Johnston wrote: > >>> Author: markj > >>> Date: Thu Sep 7 21:43:39 2017 > >>> New Revision: 323290 > >>> URL: https://svnweb.freebsd.org/changeset/base/323290 > >>> > >>> Log: > >>> Speed up vm_page_array initialization. > >>> > >>> We currently initialize the vm_page array in three passes: one to zero > >>> the array, one to initialize the "order" field of each page (necessary > >>> when inserting them into the vm_phys buddy allocator one-by-one), and > >>> one to initialize the remaining non-zero fields and individually insert > >>> each page into the allocator. > >>> > >>> Merge the three passes into one following a suggestion from alc: > >>> initialize vm_page fields in a single pass, and use vm_phys_free_contig() > >>> to efficiently insert physical memory segments into the buddy allocator. > >>> This reduces the initialization time to a third or a quarter of what it > >>> was before on most systems that I tested. > >>> > >>> Reviewed by: alc, kib > >>> MFC after: 3 weeks > >>> Differential Revision: https://reviews.freebsd.org/D12248 > >>> > >>> Modified: > >>> head/sys/vm/vm_page.c > >>> head/sys/vm/vm_phys.c > >>> head/sys/vm/vm_phys.h > >> > >> I just found out that this commit breaks booting my powerpc64 Quad G5. > >> It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue]. > >> > >> Sometimes it hangs earlier when the kbd is not there yet (usb), then I > >> can't get the process/task where it hangs. > >> > >> Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD) > >> > >> Any ideas how to find out what's wrong? > > > > Are you able to break into DDB when the hang occurs? If so, the output > > of "show page" would be helpful. > > Unfortunately not from the beginning. The keyboard is usb and it gets > installed late. Once it survives the loading of the kbd and co, I can > enter into ddb. But it is a trial and error. So far I didn't succeed to > come that far. > > > Are you running with INVARIANTS configured? If not, please try that. > > The above was w/o INVARIANTS. With invariants the kernel panics > immediately after boot, see pic. Thanks. Could you please try applying the patch at the end of this email and see if that fixes the issue? I have not yet tried to compile it, sorry. > > >> The previous revision, r323289 seems stable, at least it survived > >> several kernel builds. > > > > Could you apply the patch below and capture the first page or so of > > output from after the kernel starts booting? > > I applied this diff and you see its output on the pic: > > https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg > > I try now to get that far that I have a kbd and capture a 'show page'. I don't think that's necessary anymore given the information provided in the picture. diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 04066418fcc1..b576474fcd1d 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -287,6 +287,7 @@ boolean_t moea_is_referenced(mmu_t, vm_page_t); int moea_ts_referenced(mmu_t, vm_page_t); vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int); boolean_t moea_page_exists_quick(mmu_t, pmap_t, vm_page_t); +void moea_page_init(mmu_t, vm_page_t); int moea_page_wired_mappings(mmu_t, vm_page_t); void moea_pinit(mmu_t, pmap_t); void moea_pinit0(mmu_t, pmap_t); @@ -334,6 +335,7 @@ static mmu_method_t moea_methods[] = { MMUMETHOD(mmu_ts_referenced, moea_ts_referenced), MMUMETHOD(mmu_map, moea_map), MMUMETHOD(mmu_page_exists_quick,moea_page_exists_quick), + MMUMETHOD(mmu_page_init, moea_page_init), MMUMETHOD(mmu_page_wired_mappings,moea_page_wired_mappings), MMUMETHOD(mmu_pinit, moea_pinit), MMUMETHOD(mmu_pinit0, moea_pinit0), @@ -1594,6 +1596,15 @@ moea_page_exists_quick(mmu_t mmu, pmap_t pmap, vm_page_t m) return (rv); } +void +moea_page_init(mmu_t mmu __unused, vm_page_t m) +{ + + m->md.mdpg_attrs = 0; + m->md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT; + LIST_INIT(&m->md.mdpg_pvoh); +} + /* * Return the number of managed mappings to the given physical page * that are wired. diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index c0461ff57453..28c9c79916f1 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -251,6 +251,7 @@ boolean_t moea64_is_referenced(mmu_t, vm_page_t); int moea64_ts_referenced(mmu_t, vm_page_t); vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_paddr_t, vm_paddr_t, int); boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t); +void moea64_page_init(mmu_t, vm_page_t); int moea64_page_wired_mappings(mmu_t, vm_page_t); void moea64_pinit(mmu_t, pmap_t); void moea64_pinit0(mmu_t, pmap_t); @@ -298,6 +299,7 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_ts_referenced, moea64_ts_referenced), MMUMETHOD(mmu_map, moea64_map), MMUMETHOD(mmu_page_exists_quick,moea64_page_exists_quick), + MMUMETHOD(mmu_page_init, moea64_page_init), MMUMETHOD(mmu_page_wired_mappings,moea64_page_wired_mappings), MMUMETHOD(mmu_pinit, moea64_pinit), MMUMETHOD(mmu_pinit0, moea64_pinit0), @@ -1898,6 +1900,15 @@ moea64_page_exists_quick(mmu_t mmu, pmap_t pmap, vm_page_t m) return (rv); } +void +moea64_page_init(mmu_t mmu __unused, vm_page_t m) +{ + + m->md.mdpg_attrs = 0; + m->md.mdpg_cache_attrs = VM_MEMATTR_DEFAULT; + LIST_INIT(&m->md.mdpg_pvoh); +} + /* * Return the number of managed mappings to the given physical page * that are wired.