From owner-svn-src-all@freebsd.org Sun Jul 5 00:07:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A35535BEA6; Sun, 5 Jul 2020 00:07:54 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zptd2pJpz4Gfy; Sun, 5 Jul 2020 00:07:53 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id 06507jLt005121 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 5 Jul 2020 10:07:50 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id 06507dIO063481 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 5 Jul 2020 10:07:39 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id 06507di0063480; Sun, 5 Jul 2020 10:07:39 +1000 (AEST) (envelope-from peter) Date: Sun, 5 Jul 2020 10:07:39 +1000 From: Peter Jeremy To: Oleksandr Tymoshenko Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362736 - head/sys/arm64/rockchip Message-ID: <20200705000739.GE30039@server.rulingia.com> References: <202006282111.05SLBAAq025544@repo.freebsd.org> <20200701085747.GA23928@server.rulingia.com> <20200701124738.GA30133@server.rulingia.com> <20200703002623.GA18584@bluezbox.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sXc4Kmr5FA7axrvy" Content-Disposition: inline In-Reply-To: <20200703002623.GA18584@bluezbox.com> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 49zptd2pJpz4Gfy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-4.38 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.967]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[rulingia.com]; NEURAL_HAM_LONG(-1.04)[-1.043]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.03)[0.026]; RCVD_COUNT_THREE(0.00)[3]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 00:07:54 -0000 --sXc4Kmr5FA7axrvy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-Jul-02 17:26:23 -0700, Oleksandr Tymoshenko wro= te: >Could you try kernel with this patch? It's mostly debug output, >with one possible clock-related fix. > >https://people.freebsd.org/~gonzo/patches/rk3328-gmac-debug.patch It's still not working for me. I get the following: dwc0: mem 0xff540000-0xff54ffff irq = 44 on ofwbus0 setting RK3328 RX/TX delays: 24/36 >>> RK3328_GRF_MAC_CON1 (00000413): >>> gmac2io_gmii_clk_sel: 0x0 >>> gmac2io_rmii_extclk_sel: 0x1 >>> gmac2io_rmii_mode: 0x0 >>> gmac2io_rmii_clk_sel: 0x0 >>> gmac2io_phy_intf_sel: 0x1 >>> gmac2io_flowctrl: 0x0 >>> gmac2io_rxclk_dly_ena: 0x1 >>> gmac2io_txclk_dly_ena: 0x1 >>> RK3328_GRF_MAC_CON0 (00000c24): miibus0: on dwc0 rgephy0: PHY 0 on miibus0 rgephy0: OUI 0x00e04c, model 0x0011, rev. 6 rgephy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-F= DX, 1000baseT-FDX-master, auto >I have Rock64 v2, which, as you mentioned, has a known issue with GigE, so >my tests are not reliable. I'll try to get another RK3328 board for tests, >but it may take some time. I've asked on -arm if anyone else has tried this on a Rock64 v2 or v3. >If the clock fix doesn't help, I'll make >delays configuration run-time configurable with off by default until >more hardware is tested. That sounds like a good way forward - maybe boot and run-time configurable. It's a pity that there doesn't seem to be any documentation on what the numbers represent (or what the "default" value is) - which means that actually adjusting the delay numbers would be very time consuming. --=20 Peter Jeremy --sXc4Kmr5FA7axrvy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE2M6l8vfIeOACl4uUHZIUommfjLIFAl8BGctfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEQ4 Q0VBNUYyRjdDODc4RTAwMjk3OEI5NDFEOTIxNEEyNjk5RjhDQjIACgkQHZIUommf jLJjFQ/+IgzUBQZjUTUd4kgS739w6XR2uORohPk3ClK4x/rlqyvmOgYX98RR9ull bVI5/IUIcvbGynWEgpdHrYXxj6vRr38hiownDLb/TV9gB5SjYLSEX/uoALY/PpaQ jPEMRsIBnQpR+AXa29dHSO9R4554SxbOy0SVczzR2dyiPRBrl+AhLOD9h5T+7z1M 4z/WLm7OE/8U8eRPxr6srV7Vd9tDpHXiAI5AGZhGEWvLvaZvtp4stBZaV4ipg62X HzWp5HazUrkOv+tA94R0ahzFDcJnffFniMgFUcZ1kjxhhv+FoRo27f4c4rykaaqh azwOB/F8whXqr/w8oC4EMdwiZ1PYVwSOy27pO5DKaOt0rS5vXO9tvb0z4Fpxt6Px rv088cygimB6ebDFzz37snogH4QiOFvIibeHloLnPIA5mh/Ai7SGU64XwKauBWlx 0tDnBb5eJDJjnbZf5GNxSru395HKo1hoA3GRL1jN5pBPfM77NV5fJOHSI3T5rVcN JXuFF6Us8GjrLKX4NFaMzaliw34yjHWsFA0NrqxNU8+Skc8nNdTGyMqTZ/zf8+3v ngJMi9zVy9WvP9jcXUCYVYgjC5JjrmDzsKrXcO0nEGs+T5/ebbgiBweXwRfVPqAR P+NoztKlRjFPs/FHvENdZpBFH9VdM+XtuTAuumkKkI30OHJMXRE= =TTrl -----END PGP SIGNATURE----- --sXc4Kmr5FA7axrvy-- From owner-svn-src-all@freebsd.org Sun Jul 5 00:19:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA19F35C253; Sun, 5 Jul 2020 00:19:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zq7c4ncRz4HNW; Sun, 5 Jul 2020 00:19:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 872E924C1E; Sun, 5 Jul 2020 00:19:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0650J8Wm090136; Sun, 5 Jul 2020 00:19:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0650J8bH090135; Sun, 5 Jul 2020 00:19:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202007050019.0650J8bH090135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Jul 2020 00:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362937 - head/sbin/newfs_msdos X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/newfs_msdos X-SVN-Commit-Revision: 362937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 00:19:08 -0000 Author: delphij Date: Sun Jul 5 00:19:08 2020 New Revision: 362937 URL: https://svnweb.freebsd.org/changeset/base/362937 Log: Use KERN_MAXPHYS. Suggested by: imp Reviewed by: imp, cem (earlier version), emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25563 Modified: head/sbin/newfs_msdos/mkfs_msdos.c Modified: head/sbin/newfs_msdos/mkfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:37:04 2020 (r362936) +++ head/sbin/newfs_msdos/mkfs_msdos.c Sun Jul 5 00:19:08 2020 (r362937) @@ -41,8 +41,10 @@ static const char rcsid[] = #include #endif #include +#include #include +#include #include #include #include @@ -78,25 +80,6 @@ static const char rcsid[] = #define MAXCLS16 0xfff4U /* maximum FAT16 clusters */ #define MAXCLS32 0xffffff4U /* maximum FAT32 clusters */ -#ifndef CTASSERT -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert_ ## y [(x) ? 1 : -1] -#endif - -/* - * For better performance, we want to write larger chunks instead of - * individual sectors (the size can only be 512, 1024, 2048 or 4096 - * bytes). Assert that MAXPHYS can always hold an integer number of - * sectors by asserting that both are power of two numbers and the - * MAXPHYS is greater than MAXBPS. - */ -CTASSERT(powerof2(MAXPHYS)); -CTASSERT(powerof2(MAXBPS)); -CTASSERT(MAXPHYS > MAXBPS); - -const static ssize_t chunksize = MAXPHYS; - #define mincls(fat) ((fat) == 12 ? MINCLS12 : \ (fat) == 16 ? MINCLS16 : \ MINCLS32) @@ -240,6 +223,7 @@ static volatile sig_atomic_t got_siginfo; static void infohandler(int); static int check_mounted(const char *, mode_t); +static ssize_t getchunksize(void); static int getstdfmt(const char *, struct bpb *); static int getdiskinfo(int, const char *, const char *, int, struct bpb *); static void print_bpb(struct bpb *); @@ -272,6 +256,7 @@ mkfs_msdos(const char *fname, const char *dtype, const bool set_res, set_spf, set_spc; int fd, fd1, rv; struct msdos_options o = *op; + ssize_t chunksize; physbuf = NULL; rv = -1; @@ -640,6 +625,7 @@ mkfs_msdos(const char *fname, const char *dtype, const tm = localtime(&now); } + chunksize = getchunksize(); physbuf = malloc(chunksize); if (physbuf == NULL) { warn(NULL); @@ -848,6 +834,47 @@ check_mounted(const char *fname, mode_t mode) } #endif return 0; +} + +/* + * Get optimal I/O size + */ +static ssize_t +getchunksize(void) +{ + static int chunksize; + + if (chunksize != 0) + return ((ssize_t)chunksize); + +#ifdef KERN_MAXPHYS + int mib[2]; + size_t len; + + mib[0] = CTL_KERN; + mib[1] = KERN_MAXPHYS; + len = sizeof(chunksize); + + if (sysctl(mib, 2, &chunksize, &len, NULL, 0) == -1) { + warn("sysctl: KERN_MAXPHYS, using %zu", (size_t)MAXPHYS); + chunksize = 0; + } +#endif + if (chunksize == 0) + chunksize = MAXPHYS; + + /* + * For better performance, we want to write larger chunks instead of + * individual sectors (the size can only be 512, 1024, 2048 or 4096 + * bytes). Assert that chunksize can always hold an integer number of + * sectors by asserting that both are power of two numbers and the + * chunksize is greater than MAXBPS. + */ + static_assert(powerof2(MAXBPS), "MAXBPS is not power of 2"); + assert(powerof2(chunksize)); + assert(chunksize > MAXBPS); + + return ((ssize_t)chunksize); } /* From owner-svn-src-all@freebsd.org Sun Jul 5 05:14:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 275173611AC; Sun, 5 Jul 2020 05:14:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zxhV0BQRz4TnZ; Sun, 5 Jul 2020 05:14:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D072E85AD; Sun, 5 Jul 2020 05:14:33 +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 0655EX36074217; Sun, 5 Jul 2020 05:14:33 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0655EXfr074216; Sun, 5 Jul 2020 05:14:33 GMT (envelope-from np@FreeBSD.org) Message-Id: <202007050514.0655EXfr074216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 5 Jul 2020 05:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362938 - 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: 362938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 05:14:34 -0000 Author: np Date: Sun Jul 5 05:14:33 2020 New Revision: 362938 URL: https://svnweb.freebsd.org/changeset/base/362938 Log: cxgbe(4): Fix a bug (introduced in r362905) where some tx traffic wasn't being reported to BPF. Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sun Jul 5 00:19:08 2020 (r362937) +++ head/sys/dev/cxgbe/t4_sge.c Sun Jul 5 05:14:33 2020 (r362938) @@ -3013,6 +3013,7 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool if (avail < n) break; /* out of descriptors */ } + ETHER_BPF_MTAP(ifp, m0); if (sc->flags & IS_VF) n = write_txpkt_vm_wr(sc, txq, m0); else From owner-svn-src-all@freebsd.org Sun Jul 5 06:50:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE0EE362A90; Sun, 5 Jul 2020 06:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zzq25B6vz4YXj; Sun, 5 Jul 2020 06:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9539795D5; Sun, 5 Jul 2020 06:50:22 +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 0656oMOE030323; Sun, 5 Jul 2020 06:50:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0656oM0o030322; Sun, 5 Jul 2020 06:50:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007050650.0656oM0o030322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 5 Jul 2020 06:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362939 - stable/12/usr.bin/top X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/usr.bin/top X-SVN-Commit-Revision: 362939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 06:50:22 -0000 Author: kib Date: Sun Jul 5 06:50:22 2020 New Revision: 362939 URL: https://svnweb.freebsd.org/changeset/base/362939 Log: MFC r362711: top: do not try to use sysctl machdep.smp_active. Modified: stable/12/usr.bin/top/machine.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/top/machine.c ============================================================================== --- stable/12/usr.bin/top/machine.c Sun Jul 5 05:14:33 2020 (r362938) +++ stable/12/usr.bin/top/machine.c Sun Jul 5 06:50:22 2020 (r362939) @@ -278,10 +278,7 @@ machine_init(struct statics *statics) size_t size; size = sizeof(smpmode); - if ((sysctlbyname("machdep.smp_active", &smpmode, &size, - NULL, 0) != 0 && - sysctlbyname("kern.smp.active", &smpmode, &size, - NULL, 0) != 0) || + if (sysctlbyname("kern.smp.active", &smpmode, &size, NULL, 0) != 0 || size != sizeof(smpmode)) smpmode = 0; From owner-svn-src-all@freebsd.org Sun Jul 5 06:51:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B24D9362B1D; Sun, 5 Jul 2020 06:51:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zzrW4LXGz4Yc2; Sun, 5 Jul 2020 06:51:39 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7886C94D1; Sun, 5 Jul 2020 06:51: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 0656pdit032089; Sun, 5 Jul 2020 06:51:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0656pd1O032088; Sun, 5 Jul 2020 06:51:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007050651.0656pd1O032088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 5 Jul 2020 06:51: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: r362940 - stable/11/usr.bin/top X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/usr.bin/top X-SVN-Commit-Revision: 362940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 06:51:39 -0000 Author: kib Date: Sun Jul 5 06:51:39 2020 New Revision: 362940 URL: https://svnweb.freebsd.org/changeset/base/362940 Log: MFC r362711: top: do not try to use sysctl machdep.smp_active. Modified: stable/11/usr.bin/top/machine.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/top/machine.c ============================================================================== --- stable/11/usr.bin/top/machine.c Sun Jul 5 06:50:22 2020 (r362939) +++ stable/11/usr.bin/top/machine.c Sun Jul 5 06:51:39 2020 (r362940) @@ -333,10 +333,7 @@ machine_init(struct statics *statics, char do_unames) struct passwd *pw; size = sizeof(smpmode); - if ((sysctlbyname("machdep.smp_active", &smpmode, &size, - NULL, 0) != 0 && - sysctlbyname("kern.smp.active", &smpmode, &size, - NULL, 0) != 0) || + if (sysctlbyname("kern.smp.active", &smpmode, &size, NULL, 0) != 0 || size != sizeof(smpmode)) smpmode = 0; From owner-svn-src-all@freebsd.org Sun Jul 5 07:40:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39DAD3642C9; Sun, 5 Jul 2020 07:40:17 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B00wd0lGtz4bmw; Sun, 5 Jul 2020 07:40:17 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p548612f6.dip0.t-ipconnect.de [84.134.18.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 9394E1487F; Sun, 5 Jul 2020 07:40:16 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Sun, 5 Jul 2020 09:40:14 +0200 From: Gordon Bergling To: Alexey Dokuchaev Cc: rgrimes@freebsd.org, Warner Losh , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r362809 - head/contrib/mandoc Message-ID: <20200705074014.GA16505@lion.0xfce3.net> References: <20200701234213.GA54023@FreeBSD.org> <202007020001.062010DA058837@gndrsh.dnsmgr.net> <20200702000613.GA93146@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200702000613.GA93146@FreeBSD.org> X-Url: X-Operating-System: FreeBSD 12.1-STABLE amd64 X-Host-Uptime: 9:07AM up 1 day, 21:57, 6 users, load averages: 4.67, 5.02, 4.83 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 07:40:17 -0000 On Thu, Jul 02, 2020 at 12:06:13AM +0000, Alexey Dokuchaev wrote: > On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote: > > Thats good, but realize the page already contains history that > > reads like: > > > > HISTORY > > Part of the functionality of whatis was already provided by the former > > manwhere utility in 1BSD. The apropos and whatis utilities first ap- > > peared in 2BSD. They were rewritten from scratch for OpenBSD 5.6. > > > > The -M option and the MANPATH variable first appeared in 4.3BSD; -m in > > 4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos > > and in OpenBSD 5.6 for whatis. The options -acfhIKklOTWw appeared in > > OpenBSD 5.7. > > > > And further contains: > > > > AUTHORS > > Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis > > in February 1979. The current version was written by Kristaps Dzonsons > > and Ingo Schwarze . > > > > So the history is rich and complete, do we really need to say when we > > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page? > > Ah, in this case, the only thing lacking from the current version is mention > of FreeBSD 11.1. Sorry for not checking with that before writing my reply. > My main point, however, was that reverse chronological order looks strange. I have created the following differential and integrated the given feedback. https://reviews.freebsd.org/D25566 If necessary I could revert r362809, but somebody should explicit request it. --Gordon From owner-svn-src-all@freebsd.org Sun Jul 5 10:57:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0ABE13685A6; Sun, 5 Jul 2020 10:57:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B05J86Rfmz3Y4X; Sun, 5 Jul 2020 10:57:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C14F3BE6D; Sun, 5 Jul 2020 10:57:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065AvSno085086; Sun, 5 Jul 2020 10:57:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065AvSaV085085; Sun, 5 Jul 2020 10:57:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202007051057.065AvSaV085085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 5 Jul 2020 10:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362941 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 10:57:29 -0000 Author: trasz Date: Sun Jul 5 10:57:28 2020 New Revision: 362941 URL: https://svnweb.freebsd.org/changeset/base/362941 Log: Fix Linux recvmsg(2) when msg_namelen returned is 0. Previously it would fail with EINVAL, breaking some of the Python regression tests. While here, cap the user-controlled message length. Note that the code doesn't seem to be copying out the new length in either (success or failure) case. This will be addressed separately. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25392 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun Jul 5 06:51:39 2020 (r362940) +++ head/sys/compat/linux/linux_socket.c Sun Jul 5 10:57:28 2020 (r362941) @@ -1196,11 +1196,14 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) return (error); - if (msg->msg_name) { + if (msg->msg_name != NULL && msg->msg_namelen > 0) { + msg->msg_namelen = min(msg->msg_namelen, SOCK_MAXADDRLEN); sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); msg->msg_name = sa; - } else + } else { sa = NULL; + msg->msg_name = NULL; + } uiov = msg->msg_iov; msg->msg_iov = iov; @@ -1210,7 +1213,10 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) goto bad; - if (msg->msg_name) { + /* + * Note that kern_recvit() updates msg->msg_namelen. + */ + if (msg->msg_name != NULL && msg->msg_namelen > 0) { msg->msg_name = PTRIN(linux_msghdr.msg_name); error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen); if (error == 0) From owner-svn-src-all@freebsd.org Sun Jul 5 13:08:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9930036B606; Sun, 5 Jul 2020 13:08:18 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B08C63TPtz3fdw; Sun, 5 Jul 2020 13:08:18 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AB5EDAD0; Sun, 5 Jul 2020 13:08:18 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065D8IHK065252; Sun, 5 Jul 2020 13:08:18 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065D8IX3065251; Sun, 5 Jul 2020 13:08:18 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <202007051308.065D8IX3065251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Sun, 5 Jul 2020 13:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362942 - head/sbin/shutdown X-SVN-Group: head X-SVN-Commit-Author: zeising X-SVN-Commit-Paths: head/sbin/shutdown X-SVN-Commit-Revision: 362942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 13:08:18 -0000 Author: zeising (doc,ports committer) Date: Sun Jul 5 13:08:17 2020 New Revision: 362942 URL: https://svnweb.freebsd.org/changeset/base/362942 Log: shutdown.8: Fix typo Fix a typo in shutdown.8, use ',' instead of '.' when listing items. MFC after: 1 week Modified: head/sbin/shutdown/shutdown.8 Modified: head/sbin/shutdown/shutdown.8 ============================================================================== --- head/sbin/shutdown/shutdown.8 Sun Jul 5 10:57:28 2020 (r362941) +++ head/sbin/shutdown/shutdown.8 Sun Jul 5 13:08:17 2020 (r362942) @@ -135,7 +135,7 @@ suffix: .Dq Li s , .Dq Li sec , .Dq Li m , -.Dq Li min . +.Dq Li min , .Dq Li h , .Dq Li hour . .Pp From owner-svn-src-all@freebsd.org Sun Jul 5 13:15:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 952E336B4AF; Sun, 5 Jul 2020 13:15:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B08M63G0rz3gDN; Sun, 5 Jul 2020 13:15:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5358CDA73; Sun, 5 Jul 2020 13:15:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065DFETt071248; Sun, 5 Jul 2020 13:15:14 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065DFEQE071247; Sun, 5 Jul 2020 13:15:14 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202007051315.065DFEQE071247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 5 Jul 2020 13:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362943 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 362943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 13:15:14 -0000 Author: trasz Date: Sun Jul 5 13:15:13 2020 New Revision: 362943 URL: https://svnweb.freebsd.org/changeset/base/362943 Log: Make linux(4) man page also mention /compat/linux/dev. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/linux.4 Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Sun Jul 5 13:08:17 2020 (r362942) +++ head/share/man/man4/linux.4 Sun Jul 5 13:15:13 2020 (r362943) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2020 +.Dd July 5, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -129,6 +129,9 @@ Defaults to 0. .Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux minimal Linux run-time environment +.It Pa /compat/linux/dev +device file system, see +.Xr devfs 5 .It Pa /compat/linux/dev/fd file descriptor file system mounted with the .Cm linrdlnk From owner-svn-src-all@freebsd.org Sun Jul 5 14:38:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 973F136D009; Sun, 5 Jul 2020 14:38:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0BC43YMlz41hq; Sun, 5 Jul 2020 14:38:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 591BCEF27; Sun, 5 Jul 2020 14:38:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065EcO1V020762; Sun, 5 Jul 2020 14:38:24 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065EcNxl020756; Sun, 5 Jul 2020 14:38:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007051438.065EcNxl020756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 5 Jul 2020 14:38:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362944 - in head/sys: amd64/amd64 arm64/arm64 kern sys X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm64/arm64 kern sys X-SVN-Commit-Revision: 362944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 14:38:24 -0000 Author: andrew Date: Sun Jul 5 14:38:22 2020 New Revision: 362944 URL: https://svnweb.freebsd.org/changeset/base/362944 Log: Rerun kernel ifunc resolvers after all CPUs have started On architectures that use RELA relocations it is safe to rerun the ifunc resolvers on after all CPUs have started, but while they are sill parked. On arm64 with big.LITTLE this is needed as some SoCs have shipped with different ID register values the big and little clusters meaning we were unable to rely on the register values from the boot CPU. Add support for rerunning the resolvers on arm64 and amd64 as these are both RELA using architectures. Reviewed by: kib Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25455 Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/amd64/machdep.c head/sys/arm64/arm64/elf_machdep.c head/sys/arm64/arm64/machdep.c head/sys/kern/link_elf.c head/sys/sys/linker.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Sun Jul 5 13:15:13 2020 (r362943) +++ head/sys/amd64/amd64/elf_machdep.c Sun Jul 5 14:38:22 2020 (r362944) @@ -186,7 +186,7 @@ elf_is_ifunc_reloc(Elf_Size r_info) /* Process one elf relocation with addend. */ static int elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, elf_lookup_fn lookup) + int type, bool late_ifunc, elf_lookup_fn lookup) { Elf64_Addr *where, val; Elf32_Addr *where32, val32; @@ -226,6 +226,13 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas panic("unknown reloc type %d\n", type); } + if (late_ifunc) { + KASSERT(type == ELF_RELOC_RELA, + ("Only RELA ifunc relocations are supported")); + if (rtype != R_X86_64_IRELATIVE) + return (0); + } + switch (rtype) { case R_X86_64_NONE: /* none */ break; @@ -305,7 +312,7 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const elf_lookup_fn lookup) { - return (elf_reloc_internal(lf, relocbase, data, type, lookup)); + return (elf_reloc_internal(lf, relocbase, data, type, false, lookup)); } int @@ -313,7 +320,15 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, int type, elf_lookup_fn lookup) { - return (elf_reloc_internal(lf, relocbase, data, type, lookup)); + return (elf_reloc_internal(lf, relocbase, data, type, false, lookup)); +} + +int +elf_reloc_late(linker_file_t lf, Elf_Addr relocbase, const void *data, + int type, elf_lookup_fn lookup) +{ + + return (elf_reloc_internal(lf, relocbase, data, type, true, lookup)); } int Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sun Jul 5 13:15:13 2020 (r362943) +++ head/sys/amd64/amd64/machdep.c Sun Jul 5 14:38:22 2020 (r362944) @@ -320,6 +320,13 @@ cpu_startup(dummy) cpu_setregs(); } +static void +late_ifunc_resolve(void *dummy __unused) +{ + link_elf_late_ireloc(); +} +SYSINIT(late_ifunc_resolve, SI_SUB_CPU, SI_ORDER_ANY, late_ifunc_resolve, NULL); + /* * Send an interrupt to process. * Modified: head/sys/arm64/arm64/elf_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf_machdep.c Sun Jul 5 13:15:13 2020 (r362943) +++ head/sys/arm64/arm64/elf_machdep.c Sun Jul 5 14:38:22 2020 (r362944) @@ -143,8 +143,10 @@ reloc_instr_imm(Elf32_Addr *where, Elf_Addr val, u_int */ static int elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, int local, elf_lookup_fn lookup) + int type, int flags, elf_lookup_fn lookup) { +#define ARM64_ELF_RELOC_LOCAL (1 << 0) +#define ARM64_ELF_RELOC_LATE_IFUNC (1 << 1) Elf_Addr *where, addr, addend, val; Elf_Word rtype, symidx; const Elf_Rel *rel; @@ -170,7 +172,14 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas panic("unknown reloc type %d\n", type); } - if (local) { + if ((flags & ARM64_ELF_RELOC_LATE_IFUNC) != 0) { + KASSERT(type == ELF_RELOC_RELA, + ("Only RELA ifunc relocations are supported")); + if (rtype != R_AARCH64_IRELATIVE) + return (0); + } + + if ((flags & ARM64_ELF_RELOC_LOCAL) != 0) { if (rtype == R_AARCH64_RELATIVE) *where = elf_relocaddr(lf, relocbase + addend); return (0); @@ -229,7 +238,8 @@ elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, int type, elf_lookup_fn lookup) { - return (elf_reloc_internal(lf, relocbase, data, type, 1, lookup)); + return (elf_reloc_internal(lf, relocbase, data, type, + ARM64_ELF_RELOC_LOCAL, lookup)); } /* Process one elf relocation with addend. */ @@ -239,6 +249,15 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const { return (elf_reloc_internal(lf, relocbase, data, type, 0, lookup)); +} + +int +elf_reloc_late(linker_file_t lf, Elf_Addr relocbase, const void *data, + int type, elf_lookup_fn lookup) +{ + + return (elf_reloc_internal(lf, relocbase, data, type, + ARM64_ELF_RELOC_LATE_IFUNC, lookup)); } int Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sun Jul 5 13:15:13 2020 (r362943) +++ head/sys/arm64/arm64/machdep.c Sun Jul 5 14:38:22 2020 (r362944) @@ -181,6 +181,13 @@ cpu_startup(void *dummy) SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); +static void +late_ifunc_resolve(void *dummy __unused) +{ + link_elf_late_ireloc(); +} +SYSINIT(late_ifunc_resolve, SI_SUB_CPU, SI_ORDER_ANY, late_ifunc_resolve, NULL); + int cpu_idle_wakeup(int cpu) { Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Sun Jul 5 13:15:13 2020 (r362943) +++ head/sys/kern/link_elf.c Sun Jul 5 14:38:22 2020 (r362944) @@ -1925,4 +1925,18 @@ link_elf_ireloc(caddr_t kmdp) link_elf_preload_parse_symbols(ef); relocate_file1(ef, elf_lookup_ifunc, elf_reloc, true); } + +#if defined(__aarch64__) || defined(__amd64__) +void +link_elf_late_ireloc(void) +{ + elf_file_t ef; + + KASSERT(linker_kernel_file != NULL, + ("link_elf_late_ireloc: No kernel linker file found")); + ef = (elf_file_t)linker_kernel_file; + + relocate_file1(ef, elf_lookup_ifunc, elf_reloc_late, true); +} +#endif #endif Modified: head/sys/sys/linker.h ============================================================================== --- head/sys/sys/linker.h Sun Jul 5 13:15:13 2020 (r362943) +++ head/sys/sys/linker.h Sun Jul 5 14:38:22 2020 (r362944) @@ -289,6 +289,12 @@ const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size const char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx); void link_elf_ireloc(caddr_t kmdp); +#if defined(__aarch64__) || defined(__amd64__) +int elf_reloc_late(linker_file_t _lf, Elf_Addr base, const void *_rel, + int _type, elf_lookup_fn _lu); +void link_elf_late_ireloc(void); +#endif + typedef struct linker_ctf { const uint8_t *ctftab; /* Decompressed CTF data. */ int ctfcnt; /* Number of CTF data bytes. */ From owner-svn-src-all@freebsd.org Sun Jul 5 14:43:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FC3236D072; Sun, 5 Jul 2020 14:43:15 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0BJg05F9z42TF; Sun, 5 Jul 2020 14:43:15 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB43AEE2F; Sun, 5 Jul 2020 14:43:14 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065EhE6G026678; Sun, 5 Jul 2020 14:43:14 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065EhEpU026677; Sun, 5 Jul 2020 14:43:14 GMT (envelope-from se@FreeBSD.org) Message-Id: <202007051443.065EhEpU026677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Sun, 5 Jul 2020 14:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362945 - head X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 362945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 14:43:15 -0000 Author: se Date: Sun Jul 5 14:43:14 2020 New Revision: 362945 URL: https://svnweb.freebsd.org/changeset/base/362945 Log: Add a note regarding the introduction of the new bc and dc implementations that are built by default on -CURRENT after 2020-06-26. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Jul 5 14:38:22 2020 (r362944) +++ head/UPDATING Sun Jul 5 14:43:14 2020 (r362945) @@ -26,6 +26,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20200627: + A new implementation of bc and dc has been imorted in r362681. This + implementation corrects non-conformant behavior of the previous bc + and adds GNU bc compatible options. It offers a number of extensions, + is much faster on large values, and has support for message catalogs + (a number of languages are already supported, contributions of further + languages welcome). The option WITHOUT_GH_BC can be used to build the + world with the previous versions of bc and dc. + 20200625: r362639 changed the internal API used between the NFS kernel modules. As such, they all need to be rebuilt from sources. From owner-svn-src-all@freebsd.org Sun Jul 5 17:23:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA0DA3486E4; Sun, 5 Jul 2020 17:23:06 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0Fs60H5qz4BJ7; Sun, 5 Jul 2020 17:23:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 065HMwYh074450; Sun, 5 Jul 2020 10:22:58 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 065HMwE1074449; Sun, 5 Jul 2020 10:22:58 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202007051722.065HMwE1074449@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362809 - head/contrib/mandoc In-Reply-To: <20200705074014.GA16505@lion.0xfce3.net> To: Gordon Bergling Date: Sun, 5 Jul 2020 10:22:58 -0700 (PDT) CC: Alexey Dokuchaev , rgrimes@freebsd.org, Warner Losh , src-committers , svn-src-all , svn-src-head Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4B0Fs60H5qz4BJ7 X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [1.99 / 15.00]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.25)[0.255]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.19)[0.186]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.65)[0.645]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 17:23:07 -0000 > On Thu, Jul 02, 2020 at 12:06:13AM +0000, Alexey Dokuchaev wrote: > > On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote: > > > Thats good, but realize the page already contains history that > > > reads like: > > > > > > HISTORY > > > Part of the functionality of whatis was already provided by the former > > > manwhere utility in 1BSD. The apropos and whatis utilities first ap- > > > peared in 2BSD. They were rewritten from scratch for OpenBSD 5.6. > > > > > > The -M option and the MANPATH variable first appeared in 4.3BSD; -m in > > > 4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos > > > and in OpenBSD 5.6 for whatis. The options -acfhIKklOTWw appeared in > > > OpenBSD 5.7. > > > > > > And further contains: > > > > > > AUTHORS > > > Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis > > > in February 1979. The current version was written by Kristaps Dzonsons > > > and Ingo Schwarze . > > > > > > So the history is rich and complete, do we really need to say when we > > > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page? > > > > Ah, in this case, the only thing lacking from the current version is mention > > of FreeBSD 11.1. Sorry for not checking with that before writing my reply. > > My main point, however, was that reverse chronological order looks strange. > > I have created the following differential and integrated the given feedback. > > https://reviews.freebsd.org/D25566 > > If necessary I could revert r362809, but somebody should explicit request it. Consider it so requested. > --Gordon -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sun Jul 5 19:38:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7FD834B250; Sun, 5 Jul 2020 19:38:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0JsS5qz9z4Jm8; Sun, 5 Jul 2020 19:38:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABA0F12784; Sun, 5 Jul 2020 19:38:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065Jcauh006031; Sun, 5 Jul 2020 19:38:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065Jca0s006030; Sun, 5 Jul 2020 19:38:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202007051938.065Jca0s006030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 5 Jul 2020 19:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362946 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 362946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 19:38:37 -0000 Author: hselasky Date: Sun Jul 5 19:38:36 2020 New Revision: 362946 URL: https://svnweb.freebsd.org/changeset/base/362946 Log: Fix include file order in io.h in the LinuxKPI. Make sure sys/types.h is included before machine/vm.h. PR: 247775 Submitted by: pkubaj@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/io.h Modified: head/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/io.h Sun Jul 5 14:43:14 2020 (r362945) +++ head/sys/compat/linuxkpi/common/include/linux/io.h Sun Jul 5 19:38:36 2020 (r362946) @@ -31,9 +31,10 @@ #ifndef _LINUX_IO_H_ #define _LINUX_IO_H_ -#include #include #include + +#include #include #include From owner-svn-src-all@freebsd.org Sun Jul 5 19:53:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B55834BE21; Sun, 5 Jul 2020 19:53:55 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0KC70qG0z4KYf; Sun, 5 Jul 2020 19:53:55 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F361312929; Sun, 5 Jul 2020 19:53:54 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065JrsaB018208; Sun, 5 Jul 2020 19:53:54 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065Jrs9T018207; Sun, 5 Jul 2020 19:53:54 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202007051953.065Jrs9T018207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Sun, 5 Jul 2020 19:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362947 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 362947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 19:53:55 -0000 Author: kaktus Date: Sun Jul 5 19:53:54 2020 New Revision: 362947 URL: https://svnweb.freebsd.org/changeset/base/362947 Log: truss: print more information about traced sysctls MFC after: 2 weeks Sponsored by: Mysterious Code Ltd. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sun Jul 5 19:38:36 2020 (r362946) +++ head/usr.bin/truss/syscalls.c Sun Jul 5 19:53:54 2020 (r362947) @@ -1577,14 +1577,37 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct } static void -print_sysctl_oid(FILE *fp, int *oid, int len) +print_sysctl_oid(FILE *fp, int *oid, size_t len) { - int i; + size_t i; + bool first; - for (i = 0; i < len; i++) - fprintf(fp, ".%d", oid[i]); + first = true; + fprintf(fp, "{ "); + for (i = 0; i < len; i++) { + fprintf(fp, "%s%d", first ? "" : ".", oid[i]); + first = false; + } + fprintf(fp, " }"); } +static void +print_sysctl(FILE *fp, int *oid, size_t len) +{ + char name[BUFSIZ]; + int qoid[CTL_MAXNAME + 2]; + size_t i; + + qoid[0] = CTL_SYSCTL; + qoid[1] = CTL_SYSCTL_NAME; + memcpy(qoid + 2, oid, len * sizeof(int)); + i = sizeof(name); + if (sysctl(qoid, len + 2, name, &i, 0, 0) == -1) + print_sysctl_oid(fp, oid, len); + else + fprintf(fp, "%s", name); +} + /* * Converts a syscall argument into a string. Said string is * allocated via malloc(), so needs to be free()'d. sc is @@ -2298,9 +2321,8 @@ print_arg(struct syscall_args *sc, unsigned long *args break; case Sysctl: { char name[BUFSIZ]; - int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2]; - size_t i; - int len; + int oid[CTL_MAXNAME + 2]; + size_t len; memset(name, 0, sizeof(name)); len = args[sc->offset + 1]; @@ -2314,39 +2336,35 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, "debug"); break; case CTL_SYSCTL_NAME: - fprintf(fp, "name"); + fprintf(fp, "name "); print_sysctl_oid(fp, oid + 2, len - 2); break; case CTL_SYSCTL_NEXT: fprintf(fp, "next"); break; case CTL_SYSCTL_NAME2OID: - fprintf(fp, "name2oid"); + fprintf(fp, "name2oid %s", + get_string(pid, + args[sc->offset + 4], + args[sc->offset + 5])); break; case CTL_SYSCTL_OIDFMT: - fprintf(fp, "oidfmt"); - print_sysctl_oid(fp, oid + 2, len - 2); + fprintf(fp, "oidfmt "); + print_sysctl(fp, oid + 2, len - 2); break; case CTL_SYSCTL_OIDDESCR: - fprintf(fp, "oiddescr"); - print_sysctl_oid(fp, oid + 2, len - 2); + fprintf(fp, "oiddescr "); + print_sysctl(fp, oid + 2, len - 2); break; case CTL_SYSCTL_OIDLABEL: - fprintf(fp, "oidlabel"); - print_sysctl_oid(fp, oid + 2, len - 2); + fprintf(fp, "oidlabel "); + print_sysctl(fp, oid + 2, len - 2); break; default: - print_sysctl_oid(fp, oid + 1, len - 1); + print_sysctl(fp, oid + 1, len - 1); } } else { - qoid[0] = CTL_SYSCTL; - qoid[1] = CTL_SYSCTL_NAME; - memcpy(qoid + 2, oid, len * sizeof(int)); - i = sizeof(name); - if (sysctl(qoid, len + 2, name, &i, 0, 0) == -1) - print_sysctl_oid(fp, qoid + 2, len); - else - fprintf(fp, "%s", name); + print_sysctl(fp, oid, len); } fprintf(fp, "\""); } From owner-svn-src-all@freebsd.org Sun Jul 5 20:25:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 786AE34C061; Sun, 5 Jul 2020 20:25:53 +0000 (UTC) (envelope-from pawel.biernacki@gmail.com) Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0Kw053scz4Ldk; Sun, 5 Jul 2020 20:25:52 +0000 (UTC) (envelope-from pawel.biernacki@gmail.com) Received: by mail-ej1-f65.google.com with SMTP id w6so40404856ejq.6; Sun, 05 Jul 2020 13:25:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=8e2JXRl8piMcpqatjjLOfeG1tUviJAvlBD6u3w32Uo8=; b=Cb9t3Rz54qOWWlBQtdk/dF+9VvyLl1s9sHFdqqZMF0QknreRaIguQiFf6fIOlvMtlX jyjtI7u/ohKhI49injzxdv/Z8BUxPvZIvPt2TJAbcpmRwS0PC2tzygreQ7CQZt/RDYxA chCVuzdgw1gBzyADQ/pQmiPkLQJZUdDLaW4868hJMkMcKSBlK4RStDO8TJQSyPlAwBbZ y8WeMxEpr3dt/mMVfQ4mpnB4ZtSyME5mUKERPwPSmIoxSkahKnvov1BVQ7aONlUtbjmQ oZDJ+G0kft5rfFNIDEV+9z0nfHpbHBTCMrBkUpP5vkxLGAdRRf7CD/m7gYGtrYMN+tKs rDJQ== X-Gm-Message-State: AOAM533Pw5R/de7FizFEtHMvD3AM1oRsvKvhP9d6QXfQu87cdLFKj/hd jl4Q95YZ+3XKdw6E0YlcOmU0QheVpBM= X-Google-Smtp-Source: ABdhPJwkxe/9jj9jBLIAt9QRFVZ4da3F6ISDRJLZQXsCwQ3pemMVO2Gc8ChbP4PaltJnwdDocFrwyQ== X-Received: by 2002:ac2:5382:: with SMTP id g2mr14286434lfh.129.1593980303740; Sun, 05 Jul 2020 13:18:23 -0700 (PDT) Received: from macbook.localdomain (31-172-188-241.noc.fibertech.net.pl. [31.172.188.241]) by smtp.gmail.com with ESMTPSA id 11sm4980462lju.102.2020.07.05.13.18.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jul 2020 13:18:23 -0700 (PDT) From: =?utf-8?Q?Pawe=C5=82_Biernacki?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r362947 - head/usr.bin/truss Date: Sun, 5 Jul 2020 22:18:18 +0200 References: <202007051953.065Jrs9T018207@repo.freebsd.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <202007051953.065Jrs9T018207@repo.freebsd.org> Message-Id: <03E07B95-A86B-488C-B3C8-061546E54BBC@FreeBSD.org> X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4B0Kw053scz4Ldk X-Spamd-Bar: +++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of pawelbiernacki@gmail.com designates 209.85.218.65 as permitted sender) smtp.mailfrom=pawelbiernacki@gmail.com X-Spamd-Result: default: False [11.85 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[209.85.218.65:from]; MV_CASE(0.50)[]; R_SPF_ALLOW(0.00)[+ip4:209.85.128.0/17]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.00)[-0.001]; FORGED_SENDER(0.30)[kaktus@FreeBSD.org,pawelbiernacki@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FROM_NEQ_ENVFROM(0.00)[kaktus@FreeBSD.org,pawelbiernacki@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_XBL(5.00)[31.172.188.241:received]; TAGGED_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; SH_AUTHBL_RECEIVED(4.00)[31.172.188.241:received]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_SPAM_MEDIUM(1.05)[1.051]; BAD_REP_POLICIES(0.10)[]; NEURAL_SPAM_LONG(1.00)[1.004]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.65:from]; RCVD_TLS_ALL(0.00)[]; GREYLIST(0.00)[pass,body] X-Spam: Yes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 20:25:53 -0000 Before:=20 = __sysctl("sysctl.name2oid",2,0x7fffff763a80,0x7fffff763280,0x7fffff763680,= 8) =3D 0 (0x0) __sysctl("sysctl.oidfmt.6.2",4,0x7fffff763ae0,0x7fffff762e78,0x0,0) =3D = 0 (0x0) __sysctl("sysctl.name.6.2",4,0x7fffff762180,0x7fffff761d00,0x0,0) =3D 0 = (0x0) __sysctl("sysctl.oidfmt.6.2",4,0x7fffff762980,0x7fffff761d08,0x0,0) =3D = 0 (0x0) __sysctl("sysctl.oiddescr.6.2",4,0x7fffff762580,0x7fffff761d00,0x0,0) =3D = 0 (0x0) After: __sysctl("sysctl.name2oid = hw.model",2,0x7fffff161e60,0x7fffff161660,0x7fffff161a60,8) =3D 0 (0x0) __sysctl("sysctl.oidfmt hw.model",4,0x7fffff161ec0,0x7fffff161258,0x0,0) = =3D 0 (0x0) __sysctl("sysctl.name { 6.2 }",4,0x7fffff160560,0x7fffff1600e0,0x0,0) =3D = 0 (0x0) __sysctl("sysctl.oidfmt hw.model",4,0x7fffff160d60,0x7fffff1600e8,0x0,0) = =3D 0 (0x0) __sysctl("sysctl.oiddescr = hw.model",4,0x7fffff160960,0x7fffff1600e0,0x0,0) =3D 0 (0x0) Reminded by: mjg > On 5 Jul 2020, at 21:53, Pawel Biernacki wrote: >=20 > Author: kaktus > Date: Sun Jul 5 19:53:54 2020 > New Revision: 362947 > URL: https://svnweb.freebsd.org/changeset/base/362947 >=20 > Log: > truss: print more information about traced sysctls >=20 > MFC after: 2 weeks > Sponsored by: Mysterious Code Ltd. >=20 > Modified: > head/usr.bin/truss/syscalls.c >=20 > Modified: head/usr.bin/truss/syscalls.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/usr.bin/truss/syscalls.c Sun Jul 5 19:38:36 2020 = (r362946) > +++ head/usr.bin/truss/syscalls.c Sun Jul 5 19:53:54 2020 = (r362947) > @@ -1577,14 +1577,37 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, = struct=20 > } >=20 > static void > -print_sysctl_oid(FILE *fp, int *oid, int len) > +print_sysctl_oid(FILE *fp, int *oid, size_t len) > { > - int i; > + size_t i; > + bool first; >=20 > - for (i =3D 0; i < len; i++) > - fprintf(fp, ".%d", oid[i]); > + first =3D true; > + fprintf(fp, "{ "); > + for (i =3D 0; i < len; i++) { > + fprintf(fp, "%s%d", first ? "" : ".", oid[i]); > + first =3D false; > + } > + fprintf(fp, " }"); > } >=20 > +static void > +print_sysctl(FILE *fp, int *oid, size_t len) > +{ > + char name[BUFSIZ]; > + int qoid[CTL_MAXNAME + 2]; > + size_t i; > + > + qoid[0] =3D CTL_SYSCTL; > + qoid[1] =3D CTL_SYSCTL_NAME; > + memcpy(qoid + 2, oid, len * sizeof(int)); > + i =3D sizeof(name); > + if (sysctl(qoid, len + 2, name, &i, 0, 0) =3D=3D -1) > + print_sysctl_oid(fp, oid, len); > + else > + fprintf(fp, "%s", name); > +} > + > /* > * Converts a syscall argument into a string. Said string is > * allocated via malloc(), so needs to be free()'d. sc is > @@ -2298,9 +2321,8 @@ print_arg(struct syscall_args *sc, unsigned long = *args > break; > case Sysctl: { > char name[BUFSIZ]; > - int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2]; > - size_t i; > - int len; > + int oid[CTL_MAXNAME + 2]; > + size_t len; >=20 > memset(name, 0, sizeof(name)); > len =3D args[sc->offset + 1]; > @@ -2314,39 +2336,35 @@ print_arg(struct syscall_args *sc, unsigned = long *args > fprintf(fp, "debug"); > break; > case CTL_SYSCTL_NAME: > - fprintf(fp, "name"); > + fprintf(fp, "name "); > print_sysctl_oid(fp, oid + 2, = len - 2); > break; > case CTL_SYSCTL_NEXT: > fprintf(fp, "next"); > break; > case CTL_SYSCTL_NAME2OID: > - fprintf(fp, "name2oid"); > + fprintf(fp, "name2oid %s", > + get_string(pid, > + args[sc->offset + 4], > + args[sc->offset + 5])); > break; > case CTL_SYSCTL_OIDFMT: > - fprintf(fp, "oidfmt"); > - print_sysctl_oid(fp, oid + 2, = len - 2); > + fprintf(fp, "oidfmt "); > + print_sysctl(fp, oid + 2, len - = 2); > break; > case CTL_SYSCTL_OIDDESCR: > - fprintf(fp, "oiddescr"); > - print_sysctl_oid(fp, oid + 2, = len - 2); > + fprintf(fp, "oiddescr "); > + print_sysctl(fp, oid + 2, len - = 2); > break; > case CTL_SYSCTL_OIDLABEL: > - fprintf(fp, "oidlabel"); > - print_sysctl_oid(fp, oid + 2, = len - 2); > + fprintf(fp, "oidlabel "); > + print_sysctl(fp, oid + 2, len - = 2); > break; > default: > - print_sysctl_oid(fp, oid + 1, = len - 1); > + print_sysctl(fp, oid + 1, len - = 1); > } > } else { > - qoid[0] =3D CTL_SYSCTL; > - qoid[1] =3D CTL_SYSCTL_NAME; > - memcpy(qoid + 2, oid, len * = sizeof(int)); > - i =3D sizeof(name); > - if (sysctl(qoid, len + 2, name, &i, 0, = 0) =3D=3D -1) > - print_sysctl_oid(fp, qoid + 2, = len); > - else > - fprintf(fp, "%s", name); > + print_sysctl(fp, oid, len); > } > fprintf(fp, "\""); > } From owner-svn-src-all@freebsd.org Sun Jul 5 20:54:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80B3334D0B2; Sun, 5 Jul 2020 20:54:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0LXV2p1Bz4My7; Sun, 5 Jul 2020 20:54:02 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 433231364C; Sun, 5 Jul 2020 20:54: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 065Ks2tP054543; Sun, 5 Jul 2020 20:54:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065Ks2nZ054542; Sun, 5 Jul 2020 20:54:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007052054.065Ks2nZ054542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 5 Jul 2020 20:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362948 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 20:54:02 -0000 Author: kib Date: Sun Jul 5 20:54:01 2020 New Revision: 362948 URL: https://svnweb.freebsd.org/changeset/base/362948 Log: Fix typo. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Jul 5 19:53:54 2020 (r362947) +++ head/sys/kern/vfs_vnops.c Sun Jul 5 20:54:01 2020 (r362948) @@ -1557,7 +1557,7 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre * "a filesystem-specific preferred I/O block size for this * object. In some filesystem types, this may vary from file * to file" - * Use miminum/default of PAGE_SIZE (e.g. for VCHR). + * Use minimum/default of PAGE_SIZE (e.g. for VCHR). */ sb->st_blksize = max(PAGE_SIZE, vap->va_blocksize); From owner-svn-src-all@freebsd.org Sun Jul 5 21:55:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0268034EEC0; Sun, 5 Jul 2020 21:55:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0Mv85gZXz4Qx1; Sun, 5 Jul 2020 21:55:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6EA313EF1; Sun, 5 Jul 2020 21:55:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 065LtGn3091274; Sun, 5 Jul 2020 21:55:16 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065LtG6c091273; Sun, 5 Jul 2020 21:55:16 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007052155.065LtG6c091273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 5 Jul 2020 21:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362949 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 362949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 21:55:17 -0000 Author: rmacklem Date: Sun Jul 5 21:55:16 2020 New Revision: 362949 URL: https://svnweb.freebsd.org/changeset/base/362949 Log: Add support for ext_pgs mbufs to nfsm_strtom(). Also, add a new function nfsm_add_ext_pgs() which will either add a page or add a new ext_pgs mbuf with a page to the mbuf list. Used by nfsm_strtom(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Modified: head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Sun Jul 5 20:54:01 2020 (r362948) +++ head/sys/fs/nfs/nfs_commonsubs.c Sun Jul 5 21:55:16 2020 (r362949) @@ -832,22 +832,38 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp, bytesize = NFSX_UNSIGNED + siz + rem; m2 = nd->nd_mb; cp2 = nd->nd_bpos; - left = M_TRAILINGSPACE(m2); + if ((nd->nd_flag & ND_EXTPG) != 0) + left = nd->nd_bextpgsiz; + else + left = M_TRAILINGSPACE(m2); + KASSERT(((m2->m_flags & (M_EXT | M_EXTPG)) == + (M_EXT | M_EXTPG) && (nd->nd_flag & ND_EXTPG) != 0) || + ((m2->m_flags & (M_EXT | M_EXTPG)) != + (M_EXT | M_EXTPG) && (nd->nd_flag & ND_EXTPG) == 0), + ("nfsm_strtom: ext_pgs and non-ext_pgs mbufs mixed")); /* * Loop around copying the string to mbuf(s). */ while (siz > 0) { if (left == 0) { - if (siz > ncl_mbuf_mlen) - NFSMCLGET(m1, M_WAITOK); - else - NFSMGET(m1); - m1->m_len = 0; - m2->m_next = m1; - m2 = m1; - cp2 = mtod(m2, caddr_t); - left = M_TRAILINGSPACE(m2); + if ((nd->nd_flag & ND_EXTPG) != 0) { + m2 = nfsm_add_ext_pgs(m2, + nd->nd_maxextsiz, &nd->nd_bextpg); + cp2 = (char *)(void *)PHYS_TO_DMAP( + m2->m_epg_pa[nd->nd_bextpg]); + nd->nd_bextpgsiz = left = PAGE_SIZE; + } else { + if (siz > ncl_mbuf_mlen) + NFSMCLGET(m1, M_WAITOK); + else + NFSMGET(m1); + m1->m_len = 0; + cp2 = mtod(m1, char *); + left = M_TRAILINGSPACE(m1); + m2->m_next = m1; + m2 = m1; + } } if (left >= siz) xfer = siz; @@ -855,18 +871,31 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp, xfer = left; NFSBCOPY(cp, cp2, xfer); cp += xfer; + cp2 += xfer; m2->m_len += xfer; siz -= xfer; left -= xfer; + if ((nd->nd_flag & ND_EXTPG) != 0) { + nd->nd_bextpgsiz -= xfer; + m2->m_epg_last_len += xfer; + } if (siz == 0 && rem) { if (left < rem) panic("nfsm_strtom"); - NFSBZERO(cp2 + xfer, rem); + NFSBZERO(cp2, rem); m2->m_len += rem; + cp2 += rem; + if ((nd->nd_flag & ND_EXTPG) != 0) { + nd->nd_bextpgsiz -= rem; + m2->m_epg_last_len += rem; + } } } nd->nd_mb = m2; - nd->nd_bpos = mtod(m2, caddr_t) + m2->m_len; + if ((nd->nd_flag & ND_EXTPG) != 0) + nd->nd_bpos = cp2; + else + nd->nd_bpos = mtod(m2, char *) + m2->m_len; return (bytesize); } @@ -4844,4 +4873,35 @@ nfsm_set(struct nfsrv_descript *nd, u_int offs) nd->nd_bextpgsiz = PAGE_SIZE; } else nd->nd_bpos = mtod(m, char *) + offs; +} + +/* + * Grow a ext_pgs mbuf list. Either allocate another page or add + * an mbuf to the list. + */ +struct mbuf * +nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *bextpg) +{ + struct mbuf *mp; + vm_page_t pg; + + if ((m->m_epg_npgs + 1) * PAGE_SIZE > maxextsiz) { + mp = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); + *bextpg = 0; + m->m_next = mp; + } else { + do { + pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | + VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); + if (pg == NULL) + vm_wait(NULL); + } while (pg == NULL); + m->m_epg_pa[m->m_epg_npgs] = VM_PAGE_TO_PHYS(pg); + *bextpg = m->m_epg_npgs; + m->m_epg_npgs++; + m->m_epg_last_len = 0; + mp = m; + } + return (mp); } Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Sun Jul 5 20:54:01 2020 (r362948) +++ head/sys/fs/nfs/nfs_var.h Sun Jul 5 21:55:16 2020 (r362949) @@ -361,6 +361,7 @@ void nfsv4_freeslot(struct nfsclsession *, int); struct ucred *nfsrv_getgrpscred(struct ucred *); struct nfsdevice *nfsv4_findmirror(struct nfsmount *); void nfsm_set(struct nfsrv_descript *, u_int); +struct mbuf *nfsm_add_ext_pgs(struct mbuf *, int, int *); /* nfs_clcomsubs.c */ void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int); From owner-svn-src-all@freebsd.org Sun Jul 5 23:07:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E489034F968; Sun, 5 Jul 2020 23:07:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0PVy5T4Wz4TrW; Sun, 5 Jul 2020 23:07:54 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A10814AE6; Sun, 5 Jul 2020 23:07:54 +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 065N7sfi034513; Sun, 5 Jul 2020 23:07:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 065N7sRn034512; Sun, 5 Jul 2020 23:07:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007052307.065N7sRn034512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 5 Jul 2020 23:07:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362950 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 05 Jul 2020 23:07:55 -0000 Author: mjg Date: Sun Jul 5 23:07:54 2020 New Revision: 362950 URL: https://svnweb.freebsd.org/changeset/base/362950 Log: lockf: elide avoidable locking in lf_advlockasync While here assert on ls_threads state. Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Sun Jul 5 21:55:16 2020 (r362949) +++ head/sys/kern/kern_lockf.c Sun Jul 5 23:07:54 2020 (r362950) @@ -637,6 +637,7 @@ retry_setlock: VI_UNLOCK(vp); } else { state = *statep; + MPASS(state->ls_threads >= 0); state->ls_threads++; VI_UNLOCK(vp); @@ -647,6 +648,7 @@ retry_setlock: free(ls, M_LOCKF); } } else { + MPASS(state->ls_threads >= 0); state->ls_threads++; VI_UNLOCK(vp); } @@ -657,8 +659,9 @@ retry_setlock: * locked. lf_purgelocks() requires that no new threads add * pending locks when vnode is marked by VIRF_DOOMED flag. */ - VI_LOCK(vp); if (VN_IS_DOOMED(vp)) { + VI_LOCK(vp); + MPASS(state->ls_threads > 0); state->ls_threads--; wakeup(state); VI_UNLOCK(vp); @@ -666,7 +669,6 @@ retry_setlock: lf_free_lock(lock); return (ENOENT); } - VI_UNLOCK(vp); switch (ap->a_op) { case F_SETLK: @@ -728,15 +730,11 @@ retry_setlock: sx_xunlock(&state->ls_lock); VI_LOCK(vp); - + MPASS(state->ls_threads > 0); state->ls_threads--; - if (LIST_EMPTY(&state->ls_active) && state->ls_threads == 0) { - KASSERT(LIST_EMPTY(&state->ls_pending), - ("freeable state with pending locks")); - } else { + if (state->ls_threads != 0) { wakeup(state); } - VI_UNLOCK(vp); if (error == EDOOFUS) { @@ -790,6 +788,7 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep) VI_UNLOCK(vp); goto out_free; } + MPASS(state->ls_threads >= 0); state->ls_threads++; VI_UNLOCK(vp); @@ -1953,6 +1952,7 @@ lf_iteratelocks_vnode(struct vnode *vp, lf_iterator *f VI_UNLOCK(vp); return (0); } + MPASS(ls->ls_threads >= 0); ls->ls_threads++; VI_UNLOCK(vp); @@ -1976,6 +1976,7 @@ lf_iteratelocks_vnode(struct vnode *vp, lf_iterator *f } sx_xunlock(&ls->ls_lock); VI_LOCK(vp); + MPASS(ls->ls_threads > 0); ls->ls_threads--; wakeup(ls); VI_UNLOCK(vp); From owner-svn-src-all@freebsd.org Mon Jul 6 02:00:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB0DD3520E8; Mon, 6 Jul 2020 02:00:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0TLC5mCZz4Zft; Mon, 6 Jul 2020 02:00:35 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8B2716D1E; Mon, 6 Jul 2020 02:00:35 +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 06620Z16037943; Mon, 6 Jul 2020 02:00:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06620ZZu037942; Mon, 6 Jul 2020 02:00:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007060200.06620ZZu037942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 6 Jul 2020 02:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362951 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 02:00:36 -0000 Author: mjg Date: Mon Jul 6 02:00:35 2020 New Revision: 362951 URL: https://svnweb.freebsd.org/changeset/base/362951 Log: vfs: expand on vhold_smr comment Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Jul 5 23:07:54 2020 (r362950) +++ head/sys/kern/vfs_subr.c Mon Jul 6 02:00:35 2020 (r362951) @@ -3441,10 +3441,23 @@ vholdnz(struct vnode *vp) } /* - * Grab a hold count as long as the vnode is not getting freed. + * Grab a hold count unless the vnode is freed. * * Only use this routine if vfs smr is the only protection you have against * freeing the vnode. + * + * The code loops trying to add a hold count as long as the VHOLD_NO_SMR flag + * is not set. After the flag is set the vnode becomes immutable to anyone but + * the thread which managed to set the flag. + * + * It may be tempting to replace the loop with: + * count = atomic_fetchadd_int(&vp->v_holdcnt, 1); + * if (count & VHOLD_NO_SMR) { + * backpedal and error out; + * } + * + * However, while this is more performant, it hinders debugging by eliminating + * the previously mentioned invariant. */ bool vhold_smr(struct vnode *vp) From owner-svn-src-all@freebsd.org Mon Jul 6 06:28:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC2EE35B57E; Mon, 6 Jul 2020 06:28:20 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0bH852Dtz4p8g; Mon, 6 Jul 2020 06:28:20 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p548612f6.dip0.t-ipconnect.de [84.134.18.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 4CFFD1F367; Mon, 6 Jul 2020 06:28:20 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Mon, 6 Jul 2020 08:28:19 +0200 From: Gordon Bergling To: rgrimes@freebsd.org Cc: Alexey Dokuchaev , Warner Losh , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r362809 - head/contrib/mandoc Message-ID: <20200706062819.GA88664@lion.0xfce3.net> References: <20200705074014.GA16505@lion.0xfce3.net> <202007051722.065HMwE1074449@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007051722.065HMwE1074449@gndrsh.dnsmgr.net> X-Url: X-Operating-System: FreeBSD 12.1-STABLE amd64 X-Host-Uptime: 8:26AM up 2 days, 21:14, 6 users, load averages: 5.05, 4.99, 4.93 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 06:28:20 -0000 On Sun, Jul 05, 2020 at 10:22:58AM -0700, Rodney W. Grimes wrote: > > On Thu, Jul 02, 2020 at 12:06:13AM +0000, Alexey Dokuchaev wrote: > > > On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote: > > > > Thats good, but realize the page already contains history that > > > > reads like: > > > > > > > > HISTORY > > > > Part of the functionality of whatis was already provided by the former > > > > manwhere utility in 1BSD. The apropos and whatis utilities first ap- > > > > peared in 2BSD. They were rewritten from scratch for OpenBSD 5.6. > > > > > > > > The -M option and the MANPATH variable first appeared in 4.3BSD; -m in > > > > 4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos > > > > and in OpenBSD 5.6 for whatis. The options -acfhIKklOTWw appeared in > > > > OpenBSD 5.7. > > > > > > > > And further contains: > > > > > > > > AUTHORS > > > > Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis > > > > in February 1979. The current version was written by Kristaps Dzonsons > > > > and Ingo Schwarze . > > > > > > > > So the history is rich and complete, do we really need to say when we > > > > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page? > > > > > > Ah, in this case, the only thing lacking from the current version is mention > > > of FreeBSD 11.1. Sorry for not checking with that before writing my reply. > > > My main point, however, was that reverse chronological order looks strange. > > > > I have created the following differential and integrated the given feedback. > > > > https://reviews.freebsd.org/D25566 > > > > If necessary I could revert r362809, but somebody should explicit request it. > > Consider it so requested. Consider it done. --Gordon > -- > Rod Grimes rgrimes@freebsd.org > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" -- From owner-svn-src-all@freebsd.org Mon Jul 6 08:36:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4BEE35FB5D; Mon, 6 Jul 2020 08:36:15 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0f6l4Jhhz3T8Q; Mon, 6 Jul 2020 08:36:15 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 726261B6C2; Mon, 6 Jul 2020 08:36:15 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0668aF3A090890; Mon, 6 Jul 2020 08:36:15 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0668aFZo090889; Mon, 6 Jul 2020 08:36:15 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <202007060836.0668aFZo090889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 6 Jul 2020 08:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362952 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 08:36:15 -0000 Author: grehan Date: Mon Jul 6 08:36:14 2020 New Revision: 362952 URL: https://svnweb.freebsd.org/changeset/base/362952 Log: Silence ACPI RTC error/warning in Linux guests. Allow guests to set the RTC bit in the ACPI PM control register. This eliminates an annoying (and harmless) Linux kernel boot message. PR: 244721 Submitted by: Jose Luis Duran MFC after: 1 week Modified: head/usr.sbin/bhyve/pm.c Modified: head/usr.sbin/bhyve/pm.c ============================================================================== --- head/usr.sbin/bhyve/pm.c Mon Jul 6 02:00:35 2020 (r362951) +++ head/usr.sbin/bhyve/pm.c Mon Jul 6 08:36:14 2020 (r362952) @@ -198,7 +198,7 @@ pm1_enable_handler(struct vmctx *ctx, int vcpu, int in * the global lock, but ACPI-CA whines profusely if it * can't set GBL_EN. */ - pm1_enable = *eax & (PM1_PWRBTN_EN | PM1_GBL_EN); + pm1_enable = *eax & (PM1_RTC_EN | PM1_PWRBTN_EN | PM1_GBL_EN); sci_update(ctx); } pthread_mutex_unlock(&pm_lock); From owner-svn-src-all@freebsd.org Mon Jul 6 08:50:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 274BD360361; Mon, 6 Jul 2020 08:50:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0fQw0DsGz3Twh; Mon, 6 Jul 2020 08:50:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6FE51BAAC; Mon, 6 Jul 2020 08:50:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0668oFa8098032; Mon, 6 Jul 2020 08:50:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0668oB1o098012; Mon, 6 Jul 2020 08:50:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202007060850.0668oB1o098012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 6 Jul 2020 08:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362953 - in head/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_fpga_tools dev/mlx5/mlx5_ib dev/mthca ofed/drivers/infiniba... X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_fpga_tools dev/mlx5/mlx5_ib dev/mthca ofed/drivers/infiniband/core ofed/drivers/infi... X-SVN-Commit-Revision: 362953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 08:50:16 -0000 Author: hselasky Date: Mon Jul 6 08:50:11 2020 New Revision: 362953 URL: https://svnweb.freebsd.org/changeset/base/362953 Log: Infiniband clients must be attached and detached in a specific order in ibcore. Currently the linking order of the infiniband, IB, modules decide in which order the clients are attached and detached. For example one IB client may use resources from another IB client. This can lead to a potential deadlock at shutdown. For example if the ipoib is unregistered after the ib_multicast client is detached, then if ipoib is using multicast addresses a deadlock may happen, because ib_multicast will wait for all its resources to be freed before returning from the remove method. Fix this by using module_xxx_order() instead of module_xxx(). Differential Revision: https://reviews.freebsd.org/D23973 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c head/sys/dev/mlx4/mlx4_en/mlx4_en_main.c head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c head/sys/dev/mthca/mthca_main.c head/sys/ofed/drivers/infiniband/core/ib_cm.c head/sys/ofed/drivers/infiniband/core/ib_cma.c head/sys/ofed/drivers/infiniband/core/ib_device.c head/sys/ofed/drivers/infiniband/core/ib_iwcm.c head/sys/ofed/drivers/infiniband/core/ib_ucm.c head/sys/ofed/drivers/infiniband/core/ib_ucma.c head/sys/ofed/drivers/infiniband/core/ib_user_mad.c head/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/ofed/drivers/infiniband/util/madeye.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -4218,8 +4218,8 @@ static void __exit mlx4_cleanup(void) destroy_workqueue(mlx4_wq); } -module_init(mlx4_init); -module_exit(mlx4_cleanup); +module_init_order(mlx4_init, SI_ORDER_FIRST); +module_exit_order(mlx4_cleanup, SI_ORDER_FIRST); static int mlx4_evhand(module_t mod, int event, void *arg) Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -304,8 +304,8 @@ static void __exit mlx4_en_cleanup(void) mlx4_unregister_interface(&mlx4_en_interface); } -module_init(mlx4_en_init); -module_exit(mlx4_en_cleanup); +module_init_order(mlx4_en_init, SI_ORDER_SIXTH); +module_exit_order(mlx4_en_cleanup, SI_ORDER_SIXTH); static int mlx4en_evhand(module_t mod, int event, void *arg) Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -3319,8 +3319,8 @@ static void __exit mlx4_ib_cleanup(void) destroy_workqueue(wq); } -module_init_order(mlx4_ib_init, SI_ORDER_THIRD); -module_exit(mlx4_ib_cleanup); +module_init_order(mlx4_ib_init, SI_ORDER_SEVENTH); +module_exit_order(mlx4_ib_cleanup, SI_ORDER_SEVENTH); static int mlx4ib_evhand(module_t mod, int event, void *arg) Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -2026,5 +2026,5 @@ static void __exit cleanup(void) pci_unregister_driver(&mlx5_core_driver); } -module_init(init); -module_exit(cleanup); +module_init_order(init, SI_ORDER_FIRST); +module_exit_order(cleanup, SI_ORDER_FIRST); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -4723,8 +4723,8 @@ mlx5e_show_version(void __unused *arg) } SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); -module_init_order(mlx5e_init, SI_ORDER_THIRD); -module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD); +module_init_order(mlx5e_init, SI_ORDER_SIXTH); +module_exit_order(mlx5e_cleanup, SI_ORDER_SIXTH); #if (__FreeBSD_version >= 1100000) MODULE_DEPEND(mlx5en, linuxkpi, 1, 1, 1); Modified: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -139,5 +139,5 @@ static void __exit mlx5_fpga_tools_exit(void) mlx5_fpga_tools_char_deinit(); } -module_init(mlx5_fpga_tools_init); -module_exit(mlx5_fpga_tools_exit); +module_init_order(mlx5_fpga_tools_init, SI_ORDER_SECOND); +module_exit_order(mlx5_fpga_tools_exit, SI_ORDER_SECOND); Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -3399,5 +3399,5 @@ mlx5_ib_show_version(void __unused *arg) } SYSINIT(mlx5_ib_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5_ib_show_version, NULL); -module_init_order(mlx5_ib_init, SI_ORDER_THIRD); -module_exit_order(mlx5_ib_cleanup, SI_ORDER_THIRD); +module_init_order(mlx5_ib_init, SI_ORDER_SEVENTH); +module_exit_order(mlx5_ib_cleanup, SI_ORDER_SEVENTH); Modified: head/sys/dev/mthca/mthca_main.c ============================================================================== --- head/sys/dev/mthca/mthca_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/dev/mthca/mthca_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1271,8 +1271,8 @@ static void __exit mthca_cleanup(void) mthca_catas_cleanup(); } -module_init_order(mthca_init, SI_ORDER_THIRD); -module_exit(mthca_cleanup); +module_init_order(mthca_init, SI_ORDER_SEVENTH); +module_exit_order(mthca_cleanup, SI_ORDER_SEVENTH); MODULE_VERSION(mthca, 1); MODULE_DEPEND(mthca, ibcore, 1, 1, 1); Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Mon Jul 6 08:50:11 2020 (r362953) @@ -4180,5 +4180,5 @@ static void __exit ib_cm_cleanup(void) } module_init_order(ib_cm_init, SI_ORDER_SECOND); -module_exit_order(ib_cm_cleanup, SI_ORDER_FIRST); +module_exit_order(ib_cm_cleanup, SI_ORDER_SECOND); Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Mon Jul 6 08:50:11 2020 (r362953) @@ -4619,5 +4619,5 @@ static void __exit cma_cleanup(void) destroy_workqueue(cma_wq); } -module_init(cma_init); -module_exit(cma_cleanup); +module_init_order(cma_init, SI_ORDER_FOURTH); +module_exit_order(cma_cleanup, SI_ORDER_FOURTH); Modified: head/sys/ofed/drivers/infiniband/core/ib_device.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_device.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_device.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1060,8 +1060,25 @@ static void __exit ib_core_cleanup(void) destroy_workqueue(ib_wq); } -module_init(ib_core_init); -module_exit(ib_core_cleanup); +/* + * Typical loading and unloading order values and their use: + * + * SI_ORDER_FIRST (default for module_init): + * Core modules (PCI, infiniband) + * SI_ORDER_SECOND (default for module_exit): + * Infiniband core modules (CM) + * SI_ORDER_THIRD: + * SI_ORDER_FOURTH: + * Infiniband core modules (CMA) + * SI_ORDER_FIFTH: + * Infiniband user-space modules (UCM,UCMA,UMAD,UVERBS,IPOIB) + * SI_ORDER_SIXTH: + * Network HW driver modules + * SI_ORDER_SEVENTH: + * Infiniband HW driver modules + */ +module_init_order(ib_core_init, SI_ORDER_FIRST); +module_exit_order(ib_core_cleanup, SI_ORDER_FIRST); MODULE_VERSION(ibcore, 1); MODULE_DEPEND(ibcore, linuxkpi, 1, 1, 1); Modified: head/sys/ofed/drivers/infiniband/core/ib_iwcm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1052,5 +1052,5 @@ static void __exit iw_cm_cleanup(void) destroy_workqueue(iwcm_wq); } -module_init(iw_cm_init); -module_exit(iw_cm_cleanup); +module_init_order(iw_cm_init, SI_ORDER_FIRST); +module_exit_order(iw_cm_cleanup, SI_ORDER_FIRST); Modified: head/sys/ofed/drivers/infiniband/core/ib_ucm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_ucm.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_ucm.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1371,5 +1371,5 @@ static void __exit ib_ucm_cleanup(void) idr_destroy(&ctx_id_table); } -module_init_order(ib_ucm_init, SI_ORDER_THIRD); -module_exit(ib_ucm_cleanup); +module_init_order(ib_ucm_init, SI_ORDER_FIFTH); +module_exit_order(ib_ucm_cleanup, SI_ORDER_FIFTH); Modified: head/sys/ofed/drivers/infiniband/core/ib_ucma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_ucma.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_ucma.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1782,5 +1782,5 @@ static void __exit ucma_cleanup(void) idr_destroy(&multicast_idr); } -module_init(ucma_init); -module_exit(ucma_cleanup); +module_init_order(ucma_init, SI_ORDER_FIFTH); +module_exit_order(ucma_cleanup, SI_ORDER_FIFTH); Modified: head/sys/ofed/drivers/infiniband/core/ib_user_mad.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1405,5 +1405,5 @@ static void __exit ib_umad_cleanup(void) unregister_chrdev_region(overflow_maj, IB_UMAD_MAX_PORTS * 2); } -module_init_order(ib_umad_init, SI_ORDER_THIRD); -module_exit(ib_umad_cleanup); +module_init_order(ib_umad_init, SI_ORDER_FIFTH); +module_exit_order(ib_umad_cleanup, SI_ORDER_FIFTH); Modified: head/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1431,5 +1431,5 @@ static void __exit ib_uverbs_cleanup(void) idr_destroy(&ib_uverbs_srq_idr); } -module_init_order(ib_uverbs_init, SI_ORDER_THIRD); -module_exit(ib_uverbs_cleanup); +module_init_order(ib_uverbs_init, SI_ORDER_FIFTH); +module_exit_order(ib_uverbs_cleanup, SI_ORDER_FIFTH); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Jul 6 08:50:11 2020 (r362953) @@ -1753,8 +1753,8 @@ ipoib_resolvemulti(struct ifnet *ifp, struct sockaddr } } -module_init(ipoib_init_module); -module_exit(ipoib_cleanup_module); +module_init_order(ipoib_init_module, SI_ORDER_FIFTH); +module_exit_order(ipoib_cleanup_module, SI_ORDER_FIFTH); static int ipoib_evhand(module_t mod, int event, void *arg) Modified: head/sys/ofed/drivers/infiniband/util/madeye.c ============================================================================== --- head/sys/ofed/drivers/infiniband/util/madeye.c Mon Jul 6 08:36:14 2020 (r362952) +++ head/sys/ofed/drivers/infiniband/util/madeye.c Mon Jul 6 08:50:11 2020 (r362953) @@ -594,5 +594,5 @@ static void __exit ib_madeye_cleanup(void) ib_unregister_client(&madeye_client); } -module_init(ib_madeye_init); -module_exit(ib_madeye_cleanup); +module_init_order(ib_madeye_init, SI_ORDER_THIRD); +module_exit_order(ib_madeye_cleanup, SI_ORDER_THIRD); From owner-svn-src-all@freebsd.org Mon Jul 6 08:51:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E216360543; Mon, 6 Jul 2020 08:51:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0fSs0cPWz3VFP; Mon, 6 Jul 2020 08:51:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E48721BC7A; Mon, 6 Jul 2020 08:51:56 +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 0668pu9C003652; Mon, 6 Jul 2020 08:51:56 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0668puow003646; Mon, 6 Jul 2020 08:51:56 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007060851.0668puow003646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 6 Jul 2020 08:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362954 - in head/sys: arm/broadcom/bcm2835 conf dev/pci X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 conf dev/pci X-SVN-Commit-Revision: 362954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 08:51:57 -0000 Author: andrew Date: Mon Jul 6 08:51:55 2020 New Revision: 362954 URL: https://svnweb.freebsd.org/changeset/base/362954 Log: Add a driver for bcm2838 PCI express controller This adds support for the Broadcom bcm2711 PCI express controller, found on the Raspberry Pi 4 (aka the bcm2838 SoC). The driver has only been developed against the soldered-on VIA XHCI controller and not tested with other end points. Submitted by: Robert Crowston Differential Revision: https://reviews.freebsd.org/D25068 Added: head/sys/arm/broadcom/bcm2835/bcm2838_pci.c (contents, props changed) Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x head/sys/conf/files.arm64 head/sys/dev/pci/pci_host_generic_fdt.c head/sys/dev/pci/pci_host_generic_fdt.h Added: head/sys/arm/broadcom/bcm2835/bcm2838_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2838_pci.c Mon Jul 6 08:51:55 2020 (r362954) @@ -0,0 +1,743 @@ +/*- + * SPDX-License-Identifier: ISC + * + * Copyright (c) 2020 Dr Robert Harvey Crowston + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * + * $FreeBSD$ + * + */ + +/* + * BCM2838-compatible PCI-express controller. + * + * Broadcom likes to give the same chip lots of different names. The name of + * this driver is taken from the Raspberry Pi 4 Broadcom 2838 chip. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "pcib_if.h" +#include "msi_if.h" + +extern struct bus_space memmap_bus; + +#define BUS_SPACE_3G_MAXADDR 0xc0000000 +#define PCI_ID_VAL3 0x43c +#define CLASS_SHIFT 0x10 +#define SUBCLASS_SHIFT 0x8 + +#define REG_CONTROLLER_HW_REV 0x406c +#define REG_BRIDGE_CTRL 0x9210 +#define BRIDGE_DISABLE_FLAG 0x1 +#define BRIDGE_RESET_FLAG 0x2 +#define REG_BRIDGE_SERDES_MODE 0x4204 +#define REG_BRIDGE_CONFIG 0x4008 +#define REG_BRIDGE_MEM_WINDOW_LOW 0x4034 +#define REG_BRIDGE_MEM_WINDOW_HIGH 0x4038 +#define REG_BRIDGE_MEM_WINDOW_1 0x403c +#define REG_BRIDGE_GISB_WINDOW 0x402c +#define REG_BRIDGE_STATE 0x4068 +#define REG_BRIDGE_LINK_STATE 0x00bc +#define REG_BRIDGE_BUS_WINDOW_LOW 0x400c +#define REG_BRIDGE_BUS_WINDOW_HIGH 0x4010 +#define REG_BRIDGE_CPU_WINDOW_LOW 0x4070 +#define REG_BRIDGE_CPU_WINDOW_START_HIGH 0x4080 +#define REG_BRIDGE_CPU_WINDOW_END_HIGH 0x4084 + +#define REG_MSI_ADDR_LOW 0x4044 +#define REG_MSI_ADDR_HIGH 0x4048 +#define REG_MSI_CONFIG 0x404c +#define REG_MSI_CLR 0x4508 +#define REG_MSI_MASK_CLR 0x4514 +#define REG_MSI_RAISED 0x4500 +#define REG_MSI_EOI 0x4060 +#define NUM_MSI 32 + +#define REG_EP_CONFIG_CHOICE 0x9000 +#define REG_EP_CONFIG_DATA 0x8000 + +/* + * These values were obtained from runtime inspection of a Linux system using a + * JTAG. The very limited documentation I have obtained from Broadcom does not + * explain how to compute them. + */ +#define REG_VALUE_4GB_WINDOW 0x11 +#define REG_VALUE_4GB_CONFIG 0x88003000 +#define REG_VALUE_MSI_CONFIG 0xffe06540 + +struct bcm_pcib_irqsrc { + struct intr_irqsrc isrc; + u_int irq; + bool allocated; +}; + +struct bcm_pcib_softc { + struct generic_pcie_fdt_softc base; + device_t dev; + struct mtx config_mtx; + struct mtx msi_mtx; + struct resource *msi_irq_res; + void *msi_intr_cookie; + struct bcm_pcib_irqsrc *msi_isrcs; + pci_addr_t msi_addr; +}; + +static struct ofw_compat_data compat_data[] = { + {"brcm,bcm2711-pcie", 1}, + {"brcm,bcm7211-pcie", 1}, + {"brcm,bcm7445-pcie", 1}, + + {NULL, 0} +}; + +static int +bcm_pcib_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, + "BCM2838-compatible PCI-express controller"); + return (BUS_PROBE_DEFAULT); +} + +static void +bcm_pcib_set_reg(struct bcm_pcib_softc *sc, uint32_t reg, uint32_t val) +{ + + bus_space_write_4(sc->base.base.bst, sc->base.base.bsh, reg, + htole32(val)); +} + +static uint32_t +bcm_pcib_read_reg(struct bcm_pcib_softc *sc, uint32_t reg) +{ + + return (le32toh(bus_space_read_4(sc->base.base.bst, sc->base.base.bsh, + reg))); +} + +static void +bcm_pcib_reset_controller(struct bcm_pcib_softc *sc) +{ + uint32_t val; + + val = bcm_pcib_read_reg(sc, REG_BRIDGE_CTRL); + val = val | BRIDGE_RESET_FLAG | BRIDGE_DISABLE_FLAG; + bcm_pcib_set_reg(sc, REG_BRIDGE_CTRL, val); + + DELAY(100); + + val = bcm_pcib_read_reg(sc, REG_BRIDGE_CTRL); + val = val & ~BRIDGE_RESET_FLAG; + bcm_pcib_set_reg(sc, REG_BRIDGE_CTRL, val); + + DELAY(100); + + bcm_pcib_set_reg(sc, REG_BRIDGE_SERDES_MODE, 0); + + DELAY(100); +} + +static void +bcm_pcib_enable_controller(struct bcm_pcib_softc *sc) +{ + uint32_t val; + + val = bcm_pcib_read_reg(sc, REG_BRIDGE_CTRL); + val = val & ~BRIDGE_DISABLE_FLAG; + bcm_pcib_set_reg(sc, REG_BRIDGE_CTRL, val); + + DELAY(100); +} + +static int +bcm_pcib_check_ranges(device_t dev) +{ + struct bcm_pcib_softc *sc; + struct pcie_range *ranges; + int error = 0, i; + + sc = device_get_softc(dev); + ranges = &sc->base.base.ranges[0]; + + /* The first range needs to be non-zero. */ + if (ranges[0].size == 0) { + device_printf(dev, "error: first outbound memory range " + "(pci addr: 0x%jx, cpu addr: 0x%jx) has zero size.\n", + ranges[0].pci_base, ranges[0].phys_base); + error = ENXIO; + } + + /* + * The controller can actually handle three distinct ranges, but we + * only implement support for one. + */ + for (i = 1; (bootverbose || error) && i < MAX_RANGES_TUPLES; ++i) { + if (ranges[i].size > 0) + device_printf(dev, + "note: outbound memory range %d (pci addr: 0x%jx, " + "cpu addr: 0x%jx, size: 0x%jx) will be ignored.\n", + i, ranges[i].pci_base, ranges[i].phys_base, + ranges[i].size); + } + + return (error); +} + +static const char * +bcm_pcib_link_state_string(uint32_t mode) +{ + + switch(mode & PCIEM_LINK_STA_SPEED) { + case 0: + return ("not up"); + case 1: + return ("2.5 GT/s"); + case 2: + return ("5.0 GT/s"); + case 4: + return ("8.0 GT/s"); + default: + return ("unknown"); + } +} + +static bus_addr_t +bcm_get_offset_and_prepare_config(struct bcm_pcib_softc *sc, u_int bus, + u_int slot, u_int func, u_int reg) +{ + /* + * Config for an end point is only available through a narrow window for + * one end point at a time. We first tell the controller which end point + * we want, then access it through the window. + */ + uint32_t func_index; + + if (bus == 0 && slot == 0 && func == 0) + /* + * Special case for root device; its config is always available + * through the zero-offset. + */ + return (reg); + + /* Tell the controller to show us the config in question. */ + func_index = PCIE_ADDR_OFFSET(bus, slot, func, 0); + bcm_pcib_set_reg(sc, REG_EP_CONFIG_CHOICE, func_index); + + return (REG_EP_CONFIG_DATA + reg); +} + +static bool +bcm_pcib_is_valid_quad(struct bcm_pcib_softc *sc, u_int bus, u_int slot, + u_int func, u_int reg) +{ + + if ((bus < sc->base.base.bus_start) || (bus > sc->base.base.bus_end)) + return (false); + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) + return (false); + + if (bus == 0 && slot == 0 && func == 0) + return (true); + if (bus == 0) + /* + * Probing other slots and funcs on bus 0 will lock up the + * memory controller. + */ + return (false); + + return (true); +} + +static uint32_t +bcm_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, + int bytes) +{ + struct bcm_pcib_softc *sc; + bus_space_handle_t h; + bus_space_tag_t t; + bus_addr_t offset; + uint32_t data; + + sc = device_get_softc(dev); + if (!bcm_pcib_is_valid_quad(sc, bus, slot, func, reg)) + return (~0U); + + mtx_lock(&sc->config_mtx); + offset = bcm_get_offset_and_prepare_config(sc, bus, slot, func, reg); + + t = sc->base.base.bst; + h = sc->base.base.bsh; + + switch (bytes) { + case 1: + data = bus_space_read_1(t, h, offset); + break; + case 2: + data = le16toh(bus_space_read_2(t, h, offset)); + break; + case 4: + data = le32toh(bus_space_read_4(t, h, offset)); + break; + default: + data = ~0U; + break; + } + + mtx_unlock(&sc->config_mtx); + return (data); +} + +static void +bcm_pcib_write_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, uint32_t val, int bytes) +{ + struct bcm_pcib_softc *sc; + bus_space_handle_t h; + bus_space_tag_t t; + uint32_t offset; + + sc = device_get_softc(dev); + if (!bcm_pcib_is_valid_quad(sc, bus, slot, func, reg)) + return; + + mtx_lock(&sc->config_mtx); + offset = bcm_get_offset_and_prepare_config(sc, bus, slot, func, reg); + + t = sc->base.base.bst; + h = sc->base.base.bsh; + + switch (bytes) { + case 1: + bus_space_write_1(t, h, offset, val); + break; + case 2: + bus_space_write_2(t, h, offset, htole16(val)); + break; + case 4: + bus_space_write_4(t, h, offset, htole32(val)); + break; + default: + break; + } + + mtx_unlock(&sc->config_mtx); +} + +static void +bcm_pcib_msi_intr_process(struct bcm_pcib_softc *sc, uint32_t interrupt_bitmap, + struct trapframe *tf) +{ + struct bcm_pcib_irqsrc *irqsrc; + uint32_t bit, irq; + + while ((bit = ffs(interrupt_bitmap))) { + irq = bit - 1; + + /* Acknowledge interrupt. */ + bcm_pcib_set_reg(sc, REG_MSI_CLR, 1 << irq); + + /* Send EOI. */ + bcm_pcib_set_reg(sc, REG_MSI_EOI, 1); + + /* Despatch to handler. */ + irqsrc = &sc->msi_isrcs[irq]; + if (intr_isrc_dispatch(&irqsrc->isrc, tf)) + device_printf(sc->dev, + "note: unexpected interrupt (%d) triggered.\n", + irq); + + /* Done with this interrupt. */ + interrupt_bitmap = interrupt_bitmap & ~(1 << irq); + } +} + +static int +bcm_pcib_msi_intr(void *arg) +{ + struct bcm_pcib_softc *sc; + struct trapframe *tf; + uint32_t interrupt_bitmap; + + sc = (struct bcm_pcib_softc *) arg; + tf = curthread->td_intr_frame; + + while ((interrupt_bitmap = bcm_pcib_read_reg(sc, REG_MSI_RAISED))) + bcm_pcib_msi_intr_process(sc, interrupt_bitmap, tf); + + return (FILTER_HANDLED); +} + +static int +bcm_pcib_alloc_msi(device_t dev, device_t child, int count, int maxcount, + device_t *pic, struct intr_irqsrc **srcs) +{ + struct bcm_pcib_softc *sc; + int first_int, i; + + sc = device_get_softc(dev); + mtx_lock(&sc->msi_mtx); + + /* Find a continguous region of free message-signalled interrupts. */ + for (first_int = 0; first_int + count < NUM_MSI; ) { + for (i = first_int; i < first_int + count; ++i) { + if (sc->msi_isrcs[i].allocated) + goto next; + } + goto found; +next: + first_int = i + 1; + } + + /* No appropriate region available. */ + mtx_unlock(&sc->msi_mtx); + device_printf(dev, "warning: failed to allocate %d MSI messages.\n", + count); + return (ENXIO); + +found: + /* Mark the messages as in use. */ + for (i = 0; i < count; ++i) { + sc->msi_isrcs[i + first_int].allocated = true; + srcs[i] = &(sc->msi_isrcs[i + first_int].isrc); + } + + mtx_unlock(&sc->msi_mtx); + *pic = device_get_parent(dev); + + return (0); +} + +static int +bcm_pcib_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, + uint64_t *addr, uint32_t *data) +{ + struct bcm_pcib_softc *sc; + struct bcm_pcib_irqsrc *msi_msg; + + sc = device_get_softc(dev); + msi_msg = (struct bcm_pcib_irqsrc *) isrc; + + *addr = sc->msi_addr; + *data = (REG_VALUE_MSI_CONFIG & 0xffff) | msi_msg->irq; + return (0); +} + +static int +bcm_pcib_release_msi(device_t dev, device_t child, int count, + struct intr_irqsrc **isrc) +{ + struct bcm_pcib_softc *sc; + struct bcm_pcib_irqsrc *msi_isrc; + int i; + + sc = device_get_softc(dev); + mtx_lock(&sc->msi_mtx); + + for (i = 0; i < count; i++) { + msi_isrc = (struct bcm_pcib_irqsrc *) isrc[i]; + msi_isrc->allocated = false; + } + + mtx_unlock(&sc->msi_mtx); + return (0); +} + +static int +bcm_pcib_msi_attach(device_t dev) +{ + struct bcm_pcib_softc *sc; + phandle_t node, xref; + char const *bcm_name; + int i, rid; + + sc = device_get_softc(dev); + sc->msi_addr = 0xffffffffc; + + /* Clear any pending interrupts. */ + bcm_pcib_set_reg(sc, REG_MSI_CLR, 0xffffffff); + + rid = 1; + sc->msi_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->msi_irq_res == NULL) { + device_printf(dev, "could not allocate MSI irq resource.\n"); + return (ENXIO); + } + + sc->msi_isrcs = malloc(sizeof(*sc->msi_isrcs) * NUM_MSI, M_DEVBUF, + M_WAITOK | M_ZERO); + + int error = bus_setup_intr(dev, sc->msi_irq_res, INTR_TYPE_BIO | + INTR_MPSAFE, bcm_pcib_msi_intr, NULL, sc, &sc->msi_intr_cookie); + if (error) { + device_printf(dev, "error: failed to setup MSI handler.\n"); + return (ENXIO); + } + + bcm_name = device_get_nameunit(dev); + for (i = 0; i < NUM_MSI; i++) { + sc->msi_isrcs[i].irq = i; + error = intr_isrc_register(&sc->msi_isrcs[i].isrc, dev, 0, + "%s,%u", bcm_name, i); + if (error) { + device_printf(dev, + "error: failed to register interrupt %d.\n", i); + return (ENXIO); + } + } + + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + OF_device_register_xref(xref, dev); + + error = intr_msi_register(dev, xref); + if (error) + return (ENXIO); + + mtx_init(&sc->msi_mtx, "bcm_pcib: msi_mtx", NULL, MTX_DEF); + + bcm_pcib_set_reg(sc, REG_MSI_MASK_CLR, 0xffffffff); + bcm_pcib_set_reg(sc, REG_MSI_ADDR_LOW, (sc->msi_addr & 0xffffffff) | 1); + bcm_pcib_set_reg(sc, REG_MSI_ADDR_HIGH, (sc->msi_addr >> 32)); + bcm_pcib_set_reg(sc, REG_MSI_CONFIG, REG_VALUE_MSI_CONFIG); + + return (0); +} + +static void +bcm_pcib_relocate_bridge_window(device_t dev) +{ + /* + * In principle an out-of-bounds bridge window could be automatically + * adjusted at resource-activation time to lie within the bus address + * space by pcib_grow_window(), but that is not possible because the + * out-of-bounds resource allocation fails at allocation time. Instead, + * we will just fix up the window on the controller here, before it is + * re-discovered by pcib_probe_windows(). + */ + + struct bcm_pcib_softc *sc; + pci_addr_t base, size, new_base, new_limit; + uint16_t val; + + sc = device_get_softc(dev); + + val = bcm_pcib_read_config(dev, 0, 0, 0, PCIR_MEMBASE_1, 2); + base = PCI_PPBMEMBASE(0, val); + + val = bcm_pcib_read_config(dev, 0, 0, 0, PCIR_MEMLIMIT_1, 2); + size = PCI_PPBMEMLIMIT(0, val) - base; + + new_base = sc->base.base.ranges[0].pci_base; + val = (uint16_t) (new_base >> 16); + bcm_pcib_write_config(dev, 0, 0, 0, PCIR_MEMBASE_1, val, 2); + + new_limit = new_base + size; + val = (uint16_t) (new_limit >> 16); + bcm_pcib_write_config(dev, 0, 0, 0, PCIR_MEMLIMIT_1, val, 2); +} + +static uint32_t +encode_cpu_window_low(pci_addr_t phys_base, bus_size_t size) +{ + + return (((phys_base >> 0x10) & 0xfff0) | + ((phys_base + size - 1) & 0xfff00000)); +} + +static uint32_t +encode_cpu_window_start_high(pci_addr_t phys_base) +{ + + return ((phys_base >> 0x20) & 0xff); +} + +static uint32_t +encode_cpu_window_end_high(pci_addr_t phys_base, bus_size_t size) +{ + + return (((phys_base + size - 1) >> 0x20) & 0xff); +} + +static int +bcm_pcib_attach(device_t dev) +{ + struct bcm_pcib_softc *sc; + pci_addr_t phys_base, pci_base; + bus_size_t size; + uint32_t hardware_rev, bridge_state, link_state; + int error, tries; + + sc = device_get_softc(dev); + sc->dev = dev; + + error = pci_host_generic_setup_fdt(dev); + if (error) + return (error); + + error = bcm_pcib_check_ranges(dev); + if (error) + return (error); + + mtx_init(&sc->config_mtx, "bcm_pcib: config_mtx", NULL, MTX_DEF); + + bcm_pcib_reset_controller(sc); + + hardware_rev = bcm_pcib_read_reg(sc, REG_CONTROLLER_HW_REV) & 0xffff; + device_printf(dev, "hardware identifies as revision 0x%x.\n", + hardware_rev); + + /* + * Set PCI->CPU memory window. This encodes the inbound window showing + * up to 4 GiB of system memory to the controller, with zero offset. + * Thus, from the perspective of a device on the PCI-E bus, there is a + * 1:1 map from PCI-E bus addresses to system memory addresses. However, + * a hardware limitation means that the controller can only perform DMA + * on the lower 3 GiB of system memory. + */ + bcm_pcib_set_reg(sc, REG_BRIDGE_MEM_WINDOW_LOW, REG_VALUE_4GB_WINDOW); + bcm_pcib_set_reg(sc, REG_BRIDGE_MEM_WINDOW_HIGH, 0); + bcm_pcib_set_reg(sc, REG_BRIDGE_CONFIG, REG_VALUE_4GB_CONFIG); + bcm_pcib_set_reg(sc, REG_BRIDGE_GISB_WINDOW, 0); + bcm_pcib_set_reg(sc, REG_BRIDGE_MEM_WINDOW_1, 0); + + bcm_pcib_enable_controller(sc); + + /* Wait for controller to start. */ + for(tries = 0; ; ++tries) { + bridge_state = bcm_pcib_read_reg(sc, REG_BRIDGE_STATE); + + if ((bridge_state & 0x30) == 0x30) + /* Controller ready. */ + break; + + if (tries > 100) { + device_printf(dev, + "error: controller failed to start.\n"); + return (ENXIO); + } + + DELAY(1000); + } + + link_state = bcm_pcib_read_reg(sc, REG_BRIDGE_LINK_STATE) >> 0x10; + if (!link_state) { + device_printf(dev, "error: controller started but link is not " + "up.\n"); + return (ENXIO); + } + if (bootverbose) + device_printf(dev, "note: reported link speed is %s.\n", + bcm_pcib_link_state_string(link_state)); + + /* + * Set the CPU->PCI memory window. The map in this direction is not 1:1. + * Addresses seen by the CPU need to be adjusted to make sense to the + * controller as they pass through the window. + */ + pci_base = sc->base.base.ranges[0].pci_base; + phys_base = sc->base.base.ranges[0].phys_base; + size = sc->base.base.ranges[0].size; + + bcm_pcib_set_reg(sc, REG_BRIDGE_BUS_WINDOW_LOW, pci_base & 0xffffffff); + bcm_pcib_set_reg(sc, REG_BRIDGE_BUS_WINDOW_HIGH, pci_base >> 32); + + bcm_pcib_set_reg(sc, REG_BRIDGE_CPU_WINDOW_LOW, + encode_cpu_window_low(phys_base, size)); + bcm_pcib_set_reg(sc, REG_BRIDGE_CPU_WINDOW_START_HIGH, + encode_cpu_window_start_high(phys_base)); + bcm_pcib_set_reg(sc, REG_BRIDGE_CPU_WINDOW_END_HIGH, + encode_cpu_window_end_high(phys_base, size)); + + /* + * The controller starts up declaring itself an endpoint; readvertise it + * as a bridge. + */ + bcm_pcib_set_reg(sc, PCI_ID_VAL3, + PCIC_BRIDGE << CLASS_SHIFT | PCIS_BRIDGE_PCI << SUBCLASS_SHIFT); + + bcm_pcib_set_reg(sc, REG_BRIDGE_SERDES_MODE, 0x2); + DELAY(100); + + bcm_pcib_relocate_bridge_window(dev); + + /* Configure interrupts. */ + error = bcm_pcib_msi_attach(dev); + if (error) + return (error); + + /* Done. */ + device_add_child(dev, "pci", -1); + return (bus_generic_attach(dev)); +} + +/* + * Device method table. + */ +static device_method_t bcm_pcib_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, bcm_pcib_probe), + DEVMETHOD(device_attach, bcm_pcib_attach), + + /* PCIB interface. */ + DEVMETHOD(pcib_read_config, bcm_pcib_read_config), + DEVMETHOD(pcib_write_config, bcm_pcib_write_config), + + /* MSI interface. */ + DEVMETHOD(msi_alloc_msi, bcm_pcib_alloc_msi), + DEVMETHOD(msi_release_msi, bcm_pcib_release_msi), + DEVMETHOD(msi_map_msi, bcm_pcib_map_msi), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(pcib, bcm_pcib_driver, bcm_pcib_methods, + sizeof(struct bcm_pcib_softc), generic_pcie_fdt_driver); + +static devclass_t bcm_pcib_devclass; +DRIVER_MODULE(pcib, simplebus, bcm_pcib_driver, bcm_pcib_devclass, 0, 0); + Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- head/sys/arm/broadcom/bcm2835/files.bcm283x Mon Jul 6 08:50:11 2020 (r362953) +++ head/sys/arm/broadcom/bcm2835/files.bcm283x Mon Jul 6 08:51:55 2020 (r362954) @@ -17,6 +17,7 @@ arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_s arm/broadcom/bcm2835/bcm2835_vcbus.c standard arm/broadcom/bcm2835/bcm2835_vcio.c standard arm/broadcom/bcm2835/bcm2835_wdog.c standard +arm/broadcom/bcm2835/bcm2838_pci.c optional pci arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt dev/mbox/mbox_if.m standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Jul 6 08:50:11 2020 (r362953) +++ head/sys/conf/files.arm64 Mon Jul 6 08:51:55 2020 (r362954) @@ -105,6 +105,7 @@ arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt soc_brcm_bcm2837 | dwcotg fdt soc_brcm_bcm2838 +arm/broadcom/bcm2835/bcm2838_pci.c optional soc_brcm_bcm2838 fdt pci arm/freescale/vybrid/vf_i2c.c optional vf_i2c iicbus SOC_NXP_LS arm/mv/a37x0_gpio.c optional a37x0_gpio gpio fdt arm/mv/a37x0_iic.c optional a37x0_iic iicbus fdt Modified: head/sys/dev/pci/pci_host_generic_fdt.c ============================================================================== --- head/sys/dev/pci/pci_host_generic_fdt.c Mon Jul 6 08:50:11 2020 (r362953) +++ head/sys/dev/pci/pci_host_generic_fdt.c Mon Jul 6 08:51:55 2020 (r362954) @@ -120,7 +120,7 @@ generic_pcie_fdt_probe(device_t dev) } int -pci_host_generic_attach(device_t dev) +pci_host_generic_setup_fdt(device_t dev) { struct generic_pcie_fdt_softc *sc; phandle_t node; @@ -149,11 +149,27 @@ pci_host_generic_attach(device_t dev) /* TODO parse FDT bus ranges */ sc->base.bus_start = 0; sc->base.bus_end = 0xFF; + error = pci_host_generic_core_attach(dev); if (error != 0) return (error); ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(cell_t)); + + return (0); +} + +int +pci_host_generic_attach(device_t dev) +{ + struct generic_pcie_fdt_softc *sc; + int error; + + sc = device_get_softc(dev); + + error = pci_host_generic_setup_fdt(dev); + if (error != 0) + return (error); device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); Modified: head/sys/dev/pci/pci_host_generic_fdt.h ============================================================================== --- head/sys/dev/pci/pci_host_generic_fdt.h Mon Jul 6 08:50:11 2020 (r362953) +++ head/sys/dev/pci/pci_host_generic_fdt.h Mon Jul 6 08:51:55 2020 (r362954) @@ -43,6 +43,7 @@ DECLARE_CLASS(generic_pcie_fdt_driver); struct resource *pci_host_generic_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); +int pci_host_generic_setup_fdt(device_t); int pci_host_generic_attach(device_t); int generic_pcie_get_id(device_t, device_t, enum pci_id_type, uintptr_t *); From owner-svn-src-all@freebsd.org Mon Jul 6 09:04:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC004360BA0; Mon, 6 Jul 2020 09:04:07 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0fkv57D7z3Vvv; Mon, 6 Jul 2020 09:04:07 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 935DC1B9D8; Mon, 6 Jul 2020 09:04:07 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066947tN009769; Mon, 6 Jul 2020 09:04:07 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066947lm009767; Mon, 6 Jul 2020 09:04:07 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202007060904.066947lm009767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 6 Jul 2020 09:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362955 - in stable/12: crypto/heimdal/lib/krb5 lib/libcasper/libcasper X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: in stable/12: crypto/heimdal/lib/krb5 lib/libcasper/libcasper X-SVN-Commit-Revision: 362955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 09:04:07 -0000 Author: 0mp (doc,ports committer) Date: Mon Jul 6 09:04:06 2020 New Revision: 362955 URL: https://svnweb.freebsd.org/changeset/base/362955 Log: MFC 362676: Fix trailing-comma-related typos in the tree when the Xr macro is used Modified: stable/12/crypto/heimdal/lib/krb5/krb5.conf.5 stable/12/lib/libcasper/libcasper/libcasper_service.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/crypto/heimdal/lib/krb5/krb5.conf.5 ============================================================================== --- stable/12/crypto/heimdal/lib/krb5/krb5.conf.5 Mon Jul 6 08:51:55 2020 (r362954) +++ stable/12/crypto/heimdal/lib/krb5/krb5.conf.5 Mon Jul 6 09:04:06 2020 (r362955) @@ -257,7 +257,7 @@ Setting this flag to make it store the MIT way, this is default for Heimdal 0.7. .It Li check-rd-req-server If set to "ignore", the framework will ignore any the server input to -.Xr krb5_rd_req 3, +.Xr krb5_rd_req 3 , this is very useful when the GSS-API server input the wrong server name into the gss_accept_sec_context call. .El Modified: stable/12/lib/libcasper/libcasper/libcasper_service.3 ============================================================================== --- stable/12/lib/libcasper/libcasper/libcasper_service.3 Mon Jul 6 08:51:55 2020 (r362954) +++ stable/12/lib/libcasper/libcasper/libcasper_service.3 Mon Jul 6 09:04:06 2020 (r362955) @@ -51,7 +51,7 @@ macro to create a new Casper service. The .Fa name is a string containing the service name, which will be used in the -.Xr cap_service_open 3, +.Xr cap_service_open 3 , function to identify it. .Pp The From owner-svn-src-all@freebsd.org Mon Jul 6 09:53:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC765362398; Mon, 6 Jul 2020 09:53:00 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0gqJ4CFdz3Ypf; Mon, 6 Jul 2020 09:53:00 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 737F81C817; Mon, 6 Jul 2020 09:53:00 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0669r0m3040922; Mon, 6 Jul 2020 09:53:00 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0669r04g040921; Mon, 6 Jul 2020 09:53:00 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202007060953.0669r04g040921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 6 Jul 2020 09:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362956 - head/lib/libcam X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/lib/libcam X-SVN-Commit-Revision: 362956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 09:53:00 -0000 Author: 0mp (doc,ports committer) Date: Mon Jul 6 09:53:00 2020 New Revision: 362956 URL: https://svnweb.freebsd.org/changeset/base/362956 Log: Clean up cam.3 - Add a missing Pp [1] - Remove uses of Tn - Use "Xr open 2" when appropriate PR: 247783 [1] Submitted by: PauAmma [1] MFC after: 3 days Modified: head/lib/libcam/cam.3 Modified: head/lib/libcam/cam.3 ============================================================================== --- head/lib/libcam/cam.3 Mon Jul 6 09:04:06 2020 (r362955) +++ head/lib/libcam/cam.3 Mon Jul 6 09:53:00 2020 (r362956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 11, 2017 +.Dd July 6, 2020 .Dt CAM 3 .Os .Sh NAME @@ -218,15 +218,12 @@ structure using .Fn cam_open_btl is similar to .Fn cam_open_spec_device , -except that it takes a -.Tn SCSI -bus, target and logical unit instead of a device name and unit number as +except that it takes a SCSI bus, +target and logical unit instead of a device name and unit number as arguments. The .Va path_id -argument is the CAM equivalent of a -.Tn SCSI -bus number. +argument is the CAM equivalent of a SCSI bus number. It represents the logical bus number in the system. The .Ar flags @@ -263,10 +260,13 @@ should be if the user wants the CAM library to allocate space for the .Va cam_device structure. +.Pp .Fn cam_close_device frees the .Va cam_device -structure allocated by one of the above open() calls, and closes the file +structure allocated by one of the above +.Xr open 2 +calls, and closes the file descriptor to the passthrough device. This routine should not be called if the user allocated space for the @@ -276,7 +276,9 @@ Instead, the user should call .Fn cam_close_spec_device . .Pp .Fn cam_close_spec_device -merely closes the file descriptor opened in one of the open() routines +merely closes the file descriptor opened in one of the +.Xr open 2 +routines described above. This function should be called when the .Va cam_device From owner-svn-src-all@freebsd.org Mon Jul 6 10:05:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34B4C362B3B; Mon, 6 Jul 2020 10:05:36 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0h5r0X02z3Zfp; Mon, 6 Jul 2020 10:05:36 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E59C61C849; Mon, 6 Jul 2020 10:05:35 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066A5ZUO046928; Mon, 6 Jul 2020 10:05:35 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066A5Z5M046927; Mon, 6 Jul 2020 10:05:35 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202007061005.066A5Z5M046927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 6 Jul 2020 10:05:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362957 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 362957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 10:05:36 -0000 Author: 0mp (doc,ports committer) Date: Mon Jul 6 10:05:35 2020 New Revision: 362957 URL: https://svnweb.freebsd.org/changeset/base/362957 Log: Fix description of the "\$" sequence for PS1 The manual page documents "\$" to expand to either "$" or "#" followed by a single space. In reality, the single space character is not appended. PR: 247791 Submitted by: kd-dev@pm.me MFC after: 7 days Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Mon Jul 6 09:53:00 2020 (r362956) +++ head/bin/sh/sh.1 Mon Jul 6 10:05:35 2020 (r362957) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd February 24, 2019 +.Dd July 6, 2020 .Dt SH 1 .Os .Sh NAME @@ -1425,9 +1425,9 @@ The final component of the current working directory. The entire path of the current working directory. .It Li \e$ Superuser status. -.Dq Li "$ " +.Dq Li "$" for normal users and -.Dq Li "# " +.Dq Li "#" for superusers. .It Li \e\e A literal backslash. From owner-svn-src-all@freebsd.org Mon Jul 6 11:58:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42C2C364D43; Mon, 6 Jul 2020 11:58:00 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0kbW61R5z3gdk; Mon, 6 Jul 2020 11:57:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B31E31DC31; Mon, 6 Jul 2020 11:57:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066BvxLu014820; Mon, 6 Jul 2020 11:57:59 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066BvxTI014819; Mon, 6 Jul 2020 11:57:59 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202007061157.066BvxTI014819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 6 Jul 2020 11:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362958 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 362958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 11:58:00 -0000 Author: luporl Date: Mon Jul 6 11:57:59 2020 New Revision: 362958 URL: https://svnweb.freebsd.org/changeset/base/362958 Log: Handle non-PLT GNU IFUNC relocations in rtld In the last IFUNC related changes to rtld, the code that handled non-PLT GNU IFUNC relocations ended up getting lost. This could leave some relocations unhandled, causing crashes or misbehavior. This change restores the handling of these relocations, but now together with the other IFUNC relocations, allowing resolvers to reference external symbols. Reviewed by: kib MFC after: 2 weeks Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D25550 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Jul 6 10:05:35 2020 (r362957) +++ head/libexec/rtld-elf/rtld.c Mon Jul 6 11:57:59 2020 (r362958) @@ -3111,7 +3111,8 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in return (0); obj->ifuncs_resolved = true; if (!obj->irelative && !obj->irelative_nonplt && - !((obj->bind_now || bind_now) && obj->gnu_ifunc)) + !((obj->bind_now || bind_now) && obj->gnu_ifunc) && + !obj->non_plt_gnu_ifunc) return (0); if (obj_disable_relro(obj) == -1 || (obj->irelative && reloc_iresolve(obj, lockstate) == -1) || @@ -3119,6 +3120,8 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in lockstate) == -1) || ((obj->bind_now || bind_now) && obj->gnu_ifunc && reloc_gnu_ifunc(obj, flags, lockstate) == -1) || + (obj->non_plt_gnu_ifunc && reloc_non_plt(obj, &obj_rtld, + flags | SYMLOOK_IFUNC, lockstate) == -1) || obj_enforce_relro(obj) == -1) return (-1); return (0); From owner-svn-src-all@freebsd.org Mon Jul 6 13:54:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFAB03686EF; Mon, 6 Jul 2020 13:54:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0n9k63dcz45Bp; Mon, 6 Jul 2020 13:54:18 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B30ED1F588; Mon, 6 Jul 2020 13:54:18 +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 066DsIqG088791; Mon, 6 Jul 2020 13:54:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066DsIv2088788; Mon, 6 Jul 2020 13:54:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061354.066DsIv2088788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 13:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362959 - in stable/12: share/man/man4 sys/dev/acpi_support X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/acpi_support X-SVN-Commit-Revision: 362959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 13:54:19 -0000 Author: markj Date: Mon Jul 6 13:54:18 2020 New Revision: 362959 URL: https://svnweb.freebsd.org/changeset/base/362959 Log: MFC r362496, r362592: acpi_ibm(4): Add support for putting fans in disengaged mode. PR: 247306 Modified: stable/12/share/man/man4/acpi_ibm.4 stable/12/sys/dev/acpi_support/acpi_ibm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/acpi_ibm.4 ============================================================================== --- stable/12/share/man/man4/acpi_ibm.4 Mon Jul 6 11:57:59 2020 (r362958) +++ stable/12/share/man/man4/acpi_ibm.4 Mon Jul 6 13:54:18 2020 (r362959) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2015 +.Dd June 24, 2020 .Dt ACPI_IBM 4 .Os .Sh NAME @@ -289,7 +289,12 @@ fan control might overheat the ThinkPad and lead to pe is not set accordingly. .It Va dev.acpi_ibm.0.fan_level Indicates at what speed the fan should run when being in manual mode. -Values are ranging from 0 (off) to 7 (max). +Valid values range from 0 (off) to 7 (max) and 8. +Level 8 is used by the driver to set the fan in unthrottled mode. +In this mode, the fan is set to spin freely and will quickly reach a very +high speed. +Use this mode only if absolutely necessary, e.g., if the system has reached its +critical temperature and it is about to shut down. The resulting speed differs from model to model. On a T41p this is as follows: .Pp @@ -302,6 +307,8 @@ off ~3600 RPM .It Li 6, 7 ~4300 RPM +.It Li 8 +~6400 RPM (Full-speed, unthrottled) .El .It Va dev.acpi_ibm.0.fan_speed (read-only) Modified: stable/12/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- stable/12/sys/dev/acpi_support/acpi_ibm.c Mon Jul 6 11:57:59 2020 (r362958) +++ stable/12/sys/dev/acpi_support/acpi_ibm.c Mon Jul 6 13:54:18 2020 (r362959) @@ -2,6 +2,7 @@ * Copyright (c) 2004 Takanori Watanabe * Copyright (c) 2005 Markus Brueffer * All rights reserved. + * Copyright (c) 2020 Ali Abdallah * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -105,7 +106,7 @@ ACPI_MODULE_NAME("IBM") #define IBM_EC_MASK_MUTE (1 << 6) #define IBM_EC_FANSTATUS 0x2F #define IBM_EC_MASK_FANLEVEL 0x3f -#define IBM_EC_MASK_FANDISENGAGED (1 << 6) +#define IBM_EC_MASK_FANUNTHROTTLED (1 << 6) #define IBM_EC_MASK_FANSTATUS (1 << 7) #define IBM_EC_FANSPEED 0x84 @@ -263,7 +264,8 @@ static struct { { .name = "fan_level", .method = ACPI_IBM_METHOD_FANLEVEL, - .description = "Fan level", + .description = "Fan level, 0-7 (recommended max), " + "8 (unthrottled, full-speed)", }, { .name = "fan", @@ -830,7 +832,10 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int met */ if (!sc->fan_handle) { ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, &val_ec, 1); - val = val_ec & IBM_EC_MASK_FANLEVEL; + if (val_ec & IBM_EC_MASK_FANUNTHROTTLED) + val = 8; + else + val = val_ec & IBM_EC_MASK_FANLEVEL; } break; @@ -914,15 +919,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int met break; case ACPI_IBM_METHOD_FANLEVEL: - if (arg < 0 || arg > 7) + if (arg < 0 || arg > 8) return (EINVAL); if (!sc->fan_handle) { - /* Read the current fanstatus */ + /* Read the current fan status. */ ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, &val_ec, 1); - val = val_ec & (~IBM_EC_MASK_FANLEVEL); + val = val_ec & ~(IBM_EC_MASK_FANLEVEL | + IBM_EC_MASK_FANUNTHROTTLED); - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val | arg, 1); + if (arg == 8) + /* Full speed, set the unthrottled bit. */ + val |= 7 | IBM_EC_MASK_FANUNTHROTTLED; + else + val |= arg; + + return (ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val, + 1)); } break; From owner-svn-src-all@freebsd.org Mon Jul 6 13:54:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 298B13689C6; Mon, 6 Jul 2020 13:54:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0nBF0CHdz45GY; Mon, 6 Jul 2020 13:54:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF1581F554; Mon, 6 Jul 2020 13:54: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 066Dsi5B088919; Mon, 6 Jul 2020 13:54:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066Dsicq088917; Mon, 6 Jul 2020 13:54:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061354.066Dsicq088917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 13:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362960 - in stable/12/sys: compat/linuxkpi/common/src dev/md X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/src dev/md X-SVN-Commit-Revision: 362960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 13:54:45 -0000 Author: markj Date: Mon Jul 6 13:54:44 2020 New Revision: 362960 URL: https://svnweb.freebsd.org/changeset/base/362960 Log: MFC r362739: Remove some redundant assignments and computations. Modified: stable/12/sys/compat/linuxkpi/common/src/linux_page.c stable/12/sys/dev/md/md.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_page.c Mon Jul 6 13:54:18 2020 (r362959) +++ stable/12/sys/compat/linuxkpi/common/src/linux_page.c Mon Jul 6 13:54:44 2020 (r362960) @@ -201,7 +201,7 @@ linux_get_user_pages_internal(vm_map_t map, unsigned l int i; prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; - len = ((size_t)nr_pages) << PAGE_SHIFT; + len = ptoa((vm_offset_t)nr_pages); count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages); if (count == -1) return (-EFAULT); @@ -232,9 +232,8 @@ __get_user_pages_fast(unsigned long start, int nr_page return (0); MPASS(pages != NULL); - va = start; map = &curthread->td_proc->p_vmspace->vm_map; - end = start + (((size_t)nr_pages) << PAGE_SHIFT); + end = start + ptoa((vm_offset_t)nr_pages); if (!vm_map_range_valid(map, start, end)) return (-EINVAL); prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; Modified: stable/12/sys/dev/md/md.c ============================================================================== --- stable/12/sys/dev/md/md.c Mon Jul 6 13:54:18 2020 (r362959) +++ stable/12/sys/dev/md/md.c Mon Jul 6 13:54:44 2020 (r362960) @@ -1562,8 +1562,8 @@ mdresize(struct md_s *sc, struct md_req *mdr) if (mdr->md_mediasize <= 0 || (mdr->md_mediasize % PAGE_SIZE) != 0) return (EDOM); - oldpages = OFF_TO_IDX(round_page(sc->mediasize)); - newpages = OFF_TO_IDX(round_page(mdr->md_mediasize)); + oldpages = OFF_TO_IDX(sc->mediasize); + newpages = OFF_TO_IDX(mdr->md_mediasize); if (newpages < oldpages) { VM_OBJECT_WLOCK(sc->object); vm_object_page_remove(sc->object, newpages, 0, 0); From owner-svn-src-all@freebsd.org Mon Jul 6 14:00:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 332213689E2; Mon, 6 Jul 2020 14:00:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0nJm0wF6z45YY; Mon, 6 Jul 2020 14:00:24 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02AF01F58D; Mon, 6 Jul 2020 14:00:24 +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 066E0N6a089388; Mon, 6 Jul 2020 14:00:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066E0L9A089374; Mon, 6 Jul 2020 14:00:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061400.066E0L9A089374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 14:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362961 - in stable/12: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf X-SVN-Commit-Revision: 362961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 14:00:24 -0000 Author: markj Date: Mon Jul 6 14:00:20 2020 New Revision: 362961 URL: https://svnweb.freebsd.org/changeset/base/362961 Log: MFC r362338: Add the SCTP_SUPPORT kernel option. Modified: stable/12/share/man/man4/sctp.4 stable/12/sys/conf/NOTES stable/12/sys/conf/options stable/12/sys/kern/uipc_socket.c stable/12/sys/netinet/in_proto.c stable/12/sys/netinet/ip_divert.c stable/12/sys/netinet/ip_output.c stable/12/sys/netinet/sctp_crc32.c stable/12/sys/netinet/sctp_crc32.h stable/12/sys/netinet6/in6_proto.c stable/12/sys/netinet6/ip6_forward.c stable/12/sys/netinet6/ip6_output.c stable/12/sys/netipsec/ipsec_output.c stable/12/sys/netpfil/pf/pf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/sctp.4 ============================================================================== --- stable/12/share/man/man4/sctp.4 Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/share/man/man4/sctp.4 Mon Jul 6 14:00:20 2020 (r362961) @@ -26,13 +26,16 @@ .\" .\" $FreeBSD$ .\" -.Dd January 4, 2020 +.Dd June 18, 2020 .Dt SCTP 4 .Os .Sh NAME .Nm sctp .Nd Internet Stream Control Transmission Protocol .Sh SYNOPSIS +.Cd "options SCTP" +.Cd "options SCTP_SUPPORT" +.Pp .In sys/types.h .In sys/socket.h .In netinet/sctp.h Modified: stable/12/sys/conf/NOTES ============================================================================== --- stable/12/sys/conf/NOTES Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/conf/NOTES Mon Jul 6 14:00:20 2020 (r362961) @@ -692,7 +692,12 @@ options LIBALIAS # the V6 and V4.. since an association can span # both a V6 and V4 address at the SAME time :-) # +# The SCTP_SUPPORT option does not enable SCTP, but provides the necessary +# support for loading SCTP as a loadable kernel module. +# options SCTP +options SCTP_SUPPORT + # There are bunches of options: # this one turns on all sorts of # nastily printing that you can @@ -705,6 +710,7 @@ options SCTP # bits and prints.. which makes the code run # faster.. if you are not debugging don't use. options SCTP_DEBUG + # # All that options after that turn on specific types of # logging. You can monitor CWND growth, flight size @@ -727,7 +733,6 @@ options SCTP_MBCNT_LOGGING options SCTP_PACKET_LOGGING options SCTP_LTRACE_CHUNKS options SCTP_LTRACE_ERRORS - # altq(9). Enable the base part of the hooks with the ALTQ option. # Individual disciplines must be built into the base system and can not be Modified: stable/12/sys/conf/options ============================================================================== --- stable/12/sys/conf/options Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/conf/options Mon Jul 6 14:00:20 2020 (r362961) @@ -478,6 +478,7 @@ XBONEHACK # SCTP # SCTP opt_sctp.h +SCTP_SUPPORT opt_sctp.h SCTP_DEBUG opt_sctp.h # Enable debug printfs SCTP_LOCK_LOGGING opt_sctp.h # Log to KTR lock activity SCTP_MBUF_LOGGING opt_sctp.h # Log to KTR general mbuf aloc/free Modified: stable/12/sys/kern/uipc_socket.c ============================================================================== --- stable/12/sys/kern/uipc_socket.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/kern/uipc_socket.c Mon Jul 6 14:00:20 2020 (r362961) @@ -689,7 +689,7 @@ sonewconn(struct socket *head, int connstatus) return (so); } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) /* * Socket part of sctp_peeloff(). Detach a new socket from an * association. The new socket is returned with a reference. Modified: stable/12/sys/netinet/in_proto.c ============================================================================== --- stable/12/sys/netinet/in_proto.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet/in_proto.c Mon Jul 6 14:00:20 2020 (r362961) @@ -97,7 +97,7 @@ static struct pr_usrreqs nousrreqs; #include #include #include -#endif /* SCTP */ +#endif FEATURE(inet, "Internet Protocol version 4"); @@ -327,7 +327,7 @@ SYSCTL_NODE(_net_inet, IPPROTO_IP, ip, CTLFLAG_RW, 0, SYSCTL_NODE(_net_inet, IPPROTO_ICMP, icmp, CTLFLAG_RW, 0, "ICMP"); SYSCTL_NODE(_net_inet, IPPROTO_UDP, udp, CTLFLAG_RW, 0, "UDP"); SYSCTL_NODE(_net_inet, IPPROTO_TCP, tcp, CTLFLAG_RW, 0, "TCP"); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) SYSCTL_NODE(_net_inet, IPPROTO_SCTP, sctp, CTLFLAG_RW, 0, "SCTP"); #endif SYSCTL_NODE(_net_inet, IPPROTO_IGMP, igmp, CTLFLAG_RW, 0, "IGMP"); Modified: stable/12/sys/netinet/ip_divert.c ============================================================================== --- stable/12/sys/netinet/ip_divert.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet/ip_divert.c Mon Jul 6 14:00:20 2020 (r362961) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #endif @@ -210,7 +210,7 @@ divert_packet(struct mbuf *m, int incoming) in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; Modified: stable/12/sys/netinet/ip_output.c ============================================================================== --- stable/12/sys/netinet/ip_output.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet/ip_output.c Mon Jul 6 14:00:20 2020 (r362961) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #include #endif @@ -143,7 +143,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, st } m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | CSUM_IP_VALID; -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif @@ -174,7 +174,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, st CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif @@ -603,7 +603,7 @@ sendit: in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) { sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; @@ -786,7 +786,7 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int m in_delayed_cksum(m0); m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m0->m_pkthdr.csum_flags & CSUM_SCTP) { sctp_delayed_cksum(m0, hlen); m0->m_pkthdr.csum_flags &= ~CSUM_SCTP; Modified: stable/12/sys/netinet/sctp_crc32.c ============================================================================== --- stable/12/sys/netinet/sctp_crc32.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet/sctp_crc32.c Mon Jul 6 14:00:20 2020 (r362961) @@ -37,17 +37,16 @@ __FBSDID("$FreeBSD$"); #include "opt_sctp.h" -#ifdef SCTP -#include -#include -#include -#include -#else #include #include #include +#include #include +#ifdef SCTP +#include +#include +#include #endif static uint32_t @@ -116,7 +115,7 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) return (base); } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) /* * Compute and insert the SCTP checksum in network byte order for a given * mbuf chain m which contains an SCTP packet starting at offset. @@ -127,8 +126,10 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) uint32_t checksum; checksum = sctp_calculate_cksum(m, offset); +#ifdef SCTP SCTP_STAT_DECR(sctps_sendhwcrc); SCTP_STAT_INCR(sctps_sendswcrc); +#endif offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) { Modified: stable/12/sys/netinet/sctp_crc32.h ============================================================================== --- stable/12/sys/netinet/sctp_crc32.h Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet/sctp_crc32.h Mon Jul 6 14:00:20 2020 (r362961) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) void sctp_delayed_cksum(struct mbuf *, uint32_t offset); #endif #endif /* _KERNEL */ Modified: stable/12/sys/netinet6/in6_proto.c ============================================================================== --- stable/12/sys/netinet6/in6_proto.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet6/in6_proto.c Mon Jul 6 14:00:20 2020 (r362961) @@ -432,7 +432,7 @@ SYSCTL_NODE(_net_inet6, IPPROTO_IPV6, ip6, CTLFLAG_RW, SYSCTL_NODE(_net_inet6, IPPROTO_ICMPV6, icmp6, CTLFLAG_RW, 0, "ICMP6"); SYSCTL_NODE(_net_inet6, IPPROTO_UDP, udp6, CTLFLAG_RW, 0, "UDP6"); SYSCTL_NODE(_net_inet6, IPPROTO_TCP, tcp6, CTLFLAG_RW, 0, "TCP6"); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) SYSCTL_NODE(_net_inet6, IPPROTO_SCTP, sctp6, CTLFLAG_RW, 0, "SCTP6"); #endif #if defined(IPSEC) || defined(IPSEC_SUPPORT) Modified: stable/12/sys/netinet6/ip6_forward.c ============================================================================== --- stable/12/sys/netinet6/ip6_forward.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet6/ip6_forward.c Mon Jul 6 14:00:20 2020 (r362961) @@ -353,7 +353,7 @@ again2: CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif Modified: stable/12/sys/netinet6/ip6_output.c ============================================================================== --- stable/12/sys/netinet6/ip6_output.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netinet6/ip6_output.c Mon Jul 6 14:00:20 2020 (r362961) @@ -111,7 +111,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #include #endif @@ -218,7 +218,7 @@ ip6_output_delayed_csum(struct mbuf *m, struct ifnet * __func__, __LINE__, plen, optlen, m, ifp, csum_flags, frag)); if ((csum_flags & CSUM_DELAY_DATA_IPV6) || -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) (csum_flags & CSUM_SCTP_IPV6) || #endif false) { @@ -227,7 +227,7 @@ ip6_output_delayed_csum(struct mbuf *m, struct ifnet * sizeof(struct ip6_hdr) + optlen); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (csum_flags & CSUM_SCTP_IPV6) { sctp_delayed_cksum(m, sizeof(struct ip6_hdr) + optlen); m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; @@ -868,7 +868,7 @@ again: CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif @@ -898,7 +898,7 @@ again: CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif Modified: stable/12/sys/netipsec/ipsec_output.c ============================================================================== --- stable/12/sys/netipsec/ipsec_output.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netipsec/ipsec_output.c Mon Jul 6 14:00:20 2020 (r362961) @@ -71,7 +71,7 @@ #ifdef INET6 #include #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #endif @@ -326,7 +326,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { struct ip *ip = mtod(m, struct ip *); @@ -621,7 +621,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; Modified: stable/12/sys/netpfil/pf/pf.c ============================================================================== --- stable/12/sys/netpfil/pf/pf.c Mon Jul 6 13:54:44 2020 (r362960) +++ stable/12/sys/netpfil/pf/pf.c Mon Jul 6 14:00:20 2020 (r362961) @@ -40,9 +40,9 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_bpf.h" #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_bpf.h" #include "opt_pf.h" #include "opt_sctp.h" @@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #endif @@ -5592,7 +5592,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, in_delayed_cksum(m0); m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m0->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) { sctp_delayed_cksum(m0, (uint32_t)(ip->ip_hl << 2)); m0->m_pkthdr.csum_flags &= ~CSUM_SCTP; From owner-svn-src-all@freebsd.org Mon Jul 6 14:52:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95245369DA5; Mon, 6 Jul 2020 14:52:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0pSV3QGlz48sh; Mon, 6 Jul 2020 14:52:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 599871FDB0; Mon, 6 Jul 2020 14:52:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066EqAC7025537; Mon, 6 Jul 2020 14:52:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066EqAap025536; Mon, 6 Jul 2020 14:52:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061452.066EqAap025536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 14:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362962 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 362962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 14:52:10 -0000 Author: markj Date: Mon Jul 6 14:52:09 2020 New Revision: 362962 URL: https://svnweb.freebsd.org/changeset/base/362962 Log: iflib: Fix handling of mbuf cluster allocation failures. When refilling an rx freelist, make sure we only update the hardware producer index if at least one cluster was allocated. Otherwise the NIC is programmed to write a previously used cluster, typically resulting in a use-after-free when packet data is written by the hardware. Also make sure that we don't update the fragment index cursor if the last allocation attempt didn't succeed. For at least Intel drivers, iflib assumes that the consumer index and fragment index cursor stay in lockstep, but this assumption was violated in the face of cluster allocation failures. Reported and tested by: pho Reviewed by: gallatin, hselasky MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25489 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Mon Jul 6 14:00:20 2020 (r362961) +++ head/sys/net/iflib.c Mon Jul 6 14:52:09 2020 (r362962) @@ -1975,7 +1975,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); MPASS(frag_idx >= 0); if ((cl = sd_cl[frag_idx]) == NULL) { - if ((cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) + cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size); + if (__predict_false(cl == NULL)) break; cb_arg.error = 0; @@ -1983,12 +1984,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun err = bus_dmamap_load(fl->ifl_buf_tag, sd_map[frag_idx], cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, BUS_DMA_NOWAIT); - if (err != 0 || cb_arg.error) { - /* - * !zone_pack ? - */ - if (fl->ifl_zone == zone_pack) - uma_zfree(fl->ifl_zone, cl); + if (__predict_false(err != 0 || cb_arg.error)) { + uma_zfree(fl->ifl_zone, cl); break; } @@ -2004,9 +2001,9 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun BUS_DMASYNC_PREREAD); if (sd_m[frag_idx] == NULL) { - if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { + m = m_gethdr(M_NOWAIT, MT_NOINIT); + if (__predict_false(m == NULL)) break; - } sd_m[frag_idx] = m; } bit_set(fl->ifl_rx_bitmap, frag_idx); @@ -2036,25 +2033,32 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun } } - if (i) { - iru.iru_pidx = pidx; - iru.iru_count = i; - ctx->isc_rxd_refill(ctx->ifc_softc, &iru); - fl->ifl_pidx = idx; - fl->ifl_credits = credits; - } - DBG_COUNTER_INC(rxd_flush); - if (fl->ifl_pidx == 0) - pidx = fl->ifl_size - 1; - else - pidx = fl->ifl_pidx - 1; + if (n < count - 1) { + if (i != 0) { + iru.iru_pidx = pidx; + iru.iru_count = i; + ctx->isc_rxd_refill(ctx->ifc_softc, &iru); + fl->ifl_pidx = idx; + fl->ifl_credits = credits; + } + DBG_COUNTER_INC(rxd_flush); + if (fl->ifl_pidx == 0) + pidx = fl->ifl_size - 1; + else + pidx = fl->ifl_pidx - 1; - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx); - fl->ifl_fragidx = frag_idx + 1; - if (fl->ifl_fragidx == fl->ifl_size) - fl->ifl_fragidx = 0; + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, + fl->ifl_id, pidx); + if (__predict_true(bit_test(fl->ifl_rx_bitmap, frag_idx))) { + fl->ifl_fragidx = frag_idx + 1; + if (fl->ifl_fragidx == fl->ifl_size) + fl->ifl_fragidx = 0; + } else { + fl->ifl_fragidx = frag_idx; + } + } return (n == -1 ? 0 : IFLIB_RXEOF_EMPTY); } From owner-svn-src-all@freebsd.org Mon Jul 6 14:52:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3601369DAB; Mon, 6 Jul 2020 14:52:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0pSk5sstz492F; Mon, 6 Jul 2020 14:52:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FB6E1FD2B; Mon, 6 Jul 2020 14:52:22 +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 066EqMES025589; Mon, 6 Jul 2020 14:52:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066EqMhb025587; Mon, 6 Jul 2020 14:52:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061452.066EqMhb025587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 14:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362963 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 362963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 14:52:23 -0000 Author: markj Date: Mon Jul 6 14:52:21 2020 New Revision: 362963 URL: https://svnweb.freebsd.org/changeset/base/362963 Log: iflib: Fix some nits in the rx refill code. - Get rid of the ifl_vm_addrs array. It is not used by any existing consumer, so we are just dirtying a couple of cache lines for no reason. - Use uma_zalloc(fl->ifl_zone) instead of m_cljget(). Otherwise m_cljget() is doing unnecessary work to look up the correct zone, when iflib already knows what that zone is. - ifl_gen is only used when INVARIANTS is on, so make that more clear. - Fix some style nits and inconsistencies. Reviewed by: gallatin Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25490 Modified: head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Mon Jul 6 14:52:09 2020 (r362962) +++ head/sys/net/iflib.c Mon Jul 6 14:52:21 2020 (r362963) @@ -206,8 +206,6 @@ struct iflib_ctx { #define isc_rxd_pkt_get ifc_txrx.ift_rxd_pkt_get #define isc_rxd_refill ifc_txrx.ift_rxd_refill #define isc_rxd_flush ifc_txrx.ift_rxd_flush -#define isc_rxd_refill ifc_txrx.ift_rxd_refill -#define isc_rxd_refill ifc_txrx.ift_rxd_refill #define isc_legacy_intr ifc_txrx.ift_legacy_intr eventhandler_tag ifc_vlan_attach_event; eventhandler_tag ifc_vlan_detach_event; @@ -392,8 +390,7 @@ struct iflib_fl { bus_dma_tag_t ifl_buf_tag; iflib_dma_info_t ifl_ifdi; uint64_t ifl_bus_addrs[IFLIB_MAX_RX_REFRESH] __aligned(CACHE_LINE_SIZE); - caddr_t ifl_vm_addrs[IFLIB_MAX_RX_REFRESH]; - qidx_t ifl_rxd_idxs[IFLIB_MAX_RX_REFRESH]; + qidx_t ifl_rxd_idxs[IFLIB_MAX_RX_REFRESH]; } __aligned(CACHE_LINE_SIZE); static inline qidx_t @@ -854,7 +851,6 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ return netmap_ring_reinit(kring); - fl->ifl_vm_addrs[tmp_pidx] = addr; if (__predict_false(init)) { netmap_load_map(na, fl->ifl_buf_tag, map[nic_i], addr); @@ -1295,7 +1291,6 @@ iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t fl = &rxq->ifr_fl[flid]; iru->iru_paddrs = fl->ifl_bus_addrs; - iru->iru_vaddrs = &fl->ifl_vm_addrs[0]; iru->iru_idxs = fl->ifl_rxd_idxs; iru->iru_qsidx = rxq->ifr_id; iru->iru_buf_size = fl->ifl_buf_size; @@ -1916,7 +1911,7 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int } /** - * _iflib_fl_refill - refill an rxq free-buffer list + * iflib_fl_refill - refill an rxq free-buffer list * @ctx: the iflib context * @fl: the free list to refill * @count: the number of new buffers to allocate @@ -1925,7 +1920,7 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int * The caller must assure that @count does not exceed the queue's capacity. */ static uint8_t -_iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) +iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) { struct if_rxd_update iru; struct rxq_refill_cb_arg cb_arg; @@ -1962,12 +1957,13 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun if (n > 8) DBG_COUNTER_INC(fl_refills_large); iru_init(&iru, fl->ifl_rxq, fl->ifl_id); - while (n--) { + while (n-- > 0) { /* * We allocate an uninitialized mbuf + cluster, mbuf is * initialized after rx. * - * If the cluster is still set then we know a minimum sized packet was received + * If the cluster is still set then we know a minimum sized + * packet was received */ bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, &frag_idx); @@ -1975,7 +1971,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); MPASS(frag_idx >= 0); if ((cl = sd_cl[frag_idx]) == NULL) { - cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size); + cl = uma_zalloc(fl->ifl_zone, M_NOWAIT); if (__predict_false(cl == NULL)) break; @@ -1989,7 +1985,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun break; } - sd_ba[frag_idx] = bus_addr = cb_arg.seg.ds_addr; + sd_ba[frag_idx] = bus_addr = cb_arg.seg.ds_addr; sd_cl[frag_idx] = cl; #if MEMORY_LOGGING fl->ifl_cl_enqueued++; @@ -2014,22 +2010,23 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun DBG_COUNTER_INC(rx_allocs); fl->ifl_rxd_idxs[i] = frag_idx; fl->ifl_bus_addrs[i] = bus_addr; - fl->ifl_vm_addrs[i] = cl; credits++; i++; MPASS(credits <= fl->ifl_size); if (++idx == fl->ifl_size) { +#ifdef INVARIANTS fl->ifl_gen = 1; +#endif idx = 0; } if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { iru.iru_pidx = pidx; iru.iru_count = i; ctx->isc_rxd_refill(ctx->ifc_softc, &iru); - i = 0; - pidx = idx; fl->ifl_pidx = idx; fl->ifl_credits = credits; + pidx = idx; + i = 0; } } @@ -2063,8 +2060,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun return (n == -1 ? 0 : IFLIB_RXEOF_EMPTY); } -static __inline uint8_t -__iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) +static inline uint8_t +iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) { /* we avoid allowing pidx to catch up with cidx as it confuses ixl */ int32_t reclaimable = fl->ifl_size - fl->ifl_credits - 1; @@ -2076,7 +2073,7 @@ __iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) MPASS(reclaimable == delta); if (reclaimable > 0) - return (_iflib_fl_refill(ctx, fl, reclaimable)); + return (iflib_fl_refill(ctx, fl, reclaimable)); return (0); } @@ -2107,22 +2104,20 @@ iflib_fl_bufs_free(iflib_fl_t fl) bus_dmamap_sync(fl->ifl_buf_tag, sd_map, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(fl->ifl_buf_tag, sd_map); - if (*sd_cl != NULL) - uma_zfree(fl->ifl_zone, *sd_cl); + uma_zfree(fl->ifl_zone, *sd_cl); + *sd_cl = NULL; if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); uma_zfree(zone_mbuf, *sd_m); + *sd_m = NULL; } } else { - MPASS(*sd_cl == NULL); MPASS(*sd_m == NULL); } #if MEMORY_LOGGING fl->ifl_m_dequeued++; fl->ifl_cl_dequeued++; #endif - *sd_cl = NULL; - *sd_m = NULL; } #ifdef INVARIANTS for (i = 0; i < fl->ifl_size; i++) { @@ -2176,7 +2171,7 @@ iflib_fl_setup(iflib_fl_t fl) /* avoid pre-allocating zillions of clusters to an idle card * potentially speeding up attach */ - (void) _iflib_fl_refill(ctx, fl, min(128, fl->ifl_size)); + (void)iflib_fl_refill(ctx, fl, min(128, fl->ifl_size)); MPASS(min(128, fl->ifl_size) == fl->ifl_credits); if (min(128, fl->ifl_size) != fl->ifl_credits) return (ENOBUFS); @@ -2791,7 +2786,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) cidxp = &rxq->ifr_fl[0].ifl_cidx; if ((avail = iflib_rxd_avail(ctx, rxq, *cidxp, budget)) == 0) { for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_all(ctx, fl); + retval |= iflib_fl_refill_all(ctx, fl); DBG_COUNTER_INC(rx_unavail); return (retval); } @@ -2851,7 +2846,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) CURVNET_RESTORE(); /* make sure that we can refill faster than drain */ for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_all(ctx, fl); + retval |= iflib_fl_refill_all(ctx, fl); lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO); if (lro_enabled) Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Mon Jul 6 14:52:09 2020 (r362962) +++ head/sys/net/iflib.h Mon Jul 6 14:52:21 2020 (r362963) @@ -95,7 +95,6 @@ typedef struct if_rxd_info { typedef struct if_rxd_update { uint64_t *iru_paddrs; - caddr_t *iru_vaddrs; qidx_t *iru_idxs; qidx_t iru_pidx; uint16_t iru_qsidx; From owner-svn-src-all@freebsd.org Mon Jul 6 15:00:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CF0D36A115; Mon, 6 Jul 2020 15:00:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0pf536X1z49Sg; Mon, 6 Jul 2020 15:00:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F4751FE29; Mon, 6 Jul 2020 15:00:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066F0Ttb027051; Mon, 6 Jul 2020 15:00:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066F0Tjs027050; Mon, 6 Jul 2020 15:00:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202007061500.066F0Tjs027050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 6 Jul 2020 15:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362964 - stable/12/lib/libc/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/lib/libc/riscv X-SVN-Commit-Revision: 362964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 15:00:29 -0000 Author: mhorne Date: Mon Jul 6 15:00:28 2020 New Revision: 362964 URL: https://svnweb.freebsd.org/changeset/base/362964 Log: MFC r362788: Fix printf(3) output of long doubles on RISC-V PR: 242067 Modified: stable/12/lib/libc/riscv/_fpmath.h Modified: stable/12/lib/libc/riscv/_fpmath.h ============================================================================== --- stable/12/lib/libc/riscv/_fpmath.h Mon Jul 6 14:52:21 2020 (r362963) +++ stable/12/lib/libc/riscv/_fpmath.h Mon Jul 6 15:00:28 2020 (r362964) @@ -46,19 +46,6 @@ union IEEEl2bits { #define LDBL_IMPLICIT_NBIT #define mask_nbit_l(u) ((void)0) -#define LDBL_MANH_SIZE 20 -#define LDBL_MANL_SIZE 32 - -#define LDBL_TO_ARRAY32(u, a) do { \ - (a)[0] = (uint32_t)(u).bits.manl; \ - (a)[1] = (uint32_t)(u).bits.manh; \ -} while(0) - -/* - * TODO: Due to compiler problem we are temporary using - * LDBL_PREC == 53. Use code below for LDBL_PREC == 113 - */ -#if 0 #define LDBL_MANH_SIZE 48 #define LDBL_MANL_SIZE 64 @@ -68,4 +55,3 @@ union IEEEl2bits { (a)[2] = (uint32_t)(u).bits.manh; \ (a)[3] = (uint32_t)((u).bits.manh >> 32); \ } while(0) -#endif From owner-svn-src-all@freebsd.org Mon Jul 6 15:15:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A44036A498; Mon, 6 Jul 2020 15:15:38 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0pzZ1hKkz4B78; Mon, 6 Jul 2020 15:15:38 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1917820594; Mon, 6 Jul 2020 15:15:38 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066FFboZ038472; Mon, 6 Jul 2020 15:15:37 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066FFb8D038471; Mon, 6 Jul 2020 15:15:37 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202007061515.066FFb8D038471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Mon, 6 Jul 2020 15:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362965 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 362965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 15:15:38 -0000 Author: bdragon Date: Mon Jul 6 15:15:37 2020 New Revision: 362965 URL: https://svnweb.freebsd.org/changeset/base/362965 Log: [PowerPC] XIVE dispatch tweaks * Only read the DPCPU pointer once per xive_dispatch call. * Optimize HE decoding for the common cases. Reported by: jhibbits (in irc) Reviewed by: jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D25545 Modified: head/sys/powerpc/powernv/xive.c Modified: head/sys/powerpc/powernv/xive.c ============================================================================== --- head/sys/powerpc/powernv/xive.c Mon Jul 6 15:00:28 2020 (r362964) +++ head/sys/powerpc/powernv/xive.c Mon Jul 6 15:15:37 2020 (r362965) @@ -507,6 +507,7 @@ xive_dispatch(device_t dev, struct trapframe *tf) sc = device_get_softc(dev); + xive_cpud = DPCPU_PTR(xive_cpu_data); for (;;) { ack = xive_read_2(sc, XIVE_TM_SPC_ACK); cppr = (ack & 0xff); @@ -515,19 +516,17 @@ xive_dispatch(device_t dev, struct trapframe *tf) if (he == TM_QW3_NSR_HE_NONE) break; - switch (he) { - case TM_QW3_NSR_HE_NONE: - goto end; - case TM_QW3_NSR_HE_POOL: - case TM_QW3_NSR_HE_LSI: + + else if (__predict_false(he != TM_QW3_NSR_HE_PHYS)) { + /* + * We don't support TM_QW3_NSR_HE_POOL or + * TM_QW3_NSR_HE_LSI interrupts. + */ device_printf(dev, "Unexpected interrupt he type: %d\n", he); goto end; - case TM_QW3_NSR_HE_PHYS: - break; } - xive_cpud = DPCPU_PTR(xive_cpu_data); xive_write_1(sc, XIVE_TM_CPPR, cppr); for (;;) { From owner-svn-src-all@freebsd.org Mon Jul 6 16:33:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C306636BA8B; Mon, 6 Jul 2020 16:33:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0rjF4VWvz4GBb; Mon, 6 Jul 2020 16:33:21 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DA81212A7; Mon, 6 Jul 2020 16:33:21 +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 066GXLHp087145; Mon, 6 Jul 2020 16:33:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066GXLDd087144; Mon, 6 Jul 2020 16:33:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061633.066GXLDd087144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 16:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362966 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 16:33:21 -0000 Author: markj Date: Mon Jul 6 16:33:21 2020 New Revision: 362966 URL: https://svnweb.freebsd.org/changeset/base/362966 Log: Lift cpuset Capsicum checks into a subroutine. Otherwise the same checks are duplicated across four different system call implementations, cpuset_(get|set)(affinity|domain)(). No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Jul 6 15:15:37 2020 (r362965) +++ head/sys/kern/kern_cpuset.c Mon Jul 6 16:33:21 2020 (r362966) @@ -1582,6 +1582,25 @@ cpuset_setproc_update_set(struct proc *p, struct cpuse return (0); } +/* + * In Capability mode, the only accesses that are permitted are to the current + * thread and process' CPU and domain sets. + */ +static int +cpuset_check_capabilities(struct thread *td, cpulevel_t level, cpuwhich_t which, + id_t id) +{ + if (IN_CAPABILITY_MODE(td)) { + if (level != CPU_LEVEL_WHICH) + return (ECAPMODE); + if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) + return (ECAPMODE); + if (id != -1) + return (ECAPMODE); + } + return (0); +} + #ifndef _SYS_SYSPROTO_H_ struct cpuset_args { cpusetid_t *setid; @@ -1739,15 +1758,9 @@ kern_cpuset_getaffinity(struct thread *td, cpulevel_t if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); - /* In Capability mode, you can only get your own CPU set. */ - if (IN_CAPABILITY_MODE(td)) { - if (level != CPU_LEVEL_WHICH) - return (ECAPMODE); - if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) - return (ECAPMODE); - if (id != -1) - return (ECAPMODE); - } + error = cpuset_check_capabilities(td, level, which, id); + if (error != 0) + return (error); size = cpusetsize; mask = malloc(size, M_TEMP, M_WAITOK | M_ZERO); error = cpuset_which(which, id, &p, &ttd, &set); @@ -1856,15 +1869,9 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); - /* In Capability mode, you can only set your own CPU set. */ - if (IN_CAPABILITY_MODE(td)) { - if (level != CPU_LEVEL_WHICH) - return (ECAPMODE); - if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) - return (ECAPMODE); - if (id != -1) - return (ECAPMODE); - } + error = cpuset_check_capabilities(td, level, which, id); + if (error != 0) + return (error); mask = malloc(cpusetsize, M_TEMP, M_WAITOK | M_ZERO); error = copyin(maskp, mask, cpusetsize); if (error) @@ -1987,15 +1994,9 @@ kern_cpuset_getdomain(struct thread *td, cpulevel_t le if (domainsetsize < sizeof(domainset_t) || domainsetsize > DOMAINSET_MAXSIZE / NBBY) return (ERANGE); - /* In Capability mode, you can only get your own domain set. */ - if (IN_CAPABILITY_MODE(td)) { - if (level != CPU_LEVEL_WHICH) - return (ECAPMODE); - if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) - return (ECAPMODE); - if (id != -1) - return (ECAPMODE); - } + error = cpuset_check_capabilities(td, level, which, id); + if (error != 0) + return (error); mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO); bzero(&outset, sizeof(outset)); error = cpuset_which(which, id, &p, &ttd, &set); @@ -2122,15 +2123,9 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le if (policy <= DOMAINSET_POLICY_INVALID || policy > DOMAINSET_POLICY_MAX) return (EINVAL); - /* In Capability mode, you can only set your own CPU set. */ - if (IN_CAPABILITY_MODE(td)) { - if (level != CPU_LEVEL_WHICH) - return (ECAPMODE); - if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) - return (ECAPMODE); - if (id != -1) - return (ECAPMODE); - } + error = cpuset_check_capabilities(td, level, which, id); + if (error != 0) + return (error); memset(&domain, 0, sizeof(domain)); mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO); error = copyin(maskp, mask, domainsetsize); From owner-svn-src-all@freebsd.org Mon Jul 6 16:33:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 844B436BB03; Mon, 6 Jul 2020 16:33:32 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0rjR10QTz4G1n; Mon, 6 Jul 2020 16:33:30 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9B9C213AB; Mon, 6 Jul 2020 16:33:29 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066GXTC4087198; Mon, 6 Jul 2020 16:33:29 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066GXTY9087195; Mon, 6 Jul 2020 16:33:29 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202007061633.066GXTY9087195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Mon, 6 Jul 2020 16:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362967 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 362967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 16:33:32 -0000 Author: kaktus Date: Mon Jul 6 16:33:28 2020 New Revision: 362967 URL: https://svnweb.freebsd.org/changeset/base/362967 Log: kern.tty_info_kstacks: add a compact format Add a more compact display format for kern.tty_info_kstacks inspired by procstat -kk. Set it as a default one. # sysctl kern.tty_info_kstacks=1 kern.tty_info_kstacks: 0 -> 1 # sleep 2 ^T load: 0.17 cmd: sleep 623 [nanslp] 0.72r 0.00u 0.00s 0% 2124k #0 0xffffffff80c4443e at mi_switch+0xbe #1 0xffffffff80c98044 at sleepq_catch_signals+0x494 #2 0xffffffff80c982c2 at sleepq_timedwait_sig+0x12 #3 0xffffffff80c43af3 at _sleep+0x193 #4 0xffffffff80c50e31 at kern_clock_nanosleep+0x1a1 #5 0xffffffff80c5119b at sys_nanosleep+0x3b #6 0xffffffff810ffc69 at amd64_syscall+0x119 #7 0xffffffff810d5520 at fast_syscall_common+0x101 sleep: about 1 second(s) left out of the original 2 ^C # sysctl kern.tty_info_kstacks=2 kern.tty_info_kstacks: 1 -> 2 # sleep 2 ^T load: 0.24 cmd: sleep 625 [nanslp] 0.81r 0.00u 0.00s 0% 2124k mi_switch+0xbe sleepq_catch_signals+0x494 sleepq_timedwait_sig+0x12 sleep+0x193 kern_clock_nanosleep+0x1a1 sys_nanosleep+0x3b amd64_syscall+0x119 fast_syscall_common+0x101 sleep: about 1 second(s) left out of the original 2 ^C Suggested by: avg Reviewed by: mjg Relnotes: yes Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D25487 Modified: head/sys/kern/subr_stack.c head/sys/kern/tty_info.c head/sys/sys/stack.h Modified: head/sys/kern/subr_stack.c ============================================================================== --- head/sys/kern/subr_stack.c Mon Jul 6 16:33:21 2020 (r362966) +++ head/sys/kern/subr_stack.c Mon Jul 6 16:33:28 2020 (r362967) @@ -170,7 +170,8 @@ stack_print_short_ddb(const struct stack *st) * flags - M_WAITOK or M_NOWAIT (EWOULDBLOCK). */ int -stack_sbuf_print_flags(struct sbuf *sb, const struct stack *st, int flags) +stack_sbuf_print_flags(struct sbuf *sb, const struct stack *st, int flags, + enum stack_sbuf_fmt format) { char namebuf[64]; long offset; @@ -182,9 +183,19 @@ stack_sbuf_print_flags(struct sbuf *sb, const struct s &offset, flags); if (error == EWOULDBLOCK) return (error); - sbuf_printf(sb, "#%d %p at %s+%#lx\n", i, (void *)st->pcs[i], - namebuf, offset); + switch (format) { + case STACK_SBUF_FMT_LONG: + sbuf_printf(sb, "#%d %p at %s+%#lx\n", i, + (void *)st->pcs[i], namebuf, offset); + break; + case STACK_SBUF_FMT_COMPACT: + sbuf_printf(sb, "%s+%#lx ", namebuf, offset); + break; + default: + __assert_unreachable(); + } } + sbuf_nl_terminate(sb); return (0); } @@ -192,7 +203,7 @@ void stack_sbuf_print(struct sbuf *sb, const struct stack *st) { - (void)stack_sbuf_print_flags(sb, st, M_WAITOK); + (void)stack_sbuf_print_flags(sb, st, M_WAITOK, STACK_SBUF_FMT_LONG); } #if defined(DDB) || defined(WITNESS) Modified: head/sys/kern/tty_info.c ============================================================================== --- head/sys/kern/tty_info.c Mon Jul 6 16:33:21 2020 (r362966) +++ head/sys/kern/tty_info.c Mon Jul 6 16:33:28 2020 (r362967) @@ -239,10 +239,36 @@ sbuf_tty_drain(void *a, const char *d, int len) } #ifdef STACK -static bool tty_info_kstacks = true; -SYSCTL_BOOL(_kern, OID_AUTO, tty_info_kstacks, CTLFLAG_RWTUN, - &tty_info_kstacks, 0, - "Enable printing kernel stack(9) traces on ^T (tty info)"); +static int tty_info_kstacks = STACK_SBUF_FMT_LONG; + +static int +sysctl_tty_info_kstacks(SYSCTL_HANDLER_ARGS) +{ + enum stack_sbuf_fmt val; + int error; + + val = tty_info_kstacks; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + switch (val) { + case STACK_SBUF_FMT_NONE: + case STACK_SBUF_FMT_LONG: + case STACK_SBUF_FMT_COMPACT: + tty_info_kstacks = val; + break; + default: + error = EINVAL; + } + + return (error); +} +SYSCTL_PROC(_kern, OID_AUTO, tty_info_kstacks, + CTLFLAG_RWTUN | CTLFLAG_MPSAFE | CTLTYPE_INT, NULL, 0, + sysctl_tty_info_kstacks, "I", + "Adjust format of kernel stack(9) traces on ^T (tty info): " + "0 - disabled; 1 - long; 2 - compact"); #endif /* @@ -254,7 +280,8 @@ tty_info(struct tty *tp) struct timeval rtime, utime, stime; #ifdef STACK struct stack stack; - int sterr; + int sterr, kstacks_val; + bool print_kstacks; #endif struct proc *p, *ppick; struct thread *td, *tdpick; @@ -337,7 +364,10 @@ tty_info(struct tty *tp) state = "unknown"; pctcpu = (sched_pctcpu(td) * 10000 + FSCALE / 2) >> FSHIFT; #ifdef STACK - if (tty_info_kstacks) { + kstacks_val = atomic_load_int(&tty_info_kstacks); + print_kstacks = (kstacks_val != STACK_SBUF_FMT_NONE); + + if (print_kstacks) { if (TD_IS_SWAPPED(td)) sterr = ENOENT; else @@ -366,8 +396,8 @@ tty_info(struct tty *tp) pctcpu / 100, rss); #ifdef STACK - if (tty_info_kstacks && sterr == 0) - stack_sbuf_print_flags(&sb, &stack, M_NOWAIT); + if (print_kstacks && sterr == 0) + stack_sbuf_print_flags(&sb, &stack, M_NOWAIT, kstacks_val); #endif out: Modified: head/sys/sys/stack.h ============================================================================== --- head/sys/sys/stack.h Mon Jul 6 16:33:21 2020 (r362966) +++ head/sys/sys/stack.h Mon Jul 6 16:33:28 2020 (r362967) @@ -39,6 +39,12 @@ MALLOC_DECLARE(M_STACK); struct sbuf; +enum stack_sbuf_fmt { + STACK_SBUF_FMT_NONE = 0, + STACK_SBUF_FMT_LONG = 1, + STACK_SBUF_FMT_COMPACT = 2, +}; + /* MI Routines. */ struct stack *stack_create(int); void stack_destroy(struct stack *); @@ -52,7 +58,7 @@ void stack_print_short_ddb(const struct stack *); void stack_sbuf_print(struct sbuf *, const struct stack *); void stack_sbuf_print_ddb(struct sbuf *, const struct stack *); int stack_sbuf_print_flags(struct sbuf *, const struct stack *, - int); + int, enum stack_sbuf_fmt); #ifdef KTR void stack_ktr(u_int, const char *, int, const struct stack *, u_int); From owner-svn-src-all@freebsd.org Mon Jul 6 16:34:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C84236BB1A; Mon, 6 Jul 2020 16:34:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0rkB2z0Wz4G9T; Mon, 6 Jul 2020 16:34:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49A1921225; Mon, 6 Jul 2020 16:34:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066GYANO087275; Mon, 6 Jul 2020 16:34:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066GYAGq087274; Mon, 6 Jul 2020 16:34:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061634.066GYAGq087274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 16:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362968 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 16:34:10 -0000 Author: markj Date: Mon Jul 6 16:34:09 2020 New Revision: 362968 URL: https://svnweb.freebsd.org/changeset/base/362968 Log: Allow accesses of the caller's CPU and domain sets in capability mode. cpuset_(get|set)(affinity|domain)(2) permit a get or set of the calling thread or process' CPU and domain set in capability mode, but only when the thread or process ID is specified as -1. Extend this to cover the case where the ID actually matches the caller's TID or PID, since some code, such as our pthread_attr_get_np() implementation, always provides an explicit ID. It was not and still is not permitted to access CPU and domain sets for other threads in the same process when the process is in capability mode. This might change in the future. Submitted by: Greg V (original version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25552 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Jul 6 16:33:28 2020 (r362967) +++ head/sys/kern/kern_cpuset.c Mon Jul 6 16:34:09 2020 (r362968) @@ -1595,7 +1595,9 @@ cpuset_check_capabilities(struct thread *td, cpulevel_ return (ECAPMODE); if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) return (ECAPMODE); - if (id != -1) + if (id != -1 && + !(which == CPU_WHICH_TID && id == td->td_tid) && + !(which == CPU_WHICH_PID && id == td->td_proc->p_pid)) return (ECAPMODE); } return (0); From owner-svn-src-all@freebsd.org Mon Jul 6 16:34:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C46C36B855; Mon, 6 Jul 2020 16:34:18 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0rkL0VFbz4GRl; Mon, 6 Jul 2020 16:34:17 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E4B42148D; Mon, 6 Jul 2020 16:34:16 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066GYGNo087326; Mon, 6 Jul 2020 16:34:16 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066GYGOu087325; Mon, 6 Jul 2020 16:34:16 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202007061634.066GYGOu087325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Mon, 6 Jul 2020 16:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362969 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 16:34:18 -0000 Author: kaktus Date: Mon Jul 6 16:34:15 2020 New Revision: 362969 URL: https://svnweb.freebsd.org/changeset/base/362969 Log: kern.tty_info_kstacks: set compact format as default Modified: head/sys/kern/tty_info.c Modified: head/sys/kern/tty_info.c ============================================================================== --- head/sys/kern/tty_info.c Mon Jul 6 16:34:09 2020 (r362968) +++ head/sys/kern/tty_info.c Mon Jul 6 16:34:15 2020 (r362969) @@ -239,7 +239,7 @@ sbuf_tty_drain(void *a, const char *d, int len) } #ifdef STACK -static int tty_info_kstacks = STACK_SBUF_FMT_LONG; +static int tty_info_kstacks = STACK_SBUF_FMT_COMPACT; static int sysctl_tty_info_kstacks(SYSCTL_HANDLER_ARGS) From owner-svn-src-all@freebsd.org Mon Jul 6 16:34:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB2AD36B47C; Mon, 6 Jul 2020 16:34:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0rkY4dkkz4GVv; Mon, 6 Jul 2020 16:34: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83E30212AB; Mon, 6 Jul 2020 16:34:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066GYTPn087376; Mon, 6 Jul 2020 16:34:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066GYTvP087375; Mon, 6 Jul 2020 16:34:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061634.066GYTvP087375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 16:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362970 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362970 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 16:34:29 -0000 Author: markj Date: Mon Jul 6 16:34:29 2020 New Revision: 362970 URL: https://svnweb.freebsd.org/changeset/base/362970 Log: Permit cpuset_(get|set)domain() in capability mode. These system calls already perform validation of their parameters when called in capability mode, identical to cpuset_(get|set)affinity(). MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/capabilities.conf Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Mon Jul 6 16:34:15 2020 (r362969) +++ head/sys/kern/capabilities.conf Mon Jul 6 16:34:29 2020 (r362970) @@ -149,8 +149,10 @@ copy_file_range ## #cpuset cpuset_getaffinity +cpuset_getdomain #cpuset_getid cpuset_setaffinity +cpuset_setdomain #cpuset_setid ## From owner-svn-src-all@freebsd.org Mon Jul 6 16:34:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA51336BBB3; Mon, 6 Jul 2020 16:34:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0rky521Vz4Gl9; Mon, 6 Jul 2020 16:34:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90F98212AF; Mon, 6 Jul 2020 16:34:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066GYoSR087438; Mon, 6 Jul 2020 16:34:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066GYoNl087436; Mon, 6 Jul 2020 16:34:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061634.066GYoNl087436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 16:34:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362971 - in head/sys: compat/freebsd32 kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 362971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 16:34:50 -0000 Author: markj Date: Mon Jul 6 16:34:49 2020 New Revision: 362971 URL: https://svnweb.freebsd.org/changeset/base/362971 Log: Regenerate. Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/kern/init_sysent.c Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Mon Jul 6 16:34:29 2020 (r362970) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Mon Jul 6 16:34:49 2020 (r362971) @@ -650,8 +650,8 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_mknodat_args), (sy_call_t *)freebsd32_mknodat, AUE_MKNODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 559 = freebsd32_mknodat */ #endif { AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = freebsd32_kevent */ - { AS(freebsd32_cpuset_getdomain_args), (sy_call_t *)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = freebsd32_cpuset_getdomain */ - { AS(freebsd32_cpuset_setdomain_args), (sy_call_t *)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = freebsd32_cpuset_setdomain */ + { AS(freebsd32_cpuset_getdomain_args), (sy_call_t *)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 561 = freebsd32_cpuset_getdomain */ + { AS(freebsd32_cpuset_setdomain_args), (sy_call_t *)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 562 = freebsd32_cpuset_setdomain */ { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 563 = getrandom */ { AS(getfhat_args), (sy_call_t *)sys_getfhat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 564 = getfhat */ { AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 565 = fhlink */ Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Mon Jul 6 16:34:29 2020 (r362970) +++ head/sys/kern/init_sysent.c Mon Jul 6 16:34:49 2020 (r362971) @@ -616,8 +616,8 @@ struct sysent sysent[] = { { AS(fhstatfs_args), (sy_call_t *)sys_fhstatfs, AUE_FHSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 558 = fhstatfs */ { AS(mknodat_args), (sy_call_t *)sys_mknodat, AUE_MKNODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 559 = mknodat */ { AS(kevent_args), (sy_call_t *)sys_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = kevent */ - { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = cpuset_getdomain */ - { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = cpuset_setdomain */ + { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 561 = cpuset_getdomain */ + { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 562 = cpuset_setdomain */ { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 563 = getrandom */ { AS(getfhat_args), (sy_call_t *)sys_getfhat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 564 = getfhat */ { AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 565 = fhlink */ From owner-svn-src-all@freebsd.org Mon Jul 6 17:47:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2EC636CF70; Mon, 6 Jul 2020 17:47:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0tLn4k7Hz4L92; Mon, 6 Jul 2020 17:47:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8616821D55; Mon, 6 Jul 2020 17:47:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066HlTTP031633; Mon, 6 Jul 2020 17:47:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066HlTT8031632; Mon, 6 Jul 2020 17:47:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202007061747.066HlTT8031632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 6 Jul 2020 17:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362972 - head/lib/libefivar X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/lib/libefivar X-SVN-Commit-Revision: 362972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 17:47:30 -0000 Author: mhorne Date: Mon Jul 6 17:47:29 2020 New Revision: 362972 URL: https://svnweb.freebsd.org/changeset/base/362972 Log: libefivar: define MDE_CPU_RISCV64 The necessary definitions from EDK2 are present, so this allows the library to be built on RISC-V. Modified: head/lib/libefivar/efi-osdep.h Modified: head/lib/libefivar/efi-osdep.h ============================================================================== --- head/lib/libefivar/efi-osdep.h Mon Jul 6 16:34:49 2020 (r362971) +++ head/lib/libefivar/efi-osdep.h Mon Jul 6 17:47:29 2020 (r362972) @@ -104,6 +104,8 @@ typedef void VOID; #define MDE_CPU_ARM #elif defined(__aarch64__) #define MDE_CPU_AARCH64 +#elif defined(__riscv) +#define MDE_CPU_RISCV64 #endif /* FreeBSD doesn't have/use MDE_CPU_EBC or MDE_CPU_IPF (ia64) */ From owner-svn-src-all@freebsd.org Mon Jul 6 18:19:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C79036D659; Mon, 6 Jul 2020 18:19:46 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0v416mQfz4N0v; Mon, 6 Jul 2020 18:19:45 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CABB9227D4; Mon, 6 Jul 2020 18:19:45 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066IJjHX050165; Mon, 6 Jul 2020 18:19:45 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066IJhE0050151; Mon, 6 Jul 2020 18:19:43 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202007061819.066IJhE0050151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 6 Jul 2020 18:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362973 - in head: share/mk stand stand/common stand/efi/include/riscv stand/efi/libefi stand/efi/loader stand/efi/loader/arch/riscv sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head: share/mk stand stand/common stand/efi/include/riscv stand/efi/libefi stand/efi/loader stand/efi/loader/arch/riscv sys/riscv/include X-SVN-Commit-Revision: 362973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 18:19:46 -0000 Author: mhorne Date: Mon Jul 6 18:19:42 2020 New Revision: 362973 URL: https://svnweb.freebsd.org/changeset/base/362973 Log: RISC-V boot1.efi and loader.efi support This implementation doesn't have any major deviations from the other EFI ports. I've copied the boilerplate from arm and arm64. I've tested this with the following boot flows: OpenSBI (M-mode) -> u-boot (S-mode) -> loader.efi -> FreeBSD OpenSBI (M-mode) -> u-boot (S-mode) -> boot1.efi -> loader.efi -> FreeBSD Due to the way that u-boot handles secondary CPUs, OpenSBI >= v0.7 is required, as the HSM extension is needed to bring them up explicitly. Because of this, using BBL as the SBI implementation will not be possible. Additionally, there are a few recent u-boot changes that are required as well, all of which will be present in the upcoming v2020.07 release. Looks good: emaste Differential Revision: https://reviews.freebsd.org/D25135 Added: head/stand/efi/include/riscv/ head/stand/efi/include/riscv/efibind.h - copied unchanged from r362787, head/stand/efi/include/arm64/efibind.h head/stand/efi/loader/arch/riscv/ head/stand/efi/loader/arch/riscv/Makefile.inc (contents, props changed) head/stand/efi/loader/arch/riscv/exec.c - copied, changed from r362787, head/stand/efi/loader/arch/arm/exec.c head/stand/efi/loader/arch/riscv/ldscript.riscv (contents, props changed) head/stand/efi/loader/arch/riscv/start.S (contents, props changed) Modified: head/share/mk/src.opts.mk head/stand/common/self_reloc.c head/stand/defs.mk head/stand/efi/libefi/Makefile head/stand/efi/loader/copy.c head/stand/efi/loader/main.c head/stand/loader.mk head/sys/riscv/include/metadata.h Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Mon Jul 6 17:47:29 2020 (r362972) +++ head/share/mk/src.opts.mk Mon Jul 6 18:19:42 2020 (r362973) @@ -318,8 +318,8 @@ BROKEN_OPTIONS+=LIBSOFT # marked no longer broken with the switch to LLVM. BROKEN_OPTIONS+=GOOGLETEST SSP .endif -# EFI doesn't exist on mips, powerpc, or riscv. -.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Mriscv*} +# EFI doesn't exist on mips or powerpc. +.if ${__T:Mmips*} || ${__T:Mpowerpc*} BROKEN_OPTIONS+=EFI .endif # OFW is only for powerpc, exclude others Modified: head/stand/common/self_reloc.c ============================================================================== --- head/stand/common/self_reloc.c Mon Jul 6 17:47:29 2020 (r362972) +++ head/stand/common/self_reloc.c Mon Jul 6 18:19:42 2020 (r362973) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__aarch64__) || defined(__amd64__) +#if defined(__aarch64__) || defined(__amd64__) || defined(__riscv) #define ElfW_Rel Elf64_Rela #define ElfW_Dyn Elf64_Dyn #define ELFW_R_TYPE ELF64_R_TYPE @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); #elif defined(__i386__) #define RELOC_TYPE_NONE R_386_NONE #define RELOC_TYPE_RELATIVE R_386_RELATIVE +#elif defined(__riscv) +#define RELOC_TYPE_NONE R_RISCV_NONE +#define RELOC_TYPE_RELATIVE R_RISCV_RELATIVE #endif void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic); Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Mon Jul 6 17:47:29 2020 (r362972) +++ head/stand/defs.mk Mon Jul 6 18:19:42 2020 (r362973) @@ -115,13 +115,14 @@ AFLAGS+= --32 SSP_CFLAGS= # Add in the no float / no SIMD stuff and announce we're freestanding -# aarch64 and riscv don't have -msoft-float, but all others do. riscv -# currently has no /boot/loader, but may soon. +# aarch64 and riscv don't have -msoft-float, but all others do. CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -mgeneral-regs-only -ffixed-x18 -fPIC .elif ${MACHINE_CPUARCH} == "riscv" -CFLAGS+= -march=rv64imac -mabi=lp64 +CFLAGS+= -march=rv64imac -mabi=lp64 -fPIC +CFLAGS.clang+= -mcmodel=medium +CFLAGS.gcc+= -mcmodel=medany .else CFLAGS+= -msoft-float .endif @@ -146,6 +147,12 @@ CFLAGS+= -fPIC -mno-red-zone CFLAGS.clang+= -mno-movt CFLAGS.clang+= -mfpu=none CFLAGS+= -fPIC +.endif + +# Some RISC-V linkers have support for relaxations, while some (lld) do not +# yet. If this is the case we inhibit the compiler from emitting relaxations. +.if ${LINKER_FEATURES:Mriscv-relaxations} == "" +CFLAGS+= -mno-relax .endif # The boot loader build uses dd status=none, where possible, for reproducible Copied: head/stand/efi/include/riscv/efibind.h (from r362787, head/stand/efi/include/arm64/efibind.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/include/riscv/efibind.h Mon Jul 6 18:19:42 2020 (r362973, copy of r362787, head/stand/efi/include/arm64/efibind.h) @@ -0,0 +1,217 @@ +/* $FreeBSD$ */ +/*++ + +Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. + +Module Name: + + efefind.h + +Abstract: + + EFI to compile bindings + + + + +Revision History + +--*/ + +#pragma pack() + + +#ifdef __FreeBSD__ +#include +#else +// +// Basic int types of various widths +// + +#if (__STDC_VERSION__ < 199901L ) + + // No ANSI C 1999/2000 stdint.h integer width declarations + + #ifdef _MSC_EXTENSIONS + + // Use Microsoft C compiler integer width declarations + + typedef unsigned __int64 uint64_t; + typedef __int64 int64_t; + typedef unsigned __int32 uint32_t; + typedef __int32 int32_t; + typedef unsigned __int16 uint16_t; + typedef __int16 int16_t; + typedef unsigned __int8 uint8_t; + typedef __int8 int8_t; + #else + #ifdef UNIX_LP64 + + // Use LP64 programming model from C_FLAGS for integer width declarations + + typedef unsigned long uint64_t; + typedef long int64_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned char uint8_t; + typedef char int8_t; + #else + + // Assume P64 programming model from C_FLAGS for integer width declarations + + typedef unsigned long long uint64_t; + typedef long long int64_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned char uint8_t; + typedef char int8_t; + #endif + #endif +#endif +#endif /* __FreeBSD__ */ + +// +// Basic EFI types of various widths +// + + +typedef uint64_t UINT64; +typedef int64_t INT64; +typedef uint32_t UINT32; +typedef int32_t INT32; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef uint8_t UINT8; +typedef int8_t INT8; + + +#undef VOID +#define VOID void + + +typedef int64_t INTN; +typedef uint64_t UINTN; + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// BugBug: Code to debug +// +#define BIT63 0x8000000000000000 + +#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) +#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) + +// +// Macro's with casts make this much easier to use and read. +// +#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) +#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) +// +// BugBug: End Debug Code!!! +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#define EFIERR(a) (0x8000000000000000 | a) +#define EFI_ERROR_MASK 0x8000000000000000 +#define EFIERR_OEM(a) (0xc000000000000000 | a) + +#define BAD_POINTER 0xFBFBFBFBFBFBFBFB +#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF + +#define BREAKPOINT() __break(0) + +// +// Pointers must be aligned to these address to function +// you will get an alignment fault if this value is less than 8 +// +#define MIN_ALIGNMENT_SIZE 8 + +#define ALIGN_VARIABLE(Value , Adjustment) \ + (UINTN) Adjustment = 0; \ + if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ + (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ + Value = (UINTN)Value + (UINTN)Adjustment + +// +// Define macros to create data structure signatures. +// + +#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) +#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) +#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) + +// +// EFIAPI - prototype calling convention for EFI function pointers +// BOOTSERVICE - prototype for implementation of a boot service interface +// RUNTIMESERVICE - prototype for implementation of a runtime service interface +// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service +// RUNTIME_CODE - pragma macro for declaring runtime code +// + +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options + #ifdef _MSC_EXTENSIONS + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler + #else + #define EFIAPI // Substitute expresion to force C calling convention + #endif +#endif + +#define BOOTSERVICE +#define RUNTIMESERVICE +#define RUNTIMEFUNCTION + +#define RUNTIME_CODE(a) alloc_text("rtcode", a) +#define BEGIN_RUNTIME_DATA() data_seg("rtdata") +#define END_RUNTIME_DATA() data_seg() + +#define VOLATILE volatile + +// +// BugBug: Need to find out if this is portable across compilers. +// +void __mfa (void); +#define MEMORY_FENCE() __mfa() + +#ifdef EFI_NO_INTERFACE_DECL + #define EFI_FORWARD_DECLARATION(x) + #define EFI_INTERFACE_DECL(x) +#else + #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x + #define EFI_INTERFACE_DECL(x) typedef struct x +#endif + +// +// When build similar to FW, then link everything together as +// one big module. +// + +#define EFI_DRIVER_ENTRY_POINT(InitFunction) + +#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ + (_if)->LoadInternal(type, name, entry) +// entry(NULL, ST) + +#ifdef __FreeBSD__ +#define INTERFACE_DECL(x) struct x +#else +// +// Some compilers don't support the forward reference construct: +// typedef struct XXXXX +// +// The following macro provide a workaround for such cases. +// +#ifdef NO_INTERFACE_DECL +#define INTERFACE_DECL(x) +#else +#define INTERFACE_DECL(x) typedef struct x +#endif +#endif Modified: head/stand/efi/libefi/Makefile ============================================================================== --- head/stand/efi/libefi/Makefile Mon Jul 6 17:47:29 2020 (r362972) +++ head/stand/efi/libefi/Makefile Mon Jul 6 18:19:42 2020 (r362973) @@ -27,7 +27,8 @@ SRCS+= teken.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= time.c -.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" +.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ + ${MACHINE_CPUARCH} == "riscv" SRCS+= time_event.c .endif Added: head/stand/efi/loader/arch/riscv/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/loader/arch/riscv/Makefile.inc Mon Jul 6 18:19:42 2020 (r362973) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +HAVE_FDT=yes + +SRCS+= exec.c \ + efiserialio.c \ + start.S Copied and modified: head/stand/efi/loader/arch/riscv/exec.c (from r362787, head/stand/efi/loader/arch/arm/exec.c) ============================================================================== --- head/stand/efi/loader/arch/arm/exec.c Mon Jun 29 18:06:00 2020 (r362787, copy source) +++ head/stand/efi/loader/arch/riscv/exec.c Mon Jul 6 18:19:42 2020 (r362973) @@ -43,25 +43,11 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "loader_efi.h" -extern vm_offset_t md_load(char *, vm_offset_t *); extern int bi_load(char *, vm_offset_t *, vm_offset_t *); static int -__elfN(arm_load)(char *filename, uint64_t dest, - struct preloaded_file **result) +__elfN(exec)(struct preloaded_file *fp) { - int r; - - r = __elfN(loadfile)(filename, dest, result); - if (r != 0) - return (r); - - return (0); -} - -static int -__elfN(arm_exec)(struct preloaded_file *fp) -{ struct file_metadata *fmp; vm_offset_t modulep, kernend; Elf_Ehdr *e; @@ -85,22 +71,22 @@ __elfN(arm_exec)(struct preloaded_file *fp) return (error); } - /* At this point we've called ExitBootServices, so we can't call - * printf or any other function that uses Boot Services */ - + /* + * At this point we've called ExitBootServices, so we can't call + * printf or any other function that uses Boot Services + */ dev_cleanup(); (*entry)((void *)modulep); panic("exec returned"); } -static struct file_format arm_elf = { - __elfN(arm_load), - __elfN(arm_exec) +static struct file_format riscv_elf = { + __elfN(loadfile), + __elfN(exec) }; struct file_format *file_formats[] = { - &arm_elf, + &riscv_elf, NULL }; - Added: head/stand/efi/loader/arch/riscv/ldscript.riscv ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/loader/arch/riscv/ldscript.riscv Mon Jul 6 18:19:42 2020 (r362973) @@ -0,0 +1,87 @@ +/* $FreeBSD$ */ +OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv") +OUTPUT_ARCH(riscv64) +ENTRY(_start) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0; + ImageBase = .; + .text : { + *(.peheader) + *(.text .stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.plt) + } =0x9090 + . = ALIGN(16); + .data : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + *(.opd) + *(.data .data.* .gnu.linkonce.d.*) + *(.data1) + *(.plabel) + + . = ALIGN(16); + __bss_start = .; + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + *(.dynbss) + *(.bss *.bss.*) + *(COMMON) + . = ALIGN(16); + __bss_end = .; + } + . = ALIGN(16); + set_Xcommand_set : { + __start_set_Xcommand_set = .; + *(set_Xcommand_set) + __stop_set_Xcommand_set = .; + } + set_Xficl_compile_set : { + __start_set_Xficl_compile_set = .; + *(set_Xficl_compile_set) + __stop_set_Xficl_compile_set = .; + } + . = ALIGN(16); + .sdata : { + /* + * u-boot expects the gp register to be untouched by the EFI payload, so we + * can't enable this yet. + */ + /* __global_pointer$ = . + 0x800; */ + *(.got.plt .got) + *(.sdata .sdata.* .gnu.linkonce.s.*) + *(dynsbss) + *(.scommon) + } + . = ALIGN(16); + .dynamic : { *(.dynamic) } + . = ALIGN(16); + .rela.dyn : { + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + *(.rela.plt) + *(.relset_*) + *(.rela.dyn .rela.dyn.*) + } + . = ALIGN(16); + .reloc : { *(.reloc) } + . = ALIGN(16); + .dynsym : { *(.dynsym) } + _edata = .; + + /* Unused sections */ + .dynstr : { *(.dynstr) } + .hash : { *(.hash) } +} Added: head/stand/efi/loader/arch/riscv/start.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/efi/loader/arch/riscv/start.S Mon Jul 6 18:19:42 2020 (r362973) @@ -0,0 +1,168 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Mitchell Horne + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +/* + * We need to be a PE32+ file for EFI. On some architectures we can use + * objcopy to create the correct file, however on RISC-V we need to do + * it ourselves. + */ + +#define IMAGE_FILE_MACHINE_RISCV64 0x5064 + +#define IMAGE_SCN_CNT_CODE 0x00000020 +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 +#define IMAGE_SCN_MEM_READ 0x40000000 + + .section .peheader,"a" +efi_start: + /* The MS-DOS Stub, only used to get the offset of the COFF header */ + .ascii "MZ" + .short 0 + .space 0x38 + .long pe_sig - efi_start + + /* The PE32 Signature. Needs to be 8-byte aligned */ + .align 3 +pe_sig: + .ascii "PE" + .short 0 +coff_head: + .short IMAGE_FILE_MACHINE_RISCV64 /* RISC-V 64 file */ + .short 2 /* 2 Sections */ + .long 0 /* Timestamp */ + .long 0 /* No symbol table */ + .long 0 /* No symbols */ + .short section_table - optional_header /* Optional header size */ + .short 0 /* Characteristics TODO: Fill in */ + +optional_header: + .short 0x020b /* PE32+ (64-bit addressing) */ + .byte 0 /* Major linker version */ + .byte 0 /* Minor linker version */ + .long _edata - _end_header /* Code size */ + .long 0 /* No initialized data */ + .long 0 /* No uninitialized data */ + .long _start - efi_start /* Entry point */ + .long _end_header - efi_start /* Start of code */ + +optional_windows_header: + .quad 0 /* Image base */ + .long 32 /* Section Alignment */ + .long 8 /* File alignment */ + .short 0 /* Major OS version */ + .short 0 /* Minor OS version */ + .short 0 /* Major image version */ + .short 0 /* Minor image version */ + .short 0 /* Major subsystem version */ + .short 0 /* Minor subsystem version */ + .long 0 /* Win32 version */ + .long _edata - efi_start /* Image size */ + .long _end_header - efi_start /* Header size */ + .long 0 /* Checksum */ + .short 0xa /* Subsystem (EFI app) */ + .short 0 /* DLL Characteristics */ + .quad 0 /* Stack reserve */ + .quad 0 /* Stack commit */ + .quad 0 /* Heap reserve */ + .quad 0 /* Heap commit */ + .long 0 /* Loader flags */ + .long 6 /* Number of RVAs */ + + /* RVAs: */ + .quad 0 + .quad 0 + .quad 0 + .quad 0 + .quad 0 + .quad 0 + +section_table: + /* We need a .reloc section for EFI */ + .ascii ".reloc" + .byte 0 + .byte 0 /* Pad to 8 bytes */ + .long 0 /* Virtual size */ + .long 0 /* Virtual address */ + .long 0 /* Size of raw data */ + .long 0 /* Pointer to raw data */ + .long 0 /* Pointer to relocations */ + .long 0 /* Pointer to line numbers */ + .short 0 /* Number of relocations */ + .short 0 /* Number of line numbers */ + .long (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | \ + IMAGE_SCN_MEM_DISCARDABLE) /* Characteristics */ + + /* The contents of the loader */ + .ascii ".text" + .byte 0 + .byte 0 + .byte 0 /* Pad to 8 bytes */ + .long _edata - _end_header /* Virtual size */ + .long _end_header - efi_start /* Virtual address */ + .long _edata - _end_header /* Size of raw data */ + .long _end_header - efi_start /* Pointer to raw data */ + .long 0 /* Pointer to relocations */ + .long 0 /* Pointer to line numbers */ + .short 0 /* Number of relocations */ + .short 0 /* Number of line numbers */ + .long (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | \ + IMAGE_SCN_MEM_READ) /* Characteristics */ +_end_header: + + .text + .globl _start +_start: + /* Save the boot params to the stack */ + addi sp, sp, -16 + sd a0, 0(sp) + sd a1, 8(sp) + + /* Zero the BSS */ + lla t0, __bss_start + lla t1, __bss_end + +1: sd zero, 0(t0) + addi t0, t0, 8 + bltu t0, t1, 1b + + lla a0, ImageBase + lla a1, _DYNAMIC + call _C_LABEL(self_reloc) + + ld a1, 8(sp) + ld a0, 0(sp) + tail _C_LABEL(efi_main) + + /* NOTREACHED */ +2: wfi + j 2b Modified: head/stand/efi/loader/copy.c ============================================================================== --- head/stand/efi/loader/copy.c Mon Jul 6 17:47:29 2020 (r362972) +++ head/stand/efi/loader/copy.c Mon Jul 6 18:19:42 2020 (r362973) @@ -227,7 +227,7 @@ efi_copy_init(void) staging_base = staging; staging_end = staging + nr_pages * EFI_PAGE_SIZE; -#if defined(__aarch64__) || defined(__arm__) +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) /* * Round the kernel load address to a 2MiB value. This is needed * because the kernel builds a page table based on where it has @@ -277,7 +277,7 @@ before_staging: return (false); } addr = staging - nr_pages * EFI_PAGE_SIZE; -#if defined(__aarch64__) || defined(__arm__) +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) /* See efi_copy_init for why this is needed */ addr = rounddown2(addr, 2 * 1024 * 1024); #endif @@ -343,6 +343,11 @@ efi_copyout(const vm_offset_t src, void *dest, const s ssize_t efi_readin(readin_handle_t fd, vm_offset_t dest, const size_t len) { + + if (!stage_offset_set) { + stage_offset = (vm_offset_t)staging - dest; + stage_offset_set = 1; + } if (!efi_check_space(dest + stage_offset + len)) { errno = ENOMEM; Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Mon Jul 6 17:47:29 2020 (r362972) +++ head/stand/efi/loader/main.c Mon Jul 6 18:19:42 2020 (r362973) @@ -912,7 +912,7 @@ main(int argc, CHAR16 *argv[]) */ setenv("console", "efi", 1); uhowto = parse_uefi_con_out(); -#if defined(__aarch64__) || defined(__arm__) +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) if ((uhowto & RB_SERIAL) != 0) setenv("console", "comconsole", 1); #endif Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Mon Jul 6 17:47:29 2020 (r362972) +++ head/stand/loader.mk Mon Jul 6 18:19:42 2020 (r362973) @@ -25,6 +25,9 @@ SRCS+= metadata.c .elif ${MACHINE} == "mips" SRCS+= load_elf32.c reloc_elf32.c SRCS+= metadata.c +.elif ${MACHINE_CPUARCH} == "riscv" +SRCS+= load_elf64.c reloc_elf64.c +SRCS+= metadata.c .endif .if ${LOADER_DISK_SUPPORT:Uyes} == "yes" Modified: head/sys/riscv/include/metadata.h ============================================================================== --- head/sys/riscv/include/metadata.h Mon Jul 6 17:47:29 2020 (r362972) +++ head/sys/riscv/include/metadata.h Mon Jul 6 18:19:42 2020 (r362973) @@ -30,6 +30,28 @@ #ifndef _MACHINE_METADATA_H_ #define _MACHINE_METADATA_H_ -#define MODINFOMD_DTBP 0x1001 +#define MODINFOMD_DTBP 0x1001 +#define MODINFOMD_EFI_MAP 0x1002 + +struct efi_map_header { + size_t memory_size; + size_t descriptor_size; + uint32_t descriptor_version; +}; + +/* + * Placeholder for now + */ +struct efi_fb { + uint64_t fb_addr; + uint64_t fb_size; + uint32_t fb_height; + uint32_t fb_width; + uint32_t fb_stride; + uint32_t fb_mask_red; + uint32_t fb_mask_green; + uint32_t fb_mask_blue; + uint32_t fb_mask_reserved; +}; #endif /* !_MACHINE_METADATA_H_ */ From owner-svn-src-all@freebsd.org Mon Jul 6 18:26:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3545036DA56; Mon, 6 Jul 2020 18:26:51 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0vDC0xL6z4NPk; Mon, 6 Jul 2020 18:26:51 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id EEC95249DE; Mon, 6 Jul 2020 18:26:50 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f175.google.com with SMTP id y13so19391785ybj.10; Mon, 06 Jul 2020 11:26:50 -0700 (PDT) X-Gm-Message-State: AOAM533AFWROifMzdY6h7r08LOq1PFetA0rKRcjv6xLcJZr2/yr+PPvl /iWSHib5HcD/0NTKYhkEFjfMVOVnu/xPPeanS74= X-Google-Smtp-Source: ABdhPJwmK0YJ7k4uG78Gg+5WlMg8Rj+dZP+k6UldZyWZcj7gf6+23RbzHmR9G39RCRQqUvUfRpb7QgX0t/gKSLaXuUI= X-Received: by 2002:a25:3851:: with SMTP id f78mr81569403yba.212.1594060009740; Mon, 06 Jul 2020 11:26:49 -0700 (PDT) MIME-Version: 1.0 References: <202007061819.066IJhE0050151@repo.freebsd.org> In-Reply-To: <202007061819.066IJhE0050151@repo.freebsd.org> From: Mitchell Horne Date: Mon, 6 Jul 2020 15:26:38 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r362973 - in head: share/mk stand stand/common stand/efi/include/riscv stand/efi/libefi stand/efi/loader stand/efi/loader/arch/riscv sys/riscv/include To: Mitchell Horne Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 18:26:51 -0000 On Mon, Jul 6, 2020 at 3:19 PM Mitchell Horne wrote: > > Author: mhorne > Date: Mon Jul 6 18:19:42 2020 > New Revision: 362973 > URL: https://svnweb.freebsd.org/changeset/base/362973 > > Log: > RISC-V boot1.efi and loader.efi support > > This implementation doesn't have any major deviations from the other EFI > ports. I've copied the boilerplate from arm and arm64. > > I've tested this with the following boot flows: > OpenSBI (M-mode) -> u-boot (S-mode) -> loader.efi -> FreeBSD > OpenSBI (M-mode) -> u-boot (S-mode) -> boot1.efi -> loader.efi -> FreeBSD > > Due to the way that u-boot handles secondary CPUs, OpenSBI >= v0.7 is required, > as the HSM extension is needed to bring them up explicitly. Because of this, > using BBL as the SBI implementation will not be possible. Additionally, there > are a few recent u-boot changes that are required as well, all of which will be > present in the upcoming v2020.07 release. > > Looks good: emaste > Differential Revision: https://reviews.freebsd.org/D25135 > > Added: > head/stand/efi/include/riscv/ > head/stand/efi/include/riscv/efibind.h > - copied unchanged from r362787, head/stand/efi/include/arm64/efibind.h > head/stand/efi/loader/arch/riscv/ > head/stand/efi/loader/arch/riscv/Makefile.inc (contents, props changed) > head/stand/efi/loader/arch/riscv/exec.c > - copied, changed from r362787, head/stand/efi/loader/arch/arm/exec.c > head/stand/efi/loader/arch/riscv/ldscript.riscv (contents, props changed) > head/stand/efi/loader/arch/riscv/start.S (contents, props changed) > Modified: > head/share/mk/src.opts.mk > head/stand/common/self_reloc.c > head/stand/defs.mk > head/stand/efi/libefi/Makefile > head/stand/efi/loader/copy.c > head/stand/efi/loader/main.c > head/stand/loader.mk > head/sys/riscv/include/metadata.h > > Modified: head/share/mk/src.opts.mk > ============================================================================== > --- head/share/mk/src.opts.mk Mon Jul 6 17:47:29 2020 (r362972) > +++ head/share/mk/src.opts.mk Mon Jul 6 18:19:42 2020 (r362973) > @@ -318,8 +318,8 @@ BROKEN_OPTIONS+=LIBSOFT > # marked no longer broken with the switch to LLVM. > BROKEN_OPTIONS+=GOOGLETEST SSP > .endif > -# EFI doesn't exist on mips, powerpc, or riscv. > -.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Mriscv*} > +# EFI doesn't exist on mips or powerpc. > +.if ${__T:Mmips*} || ${__T:Mpowerpc*} > BROKEN_OPTIONS+=EFI > .endif > # OFW is only for powerpc, exclude others > I meant to commit this hunk separately, but included it by mistake. The log would have been: Enable MK_EFI by default on RISC-V We can now build the EFI libraries, utilities, and bootloader. This is enough for EFI boot-time services and for us to un-break this option. Reviewed by: br Differential Revision: https://reviews.freebsd.org/D25137 > Modified: head/stand/common/self_reloc.c > ============================================================================== > --- head/stand/common/self_reloc.c Mon Jul 6 17:47:29 2020 (r362972) > +++ head/stand/common/self_reloc.c Mon Jul 6 18:19:42 2020 (r362973) > @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -#if defined(__aarch64__) || defined(__amd64__) > +#if defined(__aarch64__) || defined(__amd64__) || defined(__riscv) > #define ElfW_Rel Elf64_Rela > #define ElfW_Dyn Elf64_Dyn > #define ELFW_R_TYPE ELF64_R_TYPE > @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); > #elif defined(__i386__) > #define RELOC_TYPE_NONE R_386_NONE > #define RELOC_TYPE_RELATIVE R_386_RELATIVE > +#elif defined(__riscv) > +#define RELOC_TYPE_NONE R_RISCV_NONE > +#define RELOC_TYPE_RELATIVE R_RISCV_RELATIVE > #endif > > void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic); > > Modified: head/stand/defs.mk > ============================================================================== > --- head/stand/defs.mk Mon Jul 6 17:47:29 2020 (r362972) > +++ head/stand/defs.mk Mon Jul 6 18:19:42 2020 (r362973) > @@ -115,13 +115,14 @@ AFLAGS+= --32 > SSP_CFLAGS= > > # Add in the no float / no SIMD stuff and announce we're freestanding > -# aarch64 and riscv don't have -msoft-float, but all others do. riscv > -# currently has no /boot/loader, but may soon. > +# aarch64 and riscv don't have -msoft-float, but all others do. > CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} > .if ${MACHINE_CPUARCH} == "aarch64" > CFLAGS+= -mgeneral-regs-only -ffixed-x18 -fPIC > .elif ${MACHINE_CPUARCH} == "riscv" > -CFLAGS+= -march=rv64imac -mabi=lp64 > +CFLAGS+= -march=rv64imac -mabi=lp64 -fPIC > +CFLAGS.clang+= -mcmodel=medium > +CFLAGS.gcc+= -mcmodel=medany > .else > CFLAGS+= -msoft-float > .endif > @@ -146,6 +147,12 @@ CFLAGS+= -fPIC -mno-red-zone > CFLAGS.clang+= -mno-movt > CFLAGS.clang+= -mfpu=none > CFLAGS+= -fPIC > +.endif > + > +# Some RISC-V linkers have support for relaxations, while some (lld) do not > +# yet. If this is the case we inhibit the compiler from emitting relaxations. > +.if ${LINKER_FEATURES:Mriscv-relaxations} == "" > +CFLAGS+= -mno-relax > .endif > > # The boot loader build uses dd status=none, where possible, for reproducible > > Copied: head/stand/efi/include/riscv/efibind.h (from r362787, head/stand/efi/include/arm64/efibind.h) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/stand/efi/include/riscv/efibind.h Mon Jul 6 18:19:42 2020 (r362973, copy of r362787, head/stand/efi/include/arm64/efibind.h) > @@ -0,0 +1,217 @@ > +/* $FreeBSD$ */ > +/*++ > + > +Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved > +This software and associated documentation (if any) is furnished > +under a license and may only be used or copied in accordance > +with the terms of the license. Except as permitted by such > +license, no part of this software or documentation may be > +reproduced, stored in a retrieval system, or transmitted in any > +form or by any means without the express written consent of > +Intel Corporation. > + > +Module Name: > + > + efefind.h > + > +Abstract: > + > + EFI to compile bindings > + > + > + > + > +Revision History > + > +--*/ > + > +#pragma pack() > + > + > +#ifdef __FreeBSD__ > +#include > +#else > +// > +// Basic int types of various widths > +// > + > +#if (__STDC_VERSION__ < 199901L ) > + > + // No ANSI C 1999/2000 stdint.h integer width declarations > + > + #ifdef _MSC_EXTENSIONS > + > + // Use Microsoft C compiler integer width declarations > + > + typedef unsigned __int64 uint64_t; > + typedef __int64 int64_t; > + typedef unsigned __int32 uint32_t; > + typedef __int32 int32_t; > + typedef unsigned __int16 uint16_t; > + typedef __int16 int16_t; > + typedef unsigned __int8 uint8_t; > + typedef __int8 int8_t; > + #else > + #ifdef UNIX_LP64 > + > + // Use LP64 programming model from C_FLAGS for integer width declarations > + > + typedef unsigned long uint64_t; > + typedef long int64_t; > + typedef unsigned int uint32_t; > + typedef int int32_t; > + typedef unsigned short uint16_t; > + typedef short int16_t; > + typedef unsigned char uint8_t; > + typedef char int8_t; > + #else > + > + // Assume P64 programming model from C_FLAGS for integer width declarations > + > + typedef unsigned long long uint64_t; > + typedef long long int64_t; > + typedef unsigned int uint32_t; > + typedef int int32_t; > + typedef unsigned short uint16_t; > + typedef short int16_t; > + typedef unsigned char uint8_t; > + typedef char int8_t; > + #endif > + #endif > +#endif > +#endif /* __FreeBSD__ */ > + > +// > +// Basic EFI types of various widths > +// > + > + > +typedef uint64_t UINT64; > +typedef int64_t INT64; > +typedef uint32_t UINT32; > +typedef int32_t INT32; > +typedef uint16_t UINT16; > +typedef int16_t INT16; > +typedef uint8_t UINT8; > +typedef int8_t INT8; > + > + > +#undef VOID > +#define VOID void > + > + > +typedef int64_t INTN; > +typedef uint64_t UINTN; > + > +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +// BugBug: Code to debug > +// > +#define BIT63 0x8000000000000000 > + > +#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) > +#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) > + > +// > +// Macro's with casts make this much easier to use and read. > +// > +#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) > +#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) > +// > +// BugBug: End Debug Code!!! > +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > + > +#define EFIERR(a) (0x8000000000000000 | a) > +#define EFI_ERROR_MASK 0x8000000000000000 > +#define EFIERR_OEM(a) (0xc000000000000000 | a) > + > +#define BAD_POINTER 0xFBFBFBFBFBFBFBFB > +#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF > + > +#define BREAKPOINT() __break(0) > + > +// > +// Pointers must be aligned to these address to function > +// you will get an alignment fault if this value is less than 8 > +// > +#define MIN_ALIGNMENT_SIZE 8 > + > +#define ALIGN_VARIABLE(Value , Adjustment) \ > + (UINTN) Adjustment = 0; \ > + if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ > + (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ > + Value = (UINTN)Value + (UINTN)Adjustment > + > +// > +// Define macros to create data structure signatures. > +// > + > +#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) > +#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) > +#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) > + > +// > +// EFIAPI - prototype calling convention for EFI function pointers > +// BOOTSERVICE - prototype for implementation of a boot service interface > +// RUNTIMESERVICE - prototype for implementation of a runtime service interface > +// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service > +// RUNTIME_CODE - pragma macro for declaring runtime code > +// > + > +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options > + #ifdef _MSC_EXTENSIONS > + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler > + #else > + #define EFIAPI // Substitute expresion to force C calling convention > + #endif > +#endif > + > +#define BOOTSERVICE > +#define RUNTIMESERVICE > +#define RUNTIMEFUNCTION > + > +#define RUNTIME_CODE(a) alloc_text("rtcode", a) > +#define BEGIN_RUNTIME_DATA() data_seg("rtdata") > +#define END_RUNTIME_DATA() data_seg() > + > +#define VOLATILE volatile > + > +// > +// BugBug: Need to find out if this is portable across compilers. > +// > +void __mfa (void); > +#define MEMORY_FENCE() __mfa() > + > +#ifdef EFI_NO_INTERFACE_DECL > + #define EFI_FORWARD_DECLARATION(x) > + #define EFI_INTERFACE_DECL(x) > +#else > + #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x > + #define EFI_INTERFACE_DECL(x) typedef struct x > +#endif > + > +// > +// When build similar to FW, then link everything together as > +// one big module. > +// > + > +#define EFI_DRIVER_ENTRY_POINT(InitFunction) > + > +#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ > + (_if)->LoadInternal(type, name, entry) > +// entry(NULL, ST) > + > +#ifdef __FreeBSD__ > +#define INTERFACE_DECL(x) struct x > +#else > +// > +// Some compilers don't support the forward reference construct: > +// typedef struct XXXXX > +// > +// The following macro provide a workaround for such cases. > +// > +#ifdef NO_INTERFACE_DECL > +#define INTERFACE_DECL(x) > +#else > +#define INTERFACE_DECL(x) typedef struct x > +#endif > +#endif > > Modified: head/stand/efi/libefi/Makefile > ============================================================================== > --- head/stand/efi/libefi/Makefile Mon Jul 6 17:47:29 2020 (r362972) > +++ head/stand/efi/libefi/Makefile Mon Jul 6 18:19:42 2020 (r362973) > @@ -27,7 +27,8 @@ SRCS+= teken.c > > .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" > SRCS+= time.c > -.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" > +.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ > + ${MACHINE_CPUARCH} == "riscv" > SRCS+= time_event.c > .endif > > > Added: head/stand/efi/loader/arch/riscv/Makefile.inc > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/stand/efi/loader/arch/riscv/Makefile.inc Mon Jul 6 18:19:42 2020 (r362973) > @@ -0,0 +1,7 @@ > +# $FreeBSD$ > + > +HAVE_FDT=yes > + > +SRCS+= exec.c \ > + efiserialio.c \ > + start.S > > Copied and modified: head/stand/efi/loader/arch/riscv/exec.c (from r362787, head/stand/efi/loader/arch/arm/exec.c) > ============================================================================== > --- head/stand/efi/loader/arch/arm/exec.c Mon Jun 29 18:06:00 2020 (r362787, copy source) > +++ head/stand/efi/loader/arch/riscv/exec.c Mon Jul 6 18:19:42 2020 (r362973) > @@ -43,25 +43,11 @@ __FBSDID("$FreeBSD$"); > #include "bootstrap.h" > #include "loader_efi.h" > > -extern vm_offset_t md_load(char *, vm_offset_t *); > extern int bi_load(char *, vm_offset_t *, vm_offset_t *); > > static int > -__elfN(arm_load)(char *filename, uint64_t dest, > - struct preloaded_file **result) > +__elfN(exec)(struct preloaded_file *fp) > { > - int r; > - > - r = __elfN(loadfile)(filename, dest, result); > - if (r != 0) > - return (r); > - > - return (0); > -} > - > -static int > -__elfN(arm_exec)(struct preloaded_file *fp) > -{ > struct file_metadata *fmp; > vm_offset_t modulep, kernend; > Elf_Ehdr *e; > @@ -85,22 +71,22 @@ __elfN(arm_exec)(struct preloaded_file *fp) > return (error); > } > > - /* At this point we've called ExitBootServices, so we can't call > - * printf or any other function that uses Boot Services */ > - > + /* > + * At this point we've called ExitBootServices, so we can't call > + * printf or any other function that uses Boot Services > + */ > dev_cleanup(); > > (*entry)((void *)modulep); > panic("exec returned"); > } > > -static struct file_format arm_elf = { > - __elfN(arm_load), > - __elfN(arm_exec) > +static struct file_format riscv_elf = { > + __elfN(loadfile), > + __elfN(exec) > }; > > struct file_format *file_formats[] = { > - &arm_elf, > + &riscv_elf, > NULL > }; > - > > Added: head/stand/efi/loader/arch/riscv/ldscript.riscv > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/stand/efi/loader/arch/riscv/ldscript.riscv Mon Jul 6 18:19:42 2020 (r362973) > @@ -0,0 +1,87 @@ > +/* $FreeBSD$ */ > +OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv") > +OUTPUT_ARCH(riscv64) > +ENTRY(_start) > +SECTIONS > +{ > + /* Read-only sections, merged into text segment: */ > + . = 0; > + ImageBase = .; > + .text : { > + *(.peheader) > + *(.text .stub .text.* .gnu.linkonce.t.*) > + /* .gnu.warning sections are handled specially by elf32.em. */ > + *(.gnu.warning) > + *(.plt) > + } =0x9090 > + . = ALIGN(16); > + .data : { > + *(.rodata .rodata.* .gnu.linkonce.r.*) > + *(.rodata1) > + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) > + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) > + *(.opd) > + *(.data .data.* .gnu.linkonce.d.*) > + *(.data1) > + *(.plabel) > + > + . = ALIGN(16); > + __bss_start = .; > + *(.sbss .sbss.* .gnu.linkonce.sb.*) > + *(.scommon) > + *(.dynbss) > + *(.bss *.bss.*) > + *(COMMON) > + . = ALIGN(16); > + __bss_end = .; > + } > + . = ALIGN(16); > + set_Xcommand_set : { > + __start_set_Xcommand_set = .; > + *(set_Xcommand_set) > + __stop_set_Xcommand_set = .; > + } > + set_Xficl_compile_set : { > + __start_set_Xficl_compile_set = .; > + *(set_Xficl_compile_set) > + __stop_set_Xficl_compile_set = .; > + } > + . = ALIGN(16); > + .sdata : { > + /* > + * u-boot expects the gp register to be untouched by the EFI payload, so we > + * can't enable this yet. > + */ > + /* __global_pointer$ = . + 0x800; */ > + *(.got.plt .got) > + *(.sdata .sdata.* .gnu.linkonce.s.*) > + *(dynsbss) > + *(.scommon) > + } > + . = ALIGN(16); > + .dynamic : { *(.dynamic) } > + . = ALIGN(16); > + .rela.dyn : { > + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) > + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) > + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) > + *(.rela.got) > + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) > + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) > + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) > + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) > + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) > + *(.rela.plt) > + *(.relset_*) > + *(.rela.dyn .rela.dyn.*) > + } > + . = ALIGN(16); > + .reloc : { *(.reloc) } > + . = ALIGN(16); > + .dynsym : { *(.dynsym) } > + _edata = .; > + > + /* Unused sections */ > + .dynstr : { *(.dynstr) } > + .hash : { *(.hash) } > +} > > Added: head/stand/efi/loader/arch/riscv/start.S > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/stand/efi/loader/arch/riscv/start.S Mon Jul 6 18:19:42 2020 (r362973) > @@ -0,0 +1,168 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2020 Mitchell Horne > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#include > + > +/* > + * We need to be a PE32+ file for EFI. On some architectures we can use > + * objcopy to create the correct file, however on RISC-V we need to do > + * it ourselves. > + */ > + > +#define IMAGE_FILE_MACHINE_RISCV64 0x5064 > + > +#define IMAGE_SCN_CNT_CODE 0x00000020 > +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 > +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 > +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 > +#define IMAGE_SCN_MEM_READ 0x40000000 > + > + .section .peheader,"a" > +efi_start: > + /* The MS-DOS Stub, only used to get the offset of the COFF header */ > + .ascii "MZ" > + .short 0 > + .space 0x38 > + .long pe_sig - efi_start > + > + /* The PE32 Signature. Needs to be 8-byte aligned */ > + .align 3 > +pe_sig: > + .ascii "PE" > + .short 0 > +coff_head: > + .short IMAGE_FILE_MACHINE_RISCV64 /* RISC-V 64 file */ > + .short 2 /* 2 Sections */ > + .long 0 /* Timestamp */ > + .long 0 /* No symbol table */ > + .long 0 /* No symbols */ > + .short section_table - optional_header /* Optional header size */ > + .short 0 /* Characteristics TODO: Fill in */ > + > +optional_header: > + .short 0x020b /* PE32+ (64-bit addressing) */ > + .byte 0 /* Major linker version */ > + .byte 0 /* Minor linker version */ > + .long _edata - _end_header /* Code size */ > + .long 0 /* No initialized data */ > + .long 0 /* No uninitialized data */ > + .long _start - efi_start /* Entry point */ > + .long _end_header - efi_start /* Start of code */ > + > +optional_windows_header: > + .quad 0 /* Image base */ > + .long 32 /* Section Alignment */ > + .long 8 /* File alignment */ > + .short 0 /* Major OS version */ > + .short 0 /* Minor OS version */ > + .short 0 /* Major image version */ > + .short 0 /* Minor image version */ > + .short 0 /* Major subsystem version */ > + .short 0 /* Minor subsystem version */ > + .long 0 /* Win32 version */ > + .long _edata - efi_start /* Image size */ > + .long _end_header - efi_start /* Header size */ > + .long 0 /* Checksum */ > + .short 0xa /* Subsystem (EFI app) */ > + .short 0 /* DLL Characteristics */ > + .quad 0 /* Stack reserve */ > + .quad 0 /* Stack commit */ > + .quad 0 /* Heap reserve */ > + .quad 0 /* Heap commit */ > + .long 0 /* Loader flags */ > + .long 6 /* Number of RVAs */ > + > + /* RVAs: */ > + .quad 0 > + .quad 0 > + .quad 0 > + .quad 0 > + .quad 0 > + .quad 0 > + > +section_table: > + /* We need a .reloc section for EFI */ > + .ascii ".reloc" > + .byte 0 > + .byte 0 /* Pad to 8 bytes */ > + .long 0 /* Virtual size */ > + .long 0 /* Virtual address */ > + .long 0 /* Size of raw data */ > + .long 0 /* Pointer to raw data */ > + .long 0 /* Pointer to relocations */ > + .long 0 /* Pointer to line numbers */ > + .short 0 /* Number of relocations */ > + .short 0 /* Number of line numbers */ > + .long (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | \ > + IMAGE_SCN_MEM_DISCARDABLE) /* Characteristics */ > + > + /* The contents of the loader */ > + .ascii ".text" > + .byte 0 > + .byte 0 > + .byte 0 /* Pad to 8 bytes */ > + .long _edata - _end_header /* Virtual size */ > + .long _end_header - efi_start /* Virtual address */ > + .long _edata - _end_header /* Size of raw data */ > + .long _end_header - efi_start /* Pointer to raw data */ > + .long 0 /* Pointer to relocations */ > + .long 0 /* Pointer to line numbers */ > + .short 0 /* Number of relocations */ > + .short 0 /* Number of line numbers */ > + .long (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | \ > + IMAGE_SCN_MEM_READ) /* Characteristics */ > +_end_header: > + > + .text > + .globl _start > +_start: > + /* Save the boot params to the stack */ > + addi sp, sp, -16 > + sd a0, 0(sp) > + sd a1, 8(sp) > + > + /* Zero the BSS */ > + lla t0, __bss_start > + lla t1, __bss_end > + > +1: sd zero, 0(t0) > + addi t0, t0, 8 > + bltu t0, t1, 1b > + > + lla a0, ImageBase > + lla a1, _DYNAMIC > + call _C_LABEL(self_reloc) > + > + ld a1, 8(sp) > + ld a0, 0(sp) > + tail _C_LABEL(efi_main) > + > + /* NOTREACHED */ > +2: wfi > + j 2b > > Modified: head/stand/efi/loader/copy.c > ============================================================================== > --- head/stand/efi/loader/copy.c Mon Jul 6 17:47:29 2020 (r362972) > +++ head/stand/efi/loader/copy.c Mon Jul 6 18:19:42 2020 (r362973) > @@ -227,7 +227,7 @@ efi_copy_init(void) > staging_base = staging; > staging_end = staging + nr_pages * EFI_PAGE_SIZE; > > -#if defined(__aarch64__) || defined(__arm__) > +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) > /* > * Round the kernel load address to a 2MiB value. This is needed > * because the kernel builds a page table based on where it has > @@ -277,7 +277,7 @@ before_staging: > return (false); > } > addr = staging - nr_pages * EFI_PAGE_SIZE; > -#if defined(__aarch64__) || defined(__arm__) > +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) > /* See efi_copy_init for why this is needed */ > addr = rounddown2(addr, 2 * 1024 * 1024); > #endif > @@ -343,6 +343,11 @@ efi_copyout(const vm_offset_t src, void *dest, const s > ssize_t > efi_readin(readin_handle_t fd, vm_offset_t dest, const size_t len) > { > + > + if (!stage_offset_set) { > + stage_offset = (vm_offset_t)staging - dest; > + stage_offset_set = 1; > + } > > if (!efi_check_space(dest + stage_offset + len)) { > errno = ENOMEM; > > Modified: head/stand/efi/loader/main.c > ============================================================================== > --- head/stand/efi/loader/main.c Mon Jul 6 17:47:29 2020 (r362972) > +++ head/stand/efi/loader/main.c Mon Jul 6 18:19:42 2020 (r362973) > @@ -912,7 +912,7 @@ main(int argc, CHAR16 *argv[]) > */ > setenv("console", "efi", 1); > uhowto = parse_uefi_con_out(); > -#if defined(__aarch64__) || defined(__arm__) > +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) > if ((uhowto & RB_SERIAL) != 0) > setenv("console", "comconsole", 1); > #endif > > Modified: head/stand/loader.mk > ============================================================================== > --- head/stand/loader.mk Mon Jul 6 17:47:29 2020 (r362972) > +++ head/stand/loader.mk Mon Jul 6 18:19:42 2020 (r362973) > @@ -25,6 +25,9 @@ SRCS+= metadata.c > .elif ${MACHINE} == "mips" > SRCS+= load_elf32.c reloc_elf32.c > SRCS+= metadata.c > +.elif ${MACHINE_CPUARCH} == "riscv" > +SRCS+= load_elf64.c reloc_elf64.c > +SRCS+= metadata.c > .endif > > .if ${LOADER_DISK_SUPPORT:Uyes} == "yes" > > Modified: head/sys/riscv/include/metadata.h > ============================================================================== > --- head/sys/riscv/include/metadata.h Mon Jul 6 17:47:29 2020 (r362972) > +++ head/sys/riscv/include/metadata.h Mon Jul 6 18:19:42 2020 (r362973) > @@ -30,6 +30,28 @@ > #ifndef _MACHINE_METADATA_H_ > #define _MACHINE_METADATA_H_ > > -#define MODINFOMD_DTBP 0x1001 > +#define MODINFOMD_DTBP 0x1001 > +#define MODINFOMD_EFI_MAP 0x1002 > + > +struct efi_map_header { > + size_t memory_size; > + size_t descriptor_size; > + uint32_t descriptor_version; > +}; > + > +/* > + * Placeholder for now > + */ > +struct efi_fb { > + uint64_t fb_addr; > + uint64_t fb_size; > + uint32_t fb_height; > + uint32_t fb_width; > + uint32_t fb_stride; > + uint32_t fb_mask_red; > + uint32_t fb_mask_green; > + uint32_t fb_mask_blue; > + uint32_t fb_mask_reserved; > +}; > > #endif /* !_MACHINE_METADATA_H_ */ From owner-svn-src-all@freebsd.org Mon Jul 6 18:43:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B95C136E206; Mon, 6 Jul 2020 18:43:00 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0vZr4VYYz4PSn; Mon, 6 Jul 2020 18:43:00 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EDFB22CA4; Mon, 6 Jul 2020 18:43:00 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066Ih097068505; Mon, 6 Jul 2020 18:43:00 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066Ih01S068504; Mon, 6 Jul 2020 18:43:00 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202007061843.066Ih01S068504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 6 Jul 2020 18:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362974 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 362974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 18:43:00 -0000 Author: mhorne Date: Mon Jul 6 18:43:00 2020 New Revision: 362974 URL: https://svnweb.freebsd.org/changeset/base/362974 Log: src.conf.5: regen after r362972, r362973, RISC-V EFI support Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Mon Jul 6 18:19:42 2020 (r362973) +++ head/share/man/man5/src.conf.5 Mon Jul 6 18:43:00 2020 (r362974) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd June 24, 2020 +.Dd July 6, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -585,7 +585,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -mips/mips, mips/mips64, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. +mips/mips, mips/mips64, powerpc/powerpc and powerpc/powerpc64. .It Va WITH_EFI Set to build .Xr efivar 3 @@ -593,7 +593,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP Set to not build ELF Tool Chain tools (addr2line, nm, size, strings and strip) From owner-svn-src-all@freebsd.org Mon Jul 6 20:23:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12C4D36FE34; Mon, 6 Jul 2020 20:23:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0xpV6cZCz4Wdr; Mon, 6 Jul 2020 20:23:14 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7C4D23F94; Mon, 6 Jul 2020 20:23:14 +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 066KNEI7030328; Mon, 6 Jul 2020 20:23:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066KNEdZ030327; Mon, 6 Jul 2020 20:23:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007062023.066KNEdZ030327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 20:23:14 +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: r362975 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 362975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 20:23:15 -0000 Author: markj Date: Mon Jul 6 20:23:14 2020 New Revision: 362975 URL: https://svnweb.freebsd.org/changeset/base/362975 Log: MFC r359154: Fix synchronization in the IPV6_2292PKTOPTIONS set handler. Modified: stable/11/sys/netinet6/ip6_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_output.c ============================================================================== --- stable/11/sys/netinet6/ip6_output.c Mon Jul 6 18:43:00 2020 (r362974) +++ stable/11/sys/netinet6/ip6_output.c Mon Jul 6 20:23:14 2020 (r362975) @@ -1514,8 +1514,10 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) error = soopt_mcopyin(sopt, m); /* XXX */ if (error != 0) break; + INP_WLOCK(in6p); error = ip6_pcbopts(&in6p->in6p_outputopts, m, so, sopt); + INP_WUNLOCK(in6p); m_freem(m); /* XXX */ break; } @@ -2260,8 +2262,11 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf * printf("ip6_pcbopts: all specified options are cleared.\n"); #endif ip6_clearpktopts(opt, -1); - } else - opt = malloc(sizeof(*opt), M_IP6OPT, M_WAITOK); + } else { + opt = malloc(sizeof(*opt), M_IP6OPT, M_NOWAIT); + if (opt == NULL) + return (ENOMEM); + } *pktopt = NULL; if (!m || m->m_len == 0) { From owner-svn-src-all@freebsd.org Mon Jul 6 20:54:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EC5D348A17; Mon, 6 Jul 2020 20:54:40 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0yVl6zPPz4Y7W; Mon, 6 Jul 2020 20:54:39 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jsY8M-000Ogj-BH; Mon, 06 Jul 2020 13:54:38 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 066KschI094904; Mon, 6 Jul 2020 13:54:38 -0700 (PDT) (envelope-from gonzo@freebsd.org) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@freebsd.org using -f Date: Mon, 6 Jul 2020 13:54:38 -0700 From: Oleksandr Tymoshenko To: Peter Jeremy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362736 - head/sys/arm64/rockchip Message-ID: <20200706205438.GA94576@bluezbox.com> References: <202006282111.05SLBAAq025544@repo.freebsd.org> <20200701085747.GA23928@server.rulingia.com> <20200701124738.GA30133@server.rulingia.com> <20200703002623.GA18584@bluezbox.com> <20200705000739.GE30039@server.rulingia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200705000739.GE30039@server.rulingia.com> X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Peter Jeremy (peter@rulingia.com) wrote: > On 2020-Jul-02 17:26:23 -0700, Oleksandr Tymoshenko wrote: > >Could you try kernel with this patch? It's mostly debug output, > >with one [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Rspamd-Queue-Id: 4B0yVl6zPPz4Y7W X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:14061, ipnet:45.55.0.0/19, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 20:54:40 -0000 Peter Jeremy (peter@rulingia.com) wrote: > On 2020-Jul-02 17:26:23 -0700, Oleksandr Tymoshenko wrote: > >Could you try kernel with this patch? It's mostly debug output, > >with one possible clock-related fix. > > > >https://people.freebsd.org/~gonzo/patches/rk3328-gmac-debug.patch > > It's still not working for me. I get the following: > dwc0: mem 0xff540000-0xff54ffff irq 44 on ofwbus0 > setting RK3328 RX/TX delays: 24/36 > >>> RK3328_GRF_MAC_CON1 (00000413): > >>> gmac2io_gmii_clk_sel: 0x0 > >>> gmac2io_rmii_extclk_sel: 0x1 > >>> gmac2io_rmii_mode: 0x0 > >>> gmac2io_rmii_clk_sel: 0x0 > >>> gmac2io_phy_intf_sel: 0x1 > >>> gmac2io_flowctrl: 0x0 > >>> gmac2io_rxclk_dly_ena: 0x1 > >>> gmac2io_txclk_dly_ena: 0x1 > >>> RK3328_GRF_MAC_CON0 (00000c24): > miibus0: on dwc0 > rgephy0: PHY 0 on miibus0 > rgephy0: OUI 0x00e04c, model 0x0011, rev. 6 > rgephy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto Thanks for running the test. Register values seem OK :( > >I have Rock64 v2, which, as you mentioned, has a known issue with GigE, so > >my tests are not reliable. I'll try to get another RK3328 board for tests, > >but it may take some time. > > I've asked on -arm if anyone else has tried this on a Rock64 v2 or v3. > > >If the clock fix doesn't help, I'll make > >delays configuration run-time configurable with off by default until > >more hardware is tested. > > That sounds like a good way forward - maybe boot and run-time configurable. > It's a pity that there doesn't seem to be any documentation on what the > numbers represent (or what the "default" value is) - which means that > actually adjusting the delay numbers would be very time consuming. There are no "default" values AFAIK. They depend on the board schematics. I was told that Rockhip partners use some kind of proprietary tool which they feed with values based on the scematics (like trace lengths) and tool calculates delays. With boot-time or run-time configuration I think it's possible to automate the search for good value. Something like this: https://github.com/ayufan-rock64/linux-build/blob/master/recipes/gmac-delays-test/range-test but with loader.conf modifications instead of DTB -- gonzo From owner-svn-src-all@freebsd.org Mon Jul 6 21:20:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 926CD3491A7; Mon, 6 Jul 2020 21:20:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0z563PSxz4ZmR; Mon, 6 Jul 2020 21:20:58 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56EA324912; Mon, 6 Jul 2020 21:20:58 +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 066LKw7v063633; Mon, 6 Jul 2020 21:20:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066LKwdV063632; Mon, 6 Jul 2020 21:20:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007062120.066LKwdV063632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 21:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362976 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 362976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 21:20:58 -0000 Author: markj Date: Mon Jul 6 21:20:57 2020 New Revision: 362976 URL: https://svnweb.freebsd.org/changeset/base/362976 Log: Split nhop_ref_object(). Now nhop_ref_object() unconditionally acquires a reference, and the new nhop_try_ref_object() uses refcount_acquire_if_not_zero() to conditionally acquire a reference. Since the former is cheaper, use it when we know that the initial counter value is non-zero. No functional change intended. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D25535 Modified: head/sys/net/route/nhop_ctl.c head/sys/net/route/shared.h Modified: head/sys/net/route/nhop_ctl.c ============================================================================== --- head/sys/net/route/nhop_ctl.c Mon Jul 6 20:23:14 2020 (r362975) +++ head/sys/net/route/nhop_ctl.c Mon Jul 6 21:20:57 2020 (r362976) @@ -598,10 +598,19 @@ destroy_nhop_epoch(epoch_context_t ctx) destroy_nhop(nh_priv); } -int +void nhop_ref_object(struct nhop_object *nh) { + u_int old; + old = refcount_acquire(&nh->nh_priv->nh_refcnt); + KASSERT(old > 0, ("%s: nhop object %p has 0 refs", __func__, nh)); +} + +int +nhop_try_ref_object(struct nhop_object *nh) +{ + return (refcount_acquire_if_not_zero(&nh->nh_priv->nh_refcnt)); } @@ -654,7 +663,7 @@ int nhop_ref_any(struct nhop_object *nh) { - return (nhop_ref_object(nh)); + return (nhop_try_ref_object(nh)); } void Modified: head/sys/net/route/shared.h ============================================================================== --- head/sys/net/route/shared.h Mon Jul 6 20:23:14 2020 (r362975) +++ head/sys/net/route/shared.h Mon Jul 6 21:20:57 2020 (r362976) @@ -51,7 +51,8 @@ struct rib_head; void nhops_init(void); int nhops_init_rib(struct rib_head *rh); void nhops_destroy_rib(struct rib_head *rh); -int nhop_ref_object(struct nhop_object *nh); +void nhop_ref_object(struct nhop_object *nh); +int nhop_try_ref_object(struct nhop_object *nh); int nhop_ref_any(struct nhop_object *nh); void nhop_free_any(struct nhop_object *nh); From owner-svn-src-all@freebsd.org Mon Jul 6 21:29:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A5E03492D1; Mon, 6 Jul 2020 21:29:51 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0zHL6V1Pz4Zy6; Mon, 6 Jul 2020 21:29:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A811C24A27; Mon, 6 Jul 2020 21:29:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066LToVf067105; Mon, 6 Jul 2020 21:29:50 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066LToSl067104; Mon, 6 Jul 2020 21:29:50 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202007062129.066LToSl067104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Mon, 6 Jul 2020 21:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362977 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 362977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 21:29:51 -0000 Author: kp Date: Mon Jul 6 21:29:50 2020 New Revision: 362977 URL: https://svnweb.freebsd.org/changeset/base/362977 Log: riscv plic: Do not complete interrupts until the interrupt handler has run We cannot complete the interrupt (i.e. write to the claims/complete register until the interrupt handler has actually run. We don't run the interrupt handler immediately from intr_isrc_dispatch(), we only schedule it for later execution. If we immediately complete it (i.e. before the interrupt handler proper has run) the interrupt may be triggered again if the interrupt source remains set. From RISC-V Instruction Set Manual: Volume II: Priviliged Architecture, 7.4 Interrupt Gateways: "If a level-sensitive interrupt source deasserts the interrupt after the PLIC core accepts the request and before the interrupt is serviced, the interrupt request remains present in the IP bit of the PLIC core and will be serviced by a handler, which will then have to determine that the interrupt device no longer requires service." In other words, we may receive interrupts twice. Avoid that by postponing the completion until after the interrupt handler has run. If the interrupt is handled by a filter rather than by scheduling an interrupt thread we must also complete the interrupt, so set up a post_filter handler (which is the same as the post_ithread handler). Reviewed by: mhorne Sponsored by: Axiado Differential Revision: https://reviews.freebsd.org/D25531 Modified: head/sys/riscv/riscv/plic.c Modified: head/sys/riscv/riscv/plic.c ============================================================================== --- head/sys/riscv/riscv/plic.c Mon Jul 6 21:20:57 2020 (r362976) +++ head/sys/riscv/riscv/plic.c Mon Jul 6 21:29:50 2020 (r362977) @@ -169,11 +169,11 @@ plic_intr(void *arg) sc = arg; cpu = PCPU_GET(cpuid); + /* Claim any pending interrupt. */ pending = RD4(sc, PLIC_CLAIM(sc, cpu)); if (pending) { tf = curthread->td_intr_frame; plic_irq_dispatch(sc, pending, tf); - WR4(sc, PLIC_CLAIM(sc, cpu), pending); } return (FILTER_HANDLED); @@ -384,7 +384,17 @@ plic_pre_ithread(device_t dev, struct intr_irqsrc *isr static void plic_post_ithread(device_t dev, struct intr_irqsrc *isrc) { + struct plic_softc *sc; + struct plic_irqsrc *src; + uint32_t cpu; + sc = device_get_softc(dev); + src = (struct plic_irqsrc *)isrc; + + cpu = CPU_FFS(&isrc->isrc_cpu) - 1; + + /* Complete the interrupt. */ + WR4(sc, PLIC_CLAIM(sc, cpu), src->irq); plic_enable_intr(dev, isrc); } @@ -451,6 +461,7 @@ static device_method_t plic_methods[] = { DEVMETHOD(pic_map_intr, plic_map_intr), DEVMETHOD(pic_pre_ithread, plic_pre_ithread), DEVMETHOD(pic_post_ithread, plic_post_ithread), + DEVMETHOD(pic_post_filter, plic_post_ithread), DEVMETHOD(pic_setup_intr, plic_setup_intr), DEVMETHOD(pic_bind_intr, plic_bind_intr), From owner-svn-src-all@freebsd.org Mon Jul 6 21:39:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 054BA3495FE; Mon, 6 Jul 2020 21:39:15 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0zVB6KJNz4brx; Mon, 6 Jul 2020 21:39:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8A6224AC8; Mon, 6 Jul 2020 21:39:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066LdEKd073620; Mon, 6 Jul 2020 21:39:14 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066LdE5b073619; Mon, 6 Jul 2020 21:39:14 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202007062139.066LdE5b073619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 6 Jul 2020 21:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362978 - head/stand X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 362978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 21:39:15 -0000 Author: mhorne Date: Mon Jul 6 21:39:14 2020 New Revision: 362978 URL: https://svnweb.freebsd.org/changeset/base/362978 Log: Fix cleandir target post r362973 Reported by: mmacy Modified: head/stand/defs.mk Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Mon Jul 6 21:29:50 2020 (r362977) +++ head/stand/defs.mk Mon Jul 6 21:39:14 2020 (r362978) @@ -151,7 +151,7 @@ CFLAGS+= -fPIC # Some RISC-V linkers have support for relaxations, while some (lld) do not # yet. If this is the case we inhibit the compiler from emitting relaxations. -.if ${LINKER_FEATURES:Mriscv-relaxations} == "" +.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" CFLAGS+= -mno-relax .endif From owner-svn-src-all@freebsd.org Mon Jul 6 22:39:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B1E134A933; Mon, 6 Jul 2020 22:39:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B10qz1rhxz4fgV; Mon, 6 Jul 2020 22:39:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22A6E257A3; Mon, 6 Jul 2020 22:39:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066MdhIq011218; Mon, 6 Jul 2020 22:39:43 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066MdgeD011217; Mon, 6 Jul 2020 22:39:42 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202007062239.066MdgeD011217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 6 Jul 2020 22:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362979 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Commit-Revision: 362979 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 06 Jul 2020 22:39:43 -0000 Author: brooks Date: Mon Jul 6 22:39:42 2020 New Revision: 362979 URL: https://svnweb.freebsd.org/changeset/base/362979 Log: Fix a Wvoid-pointer-to-enum-cast warning missed in r359978. This pattern is used in callbacks with void * data arguments and seems both relatively uncommon and relatively harmless. Silence the warning by casting through uintptr_t. This warning is on by default in Clang 11. MFC after: 3 days Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24425 Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Mon Jul 6 21:39:14 2020 (r362978) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Mon Jul 6 22:39:42 2020 (r362979) @@ -179,7 +179,7 @@ int iidesc_count_type(void *data, void *private) { iidesc_t *ii = data; - iitype_t match = (iitype_t)private; + iitype_t match = (iitype_t)(uintptr_t)private; return (ii->ii_type == match); } From owner-svn-src-all@freebsd.org Tue Jul 7 00:42:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CF4434DD03; Tue, 7 Jul 2020 00:42:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B13YX0RFhz3X1h; Tue, 7 Jul 2020 00:42:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E650026B5D; Tue, 7 Jul 2020 00:42:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0670gNYG090085; Tue, 7 Jul 2020 00:42:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0670gNpp090084; Tue, 7 Jul 2020 00:42:23 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007070042.0670gNpp090084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 7 Jul 2020 00:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362980 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 362980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 07 Jul 2020 00:42:24 -0000 Author: rmacklem Date: Tue Jul 7 00:42:23 2020 New Revision: 362980 URL: https://svnweb.freebsd.org/changeset/base/362980 Log: Add support for ext_pgs mbufs to nfsrvd_rephead(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Modified: head/sys/fs/nfs/nfs_commonsubs.c Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Mon Jul 6 22:39:42 2020 (r362979) +++ head/sys/fs/nfs/nfs_commonsubs.c Tue Jul 7 00:42:23 2020 (r362980) @@ -4443,21 +4443,30 @@ nfsrvd_rephead(struct nfsrv_descript *nd) { struct mbuf *mreq; - /* - * If this is a big reply, use a cluster. - */ - if ((nd->nd_flag & ND_GSSINITREPLY) == 0 && - nfs_bigreply[nd->nd_procnum]) { - NFSMCLGET(mreq, M_WAITOK); - nd->nd_mreq = mreq; - nd->nd_mb = mreq; + if ((nd->nd_flag & ND_EXTPG) != 0) { + mreq = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); + nd->nd_mreq = nd->nd_mb = mreq; + nd->nd_bpos = (char *)(void *) + PHYS_TO_DMAP(mreq->m_epg_pa[0]); + nd->nd_bextpg = 0; + nd->nd_bextpgsiz = PAGE_SIZE; } else { - NFSMGET(mreq); - nd->nd_mreq = mreq; - nd->nd_mb = mreq; + /* + * If this is a big reply, use a cluster. + */ + if ((nd->nd_flag & ND_GSSINITREPLY) == 0 && + nfs_bigreply[nd->nd_procnum]) { + NFSMCLGET(mreq, M_WAITOK); + nd->nd_mreq = mreq; + nd->nd_mb = mreq; + } else { + NFSMGET(mreq); + nd->nd_mreq = mreq; + nd->nd_mb = mreq; + } + nd->nd_bpos = mtod(mreq, char *); + mreq->m_len = 0; } - nd->nd_bpos = mtod(mreq, caddr_t); - mreq->m_len = 0; if ((nd->nd_flag & ND_GSSINITREPLY) == 0) NFSM_BUILD(nd->nd_errp, int *, NFSX_UNSIGNED); From owner-svn-src-all@freebsd.org Tue Jul 7 02:41:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB602350CAB; Tue, 7 Jul 2020 02:41:51 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B16CM5WPKz3dNl; Tue, 7 Jul 2020 02:41:51 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0A9C8784; Tue, 7 Jul 2020 02:41:51 +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 0672fpah063698; Tue, 7 Jul 2020 02:41:51 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0672fpNo063696; Tue, 7 Jul 2020 02:41:51 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202007070241.0672fpNo063696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 7 Jul 2020 02:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362981 - in head: . share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head: . share/man/man9 X-SVN-Commit-Revision: 362981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 07 Jul 2020 02:41:51 -0000 Author: glebius Date: Tue Jul 7 02:41:51 2020 New Revision: 362981 URL: https://svnweb.freebsd.org/changeset/base/362981 Log: Fixup for r360574: install new mlinks for sglist(9) and remove old ones. Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Jul 7 00:42:23 2020 (r362980) +++ head/ObsoleteFiles.inc Tue Jul 7 02:41:51 2020 (r362981) @@ -36,6 +36,12 @@ # xargs -n1 | sort | uniq -d; # done +# 20200706: update of sglist(9), r360574 +OLD_FILES+=usr/share/man/man9/sglist_append_ext_pgs.9 +OLD_FILES+=usr/share/man/man9/sglist_append_mb_ext_pgs.9 +OLD_FILES+=usr/share/man/man9/sglist_count_ext_pgs.9 +OLD_FILES+=usr/share/man/man9/sglist_count_mb_ext_pgs.9 + # 20200617: update opencsd to 0.14.2 OLD_FILES+=usr/include/opencsd/etmv4/trc_pkt_elem_etmv4d.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Jul 7 00:42:23 2020 (r362980) +++ head/share/man/man9/Makefile Tue Jul 7 02:41:51 2020 (r362981) @@ -1902,9 +1902,8 @@ MLINKS+=sf_buf.9 sf_buf_alloc.9 \ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_append.9 \ sglist.9 sglist_append_bio.9 \ - sglist.9 sglist_append_ext_pgs.9 \ - sglist.9 sglist_append_mb_ext_pgs.9 \ sglist.9 sglist_append_mbuf.9 \ + sglist.9 sglist_append_mbuf_epg.9 \ sglist.9 sglist_append_phys.9 \ sglist.9 sglist_append_sglist.9 \ sglist.9 sglist_append_uio.9 \ @@ -1914,8 +1913,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_clone.9 \ sglist.9 sglist_consume_uio.9 \ sglist.9 sglist_count.9 \ - sglist.9 sglist_count_ext_pgs.9 \ - sglist.9 sglist_count_mb_ext_pgs.9 \ + sglist.9 sglist_count_mbuf_epg.9 \ sglist.9 sglist_count_vmpages.9 \ sglist.9 sglist_free.9 \ sglist.9 sglist_hold.9 \ From owner-svn-src-all@freebsd.org Tue Jul 7 02:43:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2B6E350EC9; Tue, 7 Jul 2020 02:43:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B16Fk3sx1z3f0V; Tue, 7 Jul 2020 02:43:54 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 695058374; Tue, 7 Jul 2020 02:43:54 +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 0672hsKq063827; Tue, 7 Jul 2020 02:43:54 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0672hsf8063826; Tue, 7 Jul 2020 02:43:54 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202007070243.0672hsf8063826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 7 Jul 2020 02:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362982 - head X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 362982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 07 Jul 2020 02:43:54 -0000 Author: glebius Date: Tue Jul 7 02:43:53 2020 New Revision: 362982 URL: https://svnweb.freebsd.org/changeset/base/362982 Log: Fixup r362981: remove gzipped manual pages. Pointy hat to: glebius Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Jul 7 02:41:51 2020 (r362981) +++ head/ObsoleteFiles.inc Tue Jul 7 02:43:53 2020 (r362982) @@ -37,10 +37,10 @@ # done # 20200706: update of sglist(9), r360574 -OLD_FILES+=usr/share/man/man9/sglist_append_ext_pgs.9 -OLD_FILES+=usr/share/man/man9/sglist_append_mb_ext_pgs.9 -OLD_FILES+=usr/share/man/man9/sglist_count_ext_pgs.9 -OLD_FILES+=usr/share/man/man9/sglist_count_mb_ext_pgs.9 +OLD_FILES+=usr/share/man/man9/sglist_append_ext_pgs.9.gz +OLD_FILES+=usr/share/man/man9/sglist_append_mb_ext_pgs.9.gz +OLD_FILES+=usr/share/man/man9/sglist_count_ext_pgs.9.gz +OLD_FILES+=usr/share/man/man9/sglist_count_mb_ext_pgs.9.gz # 20200617: update opencsd to 0.14.2 OLD_FILES+=usr/include/opencsd/etmv4/trc_pkt_elem_etmv4d.h From owner-svn-src-all@freebsd.org Tue Jul 7 06:04:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7625356CED; Tue, 7 Jul 2020 06:04:21 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B1Bj15wLdz46gl; Tue, 7 Jul 2020 06:04:21 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF84DAB45; Tue, 7 Jul 2020 06:04:21 +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 06764LjS089732; Tue, 7 Jul 2020 06:04:21 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06764Ls7089731; Tue, 7 Jul 2020 06:04:21 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202007070604.06764Ls7089731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 7 Jul 2020 06:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362983 - stable/12/share/man/man7 X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/share/man/man7 X-SVN-Commit-Revision: 362983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 07 Jul 2020 06:04:22 -0000 Author: lwhsu Date: Tue Jul 7 06:04:21 2020 New Revision: 362983 URL: https://svnweb.freebsd.org/changeset/base/362983 Log: MFC r362539: Mention CI system information in development(7) Approved by: 0mp, bcr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25340 Modified: stable/12/share/man/man7/development.7 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man7/development.7 ============================================================================== --- stable/12/share/man/man7/development.7 Tue Jul 7 02:43:53 2020 (r362982) +++ stable/12/share/man/man7/development.7 Tue Jul 7 06:04:21 2020 (r362983) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2018 +.Dd June 23, 2020 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -103,6 +103,14 @@ suggest improvements, and, eventually, allows them to commit it: .Pp .Lk https://reviews.FreeBSD.org/ +.Pp +To check the latest +.Fx +build and test status of CURRENT and STABLE branches, +the continuous integration system is at: +.Pp +.Lk https://ci.FreeBSD.org +.Pp .Sh EXAMPLES Check out the CURRENT branch, build it, and install, overwriting the current system: From owner-svn-src-all@freebsd.org Tue Jul 7 07:02:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE771357E2B; Tue, 7 Jul 2020 07:02:39 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B1D0H6JFWz498Q; Tue, 7 Jul 2020 07:02:39 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBC65BADF; Tue, 7 Jul 2020 07:02:39 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06772d3j025904; Tue, 7 Jul 2020 07:02:39 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06772XFl025873; Tue, 7 Jul 2020 07:02:33 GMT (envelope-from se@FreeBSD.org) Message-Id: <202007070702.06772XFl025873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Tue, 7 Jul 2020 07:02:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r362984 - in vendor/bc/dist: . gen include locales manuals manuals/bc manuals/dc src src/bc src/dc src/history src/rand tests tests/bc tests/bc/errors tests/dc tests/dc/errors X-SVN-Group: vendor X-SVN-Commit-Author: se X-SVN-Commit-Paths: in vendor/bc/dist: . gen include locales manuals manuals/bc manuals/dc src src/bc src/dc src/history src/rand tests tests/bc tests/bc/errors tests/dc tests/dc/errors X-SVN-Commit-Revision: 362984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 07 Jul 2020 07:02:40 -0000 Author: se Date: Tue Jul 7 07:02:33 2020 New Revision: 362984 URL: https://svnweb.freebsd.org/changeset/base/362984 Log: Update to release 3.1.1 This release fixes a regression from traditional bc behavior in FreeBSD with regard to "-e quit" being passed on the command line and add Spanish message catalogs. Added: vendor/bc/dist/locales/es_ES.ISO8859-1.msg vendor/bc/dist/locales/es_ES.ISO8859-15.msg (contents, props changed) vendor/bc/dist/manuals/bc/ vendor/bc/dist/manuals/bc.1.md.in (contents, props changed) vendor/bc/dist/manuals/bc/A.1 (contents, props changed) vendor/bc/dist/manuals/bc/A.1.md vendor/bc/dist/manuals/bc/E.1 (contents, props changed) vendor/bc/dist/manuals/bc/E.1.md vendor/bc/dist/manuals/bc/EH.1 (contents, props changed) vendor/bc/dist/manuals/bc/EH.1.md vendor/bc/dist/manuals/bc/EHN.1 (contents, props changed) vendor/bc/dist/manuals/bc/EHN.1.md vendor/bc/dist/manuals/bc/EHNP.1 (contents, props changed) vendor/bc/dist/manuals/bc/EHNP.1.md vendor/bc/dist/manuals/bc/EHP.1 (contents, props changed) vendor/bc/dist/manuals/bc/EHP.1.md vendor/bc/dist/manuals/bc/EN.1 (contents, props changed) vendor/bc/dist/manuals/bc/EN.1.md vendor/bc/dist/manuals/bc/ENP.1 (contents, props changed) vendor/bc/dist/manuals/bc/ENP.1.md vendor/bc/dist/manuals/bc/EP.1 (contents, props changed) vendor/bc/dist/manuals/bc/EP.1.md vendor/bc/dist/manuals/bc/H.1 (contents, props changed) vendor/bc/dist/manuals/bc/H.1.md vendor/bc/dist/manuals/bc/HN.1 (contents, props changed) vendor/bc/dist/manuals/bc/HN.1.md vendor/bc/dist/manuals/bc/HNP.1 (contents, props changed) vendor/bc/dist/manuals/bc/HNP.1.md vendor/bc/dist/manuals/bc/HP.1 (contents, props changed) vendor/bc/dist/manuals/bc/HP.1.md vendor/bc/dist/manuals/bc/N.1 (contents, props changed) vendor/bc/dist/manuals/bc/N.1.md vendor/bc/dist/manuals/bc/NP.1 (contents, props changed) vendor/bc/dist/manuals/bc/NP.1.md vendor/bc/dist/manuals/bc/P.1 (contents, props changed) vendor/bc/dist/manuals/bc/P.1.md vendor/bc/dist/manuals/dc/ vendor/bc/dist/manuals/dc.1.md.in (contents, props changed) vendor/bc/dist/manuals/dc/A.1 (contents, props changed) vendor/bc/dist/manuals/dc/A.1.md vendor/bc/dist/manuals/dc/E.1 (contents, props changed) vendor/bc/dist/manuals/dc/E.1.md vendor/bc/dist/manuals/dc/EH.1 (contents, props changed) vendor/bc/dist/manuals/dc/EH.1.md vendor/bc/dist/manuals/dc/EHN.1 (contents, props changed) vendor/bc/dist/manuals/dc/EHN.1.md vendor/bc/dist/manuals/dc/EHNP.1 (contents, props changed) vendor/bc/dist/manuals/dc/EHNP.1.md vendor/bc/dist/manuals/dc/EHP.1 (contents, props changed) vendor/bc/dist/manuals/dc/EHP.1.md vendor/bc/dist/manuals/dc/EN.1 (contents, props changed) vendor/bc/dist/manuals/dc/EN.1.md vendor/bc/dist/manuals/dc/ENP.1 (contents, props changed) vendor/bc/dist/manuals/dc/ENP.1.md vendor/bc/dist/manuals/dc/EP.1 (contents, props changed) vendor/bc/dist/manuals/dc/EP.1.md vendor/bc/dist/manuals/dc/H.1 (contents, props changed) vendor/bc/dist/manuals/dc/H.1.md vendor/bc/dist/manuals/dc/HN.1 (contents, props changed) vendor/bc/dist/manuals/dc/HN.1.md vendor/bc/dist/manuals/dc/HNP.1 (contents, props changed) vendor/bc/dist/manuals/dc/HNP.1.md vendor/bc/dist/manuals/dc/HP.1 (contents, props changed) vendor/bc/dist/manuals/dc/HP.1.md vendor/bc/dist/manuals/dc/N.1 (contents, props changed) vendor/bc/dist/manuals/dc/N.1.md vendor/bc/dist/manuals/dc/NP.1 (contents, props changed) vendor/bc/dist/manuals/dc/NP.1.md vendor/bc/dist/manuals/dc/P.1 (contents, props changed) vendor/bc/dist/manuals/dc/P.1.md vendor/bc/dist/tests/bc/errors/23.txt (contents, props changed) vendor/bc/dist/tests/bc/errors/24.txt (contents, props changed) vendor/bc/dist/tests/dc/errors/25.txt (contents, props changed) vendor/bc/dist/tests/dc/errors/26.txt (contents, props changed) vendor/bc/dist/tests/dc/errors/27.txt (contents, props changed) vendor/bc/dist/tests/dc/errors/28.txt (contents, props changed) vendor/bc/dist/tests/dc/errors/29.txt (contents, props changed) Deleted: vendor/bc/dist/TODO.md vendor/bc/dist/manuals/bc.1 vendor/bc/dist/manuals/bc.1.ronn vendor/bc/dist/manuals/bc.md vendor/bc/dist/manuals/dc.1 vendor/bc/dist/manuals/dc.1.ronn vendor/bc/dist/manuals/dc.md Modified: vendor/bc/dist/.gitignore vendor/bc/dist/LICENSE.md vendor/bc/dist/Makefile.in vendor/bc/dist/NEWS.md vendor/bc/dist/README.md vendor/bc/dist/configure.sh vendor/bc/dist/functions.sh vendor/bc/dist/gen/bc_help.txt vendor/bc/dist/gen/dc_help.txt vendor/bc/dist/gen/lib.bc vendor/bc/dist/gen/lib2.bc vendor/bc/dist/gen/strgen.c vendor/bc/dist/gen/strgen.sh vendor/bc/dist/include/args.h vendor/bc/dist/include/bc.h vendor/bc/dist/include/dc.h vendor/bc/dist/include/file.h vendor/bc/dist/include/history.h vendor/bc/dist/include/lang.h vendor/bc/dist/include/lex.h vendor/bc/dist/include/num.h vendor/bc/dist/include/opt.h vendor/bc/dist/include/parse.h vendor/bc/dist/include/program.h vendor/bc/dist/include/rand.h vendor/bc/dist/include/read.h vendor/bc/dist/include/status.h vendor/bc/dist/include/vector.h vendor/bc/dist/include/vm.h vendor/bc/dist/install.sh vendor/bc/dist/karatsuba.py vendor/bc/dist/link.sh vendor/bc/dist/locale_install.sh vendor/bc/dist/locale_uninstall.sh vendor/bc/dist/locales/de_DE.ISO8859-1.msg vendor/bc/dist/locales/de_DE.UTF-8.msg vendor/bc/dist/locales/en_US.msg vendor/bc/dist/locales/es_ES.UTF-8.msg vendor/bc/dist/locales/fr_FR.ISO8859-1.msg vendor/bc/dist/locales/fr_FR.UTF-8.msg vendor/bc/dist/locales/ja_JP.UTF-8.msg vendor/bc/dist/locales/ja_JP.eucJP.msg vendor/bc/dist/locales/nl_NL.ISO8859-1.msg vendor/bc/dist/locales/nl_NL.UTF-8.msg vendor/bc/dist/locales/pl_PL.ISO8859-2.msg vendor/bc/dist/locales/pl_PL.UTF-8.msg vendor/bc/dist/locales/pt_PT.ISO8859-1.msg vendor/bc/dist/locales/pt_PT.UTF-8.msg vendor/bc/dist/locales/ru_RU.CP1251.msg vendor/bc/dist/locales/ru_RU.CP866.msg vendor/bc/dist/locales/ru_RU.ISO8859-5.msg vendor/bc/dist/locales/ru_RU.KOI8-R.msg vendor/bc/dist/locales/ru_RU.UTF-8.msg vendor/bc/dist/locales/zh_CN.GB18030.msg vendor/bc/dist/locales/zh_CN.GB2312.msg vendor/bc/dist/locales/zh_CN.GBK.msg vendor/bc/dist/locales/zh_CN.UTF-8.msg vendor/bc/dist/locales/zh_CN.eucCN.msg vendor/bc/dist/manpage.sh vendor/bc/dist/manuals/build.md vendor/bc/dist/release.sh vendor/bc/dist/src/args.c vendor/bc/dist/src/bc/bc.c vendor/bc/dist/src/bc/lex.c vendor/bc/dist/src/bc/parse.c vendor/bc/dist/src/data.c vendor/bc/dist/src/dc/dc.c vendor/bc/dist/src/dc/lex.c vendor/bc/dist/src/dc/parse.c vendor/bc/dist/src/file.c vendor/bc/dist/src/history/history.c vendor/bc/dist/src/lang.c vendor/bc/dist/src/lex.c vendor/bc/dist/src/main.c vendor/bc/dist/src/num.c vendor/bc/dist/src/opt.c vendor/bc/dist/src/parse.c vendor/bc/dist/src/program.c vendor/bc/dist/src/rand/rand.c vendor/bc/dist/src/read.c vendor/bc/dist/src/vector.c vendor/bc/dist/src/vm.c vendor/bc/dist/tests/afl.py vendor/bc/dist/tests/all.sh vendor/bc/dist/tests/bc/misc2.txt vendor/bc/dist/tests/bc/misc2_results.txt vendor/bc/dist/tests/bc/timeconst.sh vendor/bc/dist/tests/dc/stdin.txt vendor/bc/dist/tests/dc/stdin_results.txt vendor/bc/dist/tests/errors.sh vendor/bc/dist/tests/radamsa.sh vendor/bc/dist/tests/randmath.py vendor/bc/dist/tests/read.sh vendor/bc/dist/tests/script.sh vendor/bc/dist/tests/scripts.sh vendor/bc/dist/tests/stdin.sh vendor/bc/dist/tests/test.sh Directory Properties: vendor/bc/dist/ (props changed) vendor/bc/dist/manuals/ (props changed) Modified: vendor/bc/dist/.gitignore ============================================================================== --- vendor/bc/dist/.gitignore Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/.gitignore Tue Jul 7 07:02:33 2020 (r362984) @@ -17,6 +17,12 @@ bc.old .math.txt .results.txt .ops.txt +manuals/bc.1 +manuals/bc.1.ronn +manuals/bc.1.md +manuals/dc.1 +manuals/dc.1.ronn +manuals/dc.1.md gen/strgen lib.c lib2.c Modified: vendor/bc/dist/LICENSE.md ============================================================================== --- vendor/bc/dist/LICENSE.md Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/LICENSE.md Tue Jul 7 07:02:33 2020 (r362984) @@ -2,8 +2,6 @@ Copyright (c) 2018-2020 Gavin D. Howard -All rights reserved. - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -34,8 +32,6 @@ Copyright (c) 2010-2014, Salvatore Sanfilippo
Copyright (c) 2018 rain-1
Copyright (c) 2018-2020, Gavin D. Howard - -All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/Makefile.in ============================================================================== --- vendor/bc/dist/Makefile.in Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/Makefile.in Tue Jul 7 07:02:33 2020 (r362984) @@ -1,8 +1,8 @@ # +# SPDX-License-Identifier: BSD-2-Clause +# # Copyright (c) 2018-2020 Gavin D. Howard and contributors. # -# All rights reserved. -# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.0.2 +VERSION = 3.1.1 SRC = %%SRC%% OBJ = %%OBJ%% @@ -105,10 +105,10 @@ DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) MANUALS = manuals BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1 BC_MANPAGE = $(MANUALS)/$(BC).1 -BC_RONN = $(BC_MANPAGE).ronn +BC_MD = $(BC_MANPAGE).md DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1 DC_MANPAGE = $(MANUALS)/$(DC).1 -DC_RONN = $(DC_MANPAGE).ronn +DC_MD = $(DC_MANPAGE).md MANPAGE_INSTALL_ARGS = -Dm644 @@ -270,8 +270,8 @@ extra_math: @printf '%s' "$(BC_ENABLE_EXTRA_MATH)" manpages: - $(MANPAGE) $(BC_RONN) $(BC_MANPAGE) - $(MANPAGE) $(DC_RONN) $(DC_MANPAGE) + $(MANPAGE) bc + $(MANPAGE) dc clean_gen: @$(RM) -f $(GEN_EXEC) @@ -295,6 +295,8 @@ clean:%%CLEAN_PREREQS%% clean_config: clean @printf 'Cleaning config...\n' @$(RM) -f Makefile + @$(RM) -f $(BC_MD) $(DC_MD) + @$(RM) -f $(BC_MANPAGE) $(DC_MANPAGE) clean_coverage: @printf 'Cleaning coverage files...\n' Modified: vendor/bc/dist/NEWS.md ============================================================================== --- vendor/bc/dist/NEWS.md Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/NEWS.md Tue Jul 7 07:02:33 2020 (r362984) @@ -1,5 +1,54 @@ # News +## 3.1.1 + +This is a production release that adds two Spanish locales. Users do ***NOT*** +need to upgrade, unless they want those locales. + +## 3.1.0 + +This is a production release that adjusts one behavior, fixes eight bugs, and +improves manpages for FreeBSD. Because this release fixes bugs, **users and +package maintainers should update to this version as soon as possible**. + +The behavior that was adjusted was how code from the `-e` and `-f` arguments +(and equivalents) were executed. They used to be executed as one big chunk, but +in this release, they are now executed line-by-line. + +The first bug fix in how output to `stdout` was handled in `SIGINT`. If a +`SIGINT` came in, the `stdout` buffer was not correctly flushed. In fact, a +clean-up function was not getting called. This release fixes that bug. + +The second bug is in how `dc` handled input from `stdin`. This affected `bc` as +well since it was a mishandling of the `stdin` buffer. + +The third fixed bug was that `bc` and `dc` could `abort()` (in debug mode) when +receiving a `SIGTERM`. This one was a race condition with pushing and popping +items onto and out of vectors. + +The fourth bug fixed was that `bc` could leave extra items on the stack and +thus, not properly clean up some memory. (The memory would still get +`free()`'ed, but it would not be `free()`'ed when it could have been.) + +The next two bugs were bugs in `bc`'s parser that caused crashes when executing +the resulting code. + +The last two bugs were crashes in `dc` that resulted from mishandling of +strings. + +The manpage improvement was done by switching from [ronn][20] to [Pandoc][21] to +generate manpages. Pandoc generates much cleaner manpages and doesn't leave +blank lines where they shouldn't be. + +## 3.0.3 + +This is a production release that adds one new feature: specific manpages. + +Before this release, `bc` and `dc` only used one manpage each that referred to +various build options. This release changes it so there is one manpage set per +relevant build type. Each manual only has information about its particular +build, and `configure.sh` selects the correct set for install. + ## 3.0.2 This is a production release that adds `utf8` locale symlinks and removes an @@ -32,8 +81,9 @@ global ones that are already installed, so it will use running tests during install. **If `bc` segfaults while running arg tests when updating, it is because the global locale files have not been replaced. Make sure to either prevent the test suite from running on update or remove the old -locale files before updating.** Once this is done, `bc` should install without -problems.* +locale files before updating.** (Removing the locale files can be done with +`make uninstall` or by running the `locale_uninstall.sh` script.) Once this is +done, `bc` should install without problems.* *Second, **the option to build without signal support has been removed**. See below for the reasons why.* @@ -811,14 +861,16 @@ not thoroughly tested. [6]: ./configure.sh [7]: https://github.com/rain-1/linenoise-mob [8]: https://github.com/antirez/linenoise -[9]: ./manuals/bc.1.ronn -[10]: ./manuals/dc.1.ronn +[9]: ./manuals/bc/A.1.md +[10]: ./manuals/dc/A.1.md [11]: https://scan.coverity.com/projects/gavinhoward-bc [12]: ./locale_install.sh [13]: ./manuals/build.md [14]: https://github.com/stesser [15]: https://github.com/bugcrazy -[16]: ./manuals/bc.1.ronn#extended-library +[16]: ./manuals/bc/A.1.md#extended-library [17]: https://github.com/skeeto/optparse [18]: https://www.deepl.com/translator [19]: ./manuals/benchmarks.md +[20]: https://github.com/apjanke/ronn-ng +[21]: https://pandoc.org/ Modified: vendor/bc/dist/README.md ============================================================================== --- vendor/bc/dist/README.md Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/README.md Tue Jul 7 07:02:33 2020 (r362984) @@ -11,7 +11,7 @@ This is an implementation of the [POSIX `bc` calculato [GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD flavor of `bc`. -For more information, see this `bc`'s [full manual][2]. +For more information, see this `bc`'s full manual. This `bc` also includes an implementation of `dc` in the same binary, accessible via a symbolic link, which implements all FreeBSD and GNU extensions. (If a @@ -19,7 +19,7 @@ standalone `dc` binary is desired, `bc` can be copied `!` command is omitted; I believe this poses security concerns and that such functionality is unnecessary. -For more information, see the `dc`'s [full manual][3]. +For more information, see the `dc`'s full manual. This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD 2-clause License. Full license text may be found in the [`LICENSE.md`][4] file. @@ -39,7 +39,7 @@ Systems that are known to work: * OpenBSD * NetBSD * Mac OSX -* Solaris +* Solaris* (as long as the Solaris version supports POSIX 2008) * AIX Please submit bug reports if this `bc` does not build out of the box on any @@ -261,6 +261,10 @@ Other projects based on this bc are: * [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the toybox `bc` should be reported there. +* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better + to report bugs there, and the maintainers of the package will contact me if + necessary. + ## Language This `bc` is written in pure ISO C99, using POSIX 2008 APIs. @@ -293,7 +297,7 @@ Files: locale_install.sh A script to install locales, if desired. locale_uninstall.sh A script to uninstall locales. Makefile.in The Makefile template. - manpage.sh Script to generate man pages from ronn files. + manpage.sh Script to generate man pages from markdown files. NOTICE.md List of contributors and copyright owners. RELEASE.md A checklist for making a release (maintainer use only). release.sh A script to test for release (maintainer use only). @@ -309,8 +313,6 @@ Folders: tests All tests. [1]: https://www.gnu.org/software/bc/ -[2]: ./manuals/bc.md -[3]: ./manuals/dc.md [4]: ./LICENSE.md [5]: ./manuals/build.md [6]: https://pkg.musl.cc/bc/ @@ -330,3 +332,4 @@ Folders: [20]: https://git.yzena.com/gavin/bc [21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ [22]: https://www.deepl.com/translator +[23]: https://github.com/freebsd/freebsd/tree/master/contrib/bc Modified: vendor/bc/dist/configure.sh ============================================================================== --- vendor/bc/dist/configure.sh Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/configure.sh Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ #! /bin/sh # +# SPDX-License-Identifier: BSD-2-Clause +# # Copyright (c) 2018-2020 Gavin D. Howard and contributors. # -# All rights reserved. -# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -808,6 +808,28 @@ else fi fi +manpage_args="" + +if [ "$extra_math" -eq 0 ]; then + manpage_args="E" +fi + +if [ "$hist" -eq 0 ]; then + manpage_args="${manpage_args}H" +fi + +if [ "$nls" -eq 0 ]; then + manpage_args="${manpage_args}N" +fi + +if [ "$prompt" -eq 0 ]; then + manpage_args="${manpage_args}P" +fi + +if [ "$manpage_args" = "" ]; then + manpage_args="A" +fi + # Print out the values; this is for debugging. if [ "$bc" -ne 0 ]; then printf 'Building bc\n' @@ -923,5 +945,10 @@ contents=$(replace "$contents" "GEN_EMU" "$GEN_EMU") printf '%s\n' "$contents" > "$scriptdir/Makefile" cd "$scriptdir" + +cp -f manuals/bc/$manpage_args.1.md manuals/bc.1.md +cp -f manuals/bc/$manpage_args.1 manuals/bc.1 +cp -f manuals/dc/$manpage_args.1.md manuals/dc.1.md +cp -f manuals/dc/$manpage_args.1 manuals/dc.1 make clean > /dev/null Modified: vendor/bc/dist/functions.sh ============================================================================== --- vendor/bc/dist/functions.sh Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/functions.sh Tue Jul 7 07:02:33 2020 (r362984) @@ -1,8 +1,8 @@ #! /bin/sh # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# SPDX-License-Identifier: BSD-2-Clause # -# All rights reserved. +# Copyright (c) 2018-2020 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/gen/bc_help.txt ============================================================================== --- vendor/bc/dist/gen/bc_help.txt Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/gen/bc_help.txt Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -58,6 +58,8 @@ This bc has three differences to the GNU bc: 3) This bc has many more extensions than the GNU bc does. For details, see the man page. +This bc also implements the dot (.) extension of the BSD bc. + Options: -e expr --expression=expr @@ -93,6 +95,9 @@ Options: l(expr) = natural log of expr e(expr) = raises e to the power of expr j(n, x) = Bessel function of integer order n of x + + This bc may load more functions with these options. See the manpage for + details. -P --no-prompt Modified: vendor/bc/dist/gen/dc_help.txt ============================================================================== --- vendor/bc/dist/gen/dc_help.txt Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/gen/dc_help.txt Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/gen/lib.bc ============================================================================== --- vendor/bc/dist/gen/lib.bc Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/gen/lib.bc Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/gen/lib2.bc ============================================================================== --- vendor/bc/dist/gen/lib2.bc Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/gen/lib2.bc Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/gen/strgen.c ============================================================================== --- vendor/bc/dist/gen/strgen.c Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/gen/strgen.c Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/gen/strgen.sh ============================================================================== --- vendor/bc/dist/gen/strgen.sh Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/gen/strgen.sh Tue Jul 7 07:02:33 2020 (r362984) @@ -1,8 +1,8 @@ #! /bin/sh # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# SPDX-License-Identifier: BSD-2-Clause # -# All rights reserved. +# Copyright (c) 2018-2020 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/include/args.h ============================================================================== --- vendor/bc/dist/include/args.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/args.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/include/bc.h ============================================================================== --- vendor/bc/dist/include/bc.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/bc.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -130,13 +130,13 @@ void bc_lex_token(BcLex *l); #define BC_PARSE_LEAF(prev, bin_last, rparen) \ (!(bin_last) && ((rparen) || bc_parse_inst_isLeaf(prev))) -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND #define BC_PARSE_INST_VAR(t) \ ((t) >= BC_INST_VAR && (t) <= BC_INST_SEED && (t) != BC_INST_ARRAY) -#else // BC_ENABLE_EXTRA_MATH +#else // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND #define BC_PARSE_INST_VAR(t) \ ((t) >= BC_INST_VAR && (t) <= BC_INST_SCALE && (t) != BC_INST_ARRAY) -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND #define BC_PARSE_PREV_PREFIX(p) \ ((p) >= BC_INST_NEG && (p) <= BC_INST_BOOL_NOT) Modified: vendor/bc/dist/include/dc.h ============================================================================== --- vendor/bc/dist/include/dc.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/dc.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -35,10 +35,6 @@ #ifndef BC_DC_H #define BC_DC_H - -#ifndef DC_ENABLE_RAND -#define DC_ENABLE_RAND (1) -#endif // DC_ENABLE_RAND #if DC_ENABLED Modified: vendor/bc/dist/include/file.h ============================================================================== --- vendor/bc/dist/include/file.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/file.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/include/history.h ============================================================================== --- vendor/bc/dist/include/history.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/history.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -46,8 +46,6 @@ * * Copyright (c) 2010-2016, Salvatore Sanfilippo * Copyright (c) 2010-2013, Pieter Noordhuis - * - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Modified: vendor/bc/dist/include/lang.h ============================================================================== --- vendor/bc/dist/include/lang.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/lang.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -129,6 +129,7 @@ typedef enum BcInst { BC_INST_ARRAY, #endif // BC_ENABLED + BC_INST_ZERO, BC_INST_ONE, #if BC_ENABLED @@ -137,26 +138,26 @@ typedef enum BcInst { BC_INST_IBASE, BC_INST_OBASE, BC_INST_SCALE, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_SEED, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_LENGTH, BC_INST_SCALE_FUNC, BC_INST_SQRT, BC_INST_ABS, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_IRAND, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_READ, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_RAND, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_MAXIBASE, BC_INST_MAXOBASE, BC_INST_MAXSCALE, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_MAXRAND, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_INST_PRINT, BC_INST_PRINT_POP, @@ -252,9 +253,9 @@ typedef enum BcResultType { BC_RESULT_STR, - BC_RESULT_CONSTANT, BC_RESULT_TEMP, + BC_RESULT_ZERO, BC_RESULT_ONE, #if BC_ENABLED Modified: vendor/bc/dist/include/lex.h ============================================================================== --- vendor/bc/dist/include/lex.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/lex.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -46,8 +46,23 @@ #define bc_lex_err(l, e) (bc_vm_error((e), (l)->line)) #define bc_lex_verr(l, e, ...) (bc_vm_error((e), (l)->line, __VA_ARGS__)) +#if BC_ENABLED + +#if DC_ENABLED #define BC_LEX_NEG_CHAR (BC_IS_BC ? '-' : '_') #define BC_LEX_LAST_NUM_CHAR (BC_IS_BC ? 'Z' : 'F') +#else // DC_ENABLED +#define BC_LEX_NEG_CHAR ('-') +#define BC_LEX_LAST_NUM_CHAR ('Z') +#endif // DC_ENABLED + +#else // BC_ENABLED + +#define BC_LEX_NEG_CHAR ('_') +#define BC_LEX_LAST_NUM_CHAR ('F') + +#endif // BC_ENABLED + #define BC_LEX_NUM_CHAR(c, pt, int_only) \ (isdigit(c) || ((c) >= 'A' && (c) <= BC_LEX_LAST_NUM_CHAR) || \ ((c) == '.' && !(pt) && !(int_only))) @@ -142,27 +157,27 @@ typedef enum BcLexType { BC_LEX_KW_IBASE, BC_LEX_KW_OBASE, BC_LEX_KW_SCALE, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_SEED, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_LENGTH, BC_LEX_KW_PRINT, BC_LEX_KW_SQRT, BC_LEX_KW_ABS, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_IRAND, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_QUIT, BC_LEX_KW_READ, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_RAND, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_MAXIBASE, BC_LEX_KW_MAXOBASE, BC_LEX_KW_MAXSCALE, -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_MAXRAND, -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BC_LEX_KW_ELSE, #if DC_ENABLED Modified: vendor/bc/dist/include/num.h ============================================================================== --- vendor/bc/dist/include/num.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/num.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -110,8 +110,16 @@ typedef struct BcNum { } BcNum; #if BC_ENABLE_EXTRA_MATH + +#ifndef BC_ENABLE_RAND +#define BC_ENABLE_RAND (1) +#endif // BC_ENABLE_RAND + +#if BC_ENABLE_RAND // Forward declaration struct BcRNG; +#endif // BC_ENABLE_RAND + #endif // BC_ENABLE_EXTRA_MATH #define BC_NUM_MIN_BASE (BC_NUM_BIGDIG_C(2)) @@ -173,12 +181,12 @@ void bc_num_bigdig(const BcNum *restrict n, BcBigDig * void bc_num_bigdig2(const BcNum *restrict n, BcBigDig *result); void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val); -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND void bc_num_irand(const BcNum *restrict a, BcNum *restrict b, struct BcRNG *restrict rng); void bc_num_rng(const BcNum *restrict n, struct BcRNG *rng); void bc_num_createFromRNG(BcNum *restrict n, struct BcRNG *rng); -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND void bc_num_add(BcNum *a, BcNum *b, BcNum *c, size_t scale); void bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale); Modified: vendor/bc/dist/include/opt.h ============================================================================== --- vendor/bc/dist/include/opt.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/opt.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/include/parse.h ============================================================================== --- vendor/bc/dist/include/parse.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/parse.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -110,6 +110,7 @@ void bc_parse_updateFunc(BcParse *p, size_t fidx); void bc_parse_pushName(const BcParse* p, char *name, bool var); void bc_parse_text(BcParse *p, const char *text); +extern const char bc_parse_zero[]; extern const char bc_parse_one[]; #endif // BC_PARSE_H Modified: vendor/bc/dist/include/program.h ============================================================================== --- vendor/bc/dist/include/program.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/program.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -61,9 +61,9 @@ typedef struct BcProgram { BcBigDig globals[BC_PROG_GLOBALS_LEN]; BcVec globals_v[BC_PROG_GLOBALS_LEN]; -#if BC_ENABLE_EXTRA_MATH +#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BcRNG rng; -#endif // BC_ENABLE_EXTRA_MATH +#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND BcVec results; BcVec stack; @@ -81,12 +81,15 @@ typedef struct BcProgram { BcVec arr_map; #if DC_ENABLED + BcVec strs_v; + BcVec tail_calls; BcBigDig strm; BcNum strmb; #endif // DC_ENABLED + BcNum zero; BcNum one; #if BC_ENABLED @@ -99,6 +102,7 @@ typedef struct BcProgram { BcDig strmb_num[BC_NUM_BIGDIG_LOG10]; #endif // DC_ENABLED + BcDig zero_num[BC_PROG_ONE_CAP]; BcDig one_num[BC_PROG_ONE_CAP]; } BcProgram; Modified: vendor/bc/dist/include/rand.h ============================================================================== --- vendor/bc/dist/include/rand.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/rand.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2019 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -69,14 +69,16 @@ #ifndef BC_RAND_H #define BC_RAND_H -#if BC_ENABLE_EXTRA_MATH - #include #include #include #include +#if BC_ENABLE_EXTRA_MATH + +#if BC_ENABLE_RAND + typedef ulong (*BcRandUlong)(void*); #if BC_LONG_BIT >= 64 @@ -223,6 +225,8 @@ void bc_rand_pop(BcRNG *r, bool reset); void bc_rand_getRands(BcRNG *r, BcRand *s1, BcRand *s2, BcRand *i1, BcRand *i2); extern const BcRandState bc_rand_multiplier; + +#endif // BC_ENABLE_RAND #endif // BC_ENABLE_EXTRA_MATH Modified: vendor/bc/dist/include/read.h ============================================================================== --- vendor/bc/dist/include/read.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/read.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -33,8 +33,8 @@ * */ -#ifndef BC_IO_H -#define BC_IO_H +#ifndef BC_READ_H +#define BC_READ_H #include @@ -55,5 +55,6 @@ BcStatus bc_read_line(BcVec *vec, const char *prompt); void bc_read_file(const char *path, char **buf); BcStatus bc_read_chars(BcVec *vec, const char *prompt); +bool bc_read_buf(BcVec *vec, char *buf, size_t *buf_len); -#endif // BC_IO_H +#endif // BC_READ_H Modified: vendor/bc/dist/include/status.h ============================================================================== --- vendor/bc/dist/include/status.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/status.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/include/vector.h ============================================================================== --- vendor/bc/dist/include/vector.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/vector.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,9 +1,9 @@ /* * ***************************************************************************** * - * Copyright (c) 2018-2020 Gavin D. Howard and contributors. + * SPDX-License-Identifier: BSD-2-Clause * - * All rights reserved. + * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: Modified: vendor/bc/dist/include/vm.h ============================================================================== --- vendor/bc/dist/include/vm.h Tue Jul 7 06:04:21 2020 (r362983) +++ vendor/bc/dist/include/vm.h Tue Jul 7 07:02:33 2020 (r362984) @@ -1,10 +1,10 @@ /* * ***************************************************************************** * + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2018-2020 Gavin D. Howard and contributors. * - * All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -91,28 +91,64 @@ #define isatty _isatty #endif // _WIN32 +#if DC_ENABLED #define DC_FLAG_X (UINTMAX_C(1)<<0) +#endif // DC_ENABLED + +#if BC_ENABLED #define BC_FLAG_W (UINTMAX_C(1)<<1) #define BC_FLAG_S (UINTMAX_C(1)<<2) -#define BC_FLAG_Q (UINTMAX_C(1)<<3) -#define BC_FLAG_L (UINTMAX_C(1)<<4) -#define BC_FLAG_I (UINTMAX_C(1)<<5) -#define BC_FLAG_G (UINTMAX_C(1)<<6) +#define BC_FLAG_L (UINTMAX_C(1)<<3) +#define BC_FLAG_G (UINTMAX_C(1)<<4) +#endif // BC_ENABLED + +#define BC_FLAG_Q (UINTMAX_C(1)<<5) +#define BC_FLAG_I (UINTMAX_C(1)<<6) #define BC_FLAG_P (UINTMAX_C(1)<<7) #define BC_FLAG_TTYIN (UINTMAX_C(1)<<8) #define BC_FLAG_TTY (UINTMAX_C(1)<<9) #define BC_TTYIN (vm.flags & BC_FLAG_TTYIN) #define BC_TTY (vm.flags & BC_FLAG_TTY) +#if BC_ENABLED + #define BC_S (BC_ENABLED && (vm.flags & BC_FLAG_S)) #define BC_W (BC_ENABLED && (vm.flags & BC_FLAG_W)) #define BC_L (BC_ENABLED && (vm.flags & BC_FLAG_L)) -#define BC_I (vm.flags & BC_FLAG_I) #define BC_G (BC_ENABLED && (vm.flags & BC_FLAG_G)) -#define DC_X (DC_ENABLED && (vm.flags & DC_FLAG_X)) + +#endif // BC_ENABLED + +#if DC_ENABLED +#define DC_X (vm.flags & DC_FLAG_X) +#endif // DC_ENABLED + +#define BC_I (vm.flags & BC_FLAG_I) #define BC_P (vm.flags & BC_FLAG_P) +#if BC_ENABLED + +#define BC_IS_POSIX (BC_S || BC_W) + +#if DC_ENABLED +#define BC_IS_BC (vm.name[0] != 'd') +#define BC_IS_DC (vm.name[0] == 'd') +#else // DC_ENABLED +#define BC_IS_BC (1) +#define BC_IS_DC (0) +#endif // DC_ENABLED + +#else //